为什么无论输入什么数mistake都执行了?
DATAS SEGMENTinput db 'please input x(0~9):$'
num1 db 0
num2 db 9
x dw ?
STRING DB 'Input Error!',13,10,'$'
DATAS ENDS
STACKS SEGMENT
;此处输入堆栈段代码
STACKS ENDS
CODES SEGMENT
ASSUME CS:CODES,DS:DATAS,SS:STACKS
START:
MOV AX,DATAS
MOV DS,AX
mov DX,offset input;取地址
mov AH,9;实现9号功能,显示字符串
INT 21H
MOV AH,1;把十六进制数1(表示为01h)装入ah寄存器
INT 21H;调用 int 21H 中断,返回值放在 al寄存器中
AND AL,0FH;取AL低四位
cmp num1,AL
JBE next1
;jmp mistake
next1:
cmp al,num2
jbe next2
; jmp mistake
next2:
mov ah,0
mov bx,ax
mul ax
mul ax
div bx
mov x,ax
mistake:
LEA DX,STRING
MOV AH,9
INT 21H
MOV AH,4CH
INT 21H
CODES ENDS
END START