注册 登录
编程论坛 汇编论坛

关于条件判断及转移指令的问题

l1206795157 发布于 2013-05-23 19:42, 737 次点击
begin:      mov ah,1
                int 21h
                cmp al,'E'              ;当al=e或E时,zf=1
                je exit                 ;zf=1时,调用exit
                cmp al,'e'
                je exit
                sub al,'0'              ;当al小于等于0是,cf=1;
                jbe error                ;zf或CF等于一时,跳转到标号处
               
                cmp al,'9'
                ja error                ;al>9转移
                cmp al,'1'                ;这里如果要当(al)=1时跳转到buchong,要怎么改,现在这样编译时不知道为什么不跳转
                je buchong

               
      
                mov bx,offset m0        ;将指针拨到m0处
                sub ax,1
                mul ten                ;(ax)=(ax)*10(乘法指令)
                add bx,ax              ;将输入的数字当做偏移地址加到bx中
                call display
                jmp begin

buchong:        mov ah,1
                int 21h            ;在输入一个字符之后怎样判断是不是回车,是的话怎样跳转呢,是不是,je port?
2 回复
#2
l12067951572013-05-23 22:05
1到9之间判断时不需要加单引号就ok了
判断回车换行:
cmp al,0ah
je port            ;当(al)=会车时,跳转到port处执行
cmp al,0dh
je port
#3
hu9jj2013-05-24 13:54
引号括起来的是字符而不是数值。
1