汇编语言设计,输入两个数,输出其中较大的一个数
看附件吧。
晕菜,用附件上传也非法!!!原来是注释不合法,真让人无语了。
data segment
X DW 0
Y DW 0
data ends
code segment
assume cs:code, ds:data
start:
MOV AX, data
mov ds, ax
lea si, X
call readint
lea si, Y
call readint
mov ax, X
cmp ax, Y
ja P0
mov ax, Y
P0:
call print
exit:
mov ah,4ch
int 21h
readint proc near
mov bx,10
read:
mov ah,1
int 21h
cmp al,'0' ; not in '0'-'9'
jb r0 ; then return
cmp al,'9'
ja r0
sub al,30h
mov ah,0
xchg ax,[si]
mul bx
xchg [si],ax
add [si],ax
jmp read
r0:
ret
readint endp
print proc near
mov bx, 10
xor cx,cx
Q0:
xor dx,dx
div bx
xor dx,0E30h
push dx
inc cx
cmp ax, 0
jnz Q0
Q1:
pop ax
int 10h
loop Q1
ret
print endp
code ends
end start