汇编语言——输入两位数比较大小

源代码 

code    segment
        assume cs:code
        org 100h
start:
        jmp bbb
msg1    db 10,13,'please input x:','$'
msg2    db 10,13,'please input y:','$'
x       db 0
y       db 0
msg3    db 10,13,'x=y','$'
msg4    db 10,13,'x>y','$'
msg5    db 10,13,'x<y','$'
 
bbb:
        push cs
        pop ds
        lea dx,msg1
        mov ah,09h
        int 21h
        mov ah,1
        int 21h
        sub al,30h
        mov ah,0
        mov bl,10
        mul bl
        mov cl,al
        mov ah,1
        int 21h
        sub al,30h
        mov ah,0
        add al,cl
        mov byte ptr[x],al
 
        lea dx,msg2
        mov ah,09h
        int 21h
        mov ah,1
        int 21h
        sub al,30h
        mov ah,0
        mov bl,10
        mul bl
        mov cl,al
        mov ah,1
        int 21h
        sub al,30h
        mov ah,0
        add al,cl
        mov byte ptr[y],al
 
        mov bl,byte ptr[x]
        sub al,bl
        jz l1
        jc l2
        jmp l3
l1:
        lea dx,msg3
        mov ah,9
        int 21h
        jmp exit1
l2:
        lea dx,msg4
        mov ah,9
        int 21h
        jmp exit1
l3:
        lea dx,msg5
        mov ah,9
        int 21h
;        jmp exit1
 
exit1:
        mov ah,4ch
        int 21h
code    ends
        end start

参考文章

https://zhidao.baidu.com/question/562479802788685844.html

已标记关键词 清除标记
©️2020 CSDN 皮肤主题: 1024 设计师:上身试试 返回首页