帮忙看个代码
输了8个数,只能0-9,其他报错~~~~最后调试,输到第8个数会出现报错..而且还可以输~~~~DATAS SEGMENT
FALSE DB'WRONG NUMBER,INPUT AGAIN$';此处输入数据段代码
DATAS ENDS
CODES SEGMENT
ASSUME CS:CODES,DS:DATAS
START:
MOV AX,DATAS
MOV DS,AX
MOV CX,8
L0:MOV AH,02H
MOV DL,07H
INT 21H
MOV AH,01H
INT 21H
CALL INPU
CALL DISPL
MOV AH,4CH
INT 21H
INPU PROC NEAR
INPUT:
SUB AL,30H
CMP AL,0DH
JZ WRONG
CMP AL,20H
JZ WRONG
CMP AL,09H
JA WRONG
CMP AL,00H
JB WRONG
MOV [DI],AL
INC DI
LOOP L0
INPU ENDP
WRONG:
MOV AH,09H
MOV DX,OFFSET FALSE
INT 21H
JMP L0
DISPL PROC NEAR
DISP:MOV AH,02H
MOV BX,8
MOV DL,[DI+BX-1]
INT 21H
DEC BX
JNZ DISP
RET
DISPL ENDP
CODES ENDS
END START