mov ah,02h; 输出回车换行 mov dl,0ah
int 21h mov ah,0dh
int 21h
lea dx,s1; 最大值输出 mov ah,09h int 21h
mov al,bh call DISP
DISP proc
push bx cmp al,100 jz mf cmp al,10 jb gw mov ah,0 mov bl,10 div bl add al,30h mov display[0],al add ah,30h mov display[1],ah
lea dx,display
mov ah,4ch int 21h
done:
mov ah,09h int 21h
mov ah,02h; 输出回车换行
mov dl,0ah
int 21h mov ah,0dh
int 21h pop bx
ret
mf: mov display[0],31h
mov display[1],30h mov display[2],30h jmp done
gw: add ah,30h
mov display[0],ah jmp done
DISP ENDP Code ends
3、读入字符串
Code segment
assume cs:code, ds:data end start
start:
mov ax,data
mov ds,ax
mov ah,0ah lea dx,x+2 int 21h
mov ah,02h; 输出回车换行 mov dl,0ah
int 21h mov ah,0dh
int 21h
mov dx,offset x+2 mov ah,09h int 21h lea si,x lea di,y mov bx,di mov ah,48
again:
mov cx,3
repz cmpsb jz found inc si mov di,bx dec ah jnz again
mov ah,02h; 输出回车换行 mov dl,0ah
int 21h mov ah,0dh
int 21h lea dx,s2 jmp done
found: lea dx,s1 done: mov ah,09h int 21h
mov ah,4ch int 21h
Code ends
end start
四. 实验结果(包括必要的截图)
2.1
2.2
2.3
五. 实验体会
通过此次试验,我掌握顺序和循环程序结构和设计方法,能在PC上对循环结构和顺序结构进行编程。熟悉在PC机上建立、汇编、连接、调试和运行8086/8088汇编语言程序的过程。