回复 4楼 zaixuexi
我写了另外一个关于 从键盘输入两个2位十进制正数,对这两个数进行加法或者乘法运算,结果以十六进制数形式显示在屏幕上。调试有问题 帮我看看
DATAS SEGMENT
SHURU1 DB
5,0,0,0,0,0,0, 0AH,0DH,'$'
SHURU2 DB
5,0,0,0,0,0,0, 0AH,0DH,'$'
RES DW 0
NUM DB 0AH
SHUCHU
DB
3
DUP(0),0AH,0DH,'$'
DATAS ENDS
STACKS SEGMENT PARA STACK
STACKS ENDS
CODES SEGMENT
ASSUME CS:CODES,DS:DATAS,SS:STACKS
START:
MOV AX,DATAS
MOV DS,AX
LEA DX,SHURU1
MOV AH,0AH
INT 21H
LEA DX,SHURU2
MOV AH,0AH
INT 21H
LEA SI,SHURU+2
MOV BX,0
MOV AL,[SI]
SUB AL,30H
MUL NUM
ADD RES,AX
INC SI
MOV AL,[SI]
SUB AL,30H
ADD RESULT,PTR WORD AL
LEA SI,BUF2+2
MOV BX,0
MOV AL,[SI]
SUB AL,30H
MUL NUM
ADD RES,AX
INC SI
MOV AL,[SI]
SUB AL,30H
ADD RESULT,PTR WORD AL
MOV AX,RES
AND AX,00F0H
CMP AX,09H
JBE OO
ADD AX,37H
LEA SI,SHUCHU
MOV [SI],AX
INC SI
JMP LL
OO: ADD AX,30H
LEA SI,SHUCHU
MOV [SI],AX
INC SI
LL:MOV AX,RES
AND AX,000FH
CMP AX,09H
JBE XX
ADD AX,37H
MOV [SI],AX
JMP DONE
XX:ADD AX,30H
MOV [SI],AX
DONE:
LEA DX,SHUCHU
MOV AH,09H
INT 21H
MOV AH,4CH
INT 21H
CODES ENDS
END START