哪位大侠帮忙看下程序
;我做的是从键盘输入4位的 十进制数然后相加,将结果显示,但是求和部分出错,哪位高手帮忙看一下DISP MACRO ;定义宏
MOV DL,AL
MOV AH,2
INT 21H
ENDM
DATAS SEGMENT
MESG1 DB "PLEASE INPUT 4 NUMBER:" ,0AH,0DH,'$'
MESG2 DB "THE RESULT IS :",0AH,0DH,'$'
BUF DB 5,0,5 DUP(?)
NUM DW 4 DUP(?)
SUM DW 0
DATAS ENDS
STACKS SEGMENT
DW 100 DUP(?) ;此处输入堆栈段代码
STACKS ENDS
CODES SEGMENT
ASSUME CS:CODES,DS:DATAS,SS:STACKS
START:
PUSH DS
XOR AX,AX
PUSH AX
MOV AX,DATAS
MOV DS,AX
LEA DX,MESG1 ;显示提示信息1
MOV AH,9
INT 21H
MOV BX,4
LEA SI,NUM ;输入代码,存储形式为非压缩BCD码
LOOPT:MOV DX,OFFSET BUF
MOV AH,10
INT 21H
MOV AX,WORD PTR BUF+4
AND AX,0F0FH
MOV CL,4
SHL AL,CL
OR AL,AH
MOV BYTE PTR [SI],AL
MOV AX,WORD PTR BUF+2
AND AX,0F0FH
SHL AL,CL
OR AL,AH
MOV BYTE PTR [SI+1],AL
ADD SI,4
MOV DL,0AH;换行
MOV AH,2
INT 21H
MOV DL,0DH
MOV AH,2
INT 21H
DEC BX
JNZ LOOPT
[bold];求和代码MOV
LEA SI,NUM
MOV CX,3
MOV AX,[SI]
MOV SUM,AX
LOOP2:LEA DI,SUM
MOV BX,2
LOOP1:MOV AL,[DI]
ADC AL,[SI+4]
DAA
MOV [DI],AL
INC SI
INC DI
DEC BX
JNZ LOOP1
INC SI
LOOP LOOP2[/bold]
;显示提示信息2
LEA DX,MESG2
MOV AH,9
INT 21H
MOV AX,SUM;显示千位
MOV CL,4
MOV BH,AH
AND AH,0F0H
SHR AH,CL
ADD AH,30H
MOV AL,AH
DAA
DISP
AND BH,0FH;显示百位
ADD BH,30H
MOV AL,BH
DAA
DISP
MOV AX,SUM;显示十位
MOV BL,AL
AND AL,0F0H
SHR AL,CL
ADD AL,30H
DAA
DISP
AND BL,0FH;显示个位
ADD BL,30H
MOV AL,BL
DAA
DISP
MOV AH,4CH
INT 21H
CODES ENDS
END START