START:
MOV AX,DATAS
MOV DS,AX
call calculator
mov ah,02
mov bh,00
mov dl,17
mov dh,6
int 10h
again:
mov bx,offset DATA1
mov ah,1
int 16h
jz again
mov ah,0
int 16h
cmp ah,10h
je exit ;若为q,则退出程序
cmp ah,39h
je input ;若为空格,则跳到input开始进行数据的输入
jmp again ;否则跳到again重新检测按键
input:
mov ah,0
int 16h
cmp al,'1'
je disp_store
cmp al,'2'
je disp_store
cmp al,'3'
je disp_store
cmp al,'4'
je disp_store
cmp al,'5'
je disp_store
cmp al,'6'
je disp_store
cmp al,'7'
je disp_store
cmp al,'8'
je disp_store
cmp al,'9'
je disp_store
cmp al,'0'
je disp_store ;输入若为0-9,则跳到disp_store进一步显示和储存
cmp al,'+'
je disp_store
cmp al,'-'
je disp_store
cmp al,'x'
je disp_store
cmp al,'/'
je disp_store
cmp al,'='
je disp_store
cmp ah,1Eh ;若为回车,则跳到judge开始判断运算类型
je judge
cmp ah,10h
je exit ;若为q,则退出
jmp clr ;若为其他,则说明输入错误,那么跳到clr,进一步处理
disp_store:
mov ah,02
mov dl,al
int 21h ;显示刚刚输入的数据
jmp store ;跳回input
store:
mov [bx],al
inc bx
jmp input
judge:
cmp byte ptr[bx+2],'+'
je adder
cmp byte ptr[bx+2],'-'
je subber
cmp byte ptr[bx+2],'x'
je multiply
cmp byte ptr[bx+2],'/'
je divide
mov ah,02
mov dl,[bx+1]
int 21h
jmp input
就是这一段,到disp_store 都能运行,但是judge段里判断的 [bx+2]与四种符号不符合,每次都执行了后面的mov ah,02到 jmp部分的代码。比如我输入进去的是一个“12+12=",应该bx+2位置上的存取的是‘+’的asc码,但是我输出这个[bx+2]却是一个空格,不知道怎么弄了。。。请大神帮忙呀