我有个汇编程序调试通过不了,请大家帮帮忙啊!看看错在哪儿了

程序功能:从键盘上输入两个四位的16进制数,并在屏幕上显示这两个数的和。DATASEGMENTSTRBUF1DB'Pleaseinputthefirstdata:,$'F... 程序功能:从键盘上输入两个四位的16进制数,并在屏幕上显示这两个数的和。

DATA SEGMENT
STRBUF1 DB 'Please input the first data:,$'
FIRST DB 4 DUP(?)
STRBUF2 DB 'Please input the second data:,$'
SECOND DB 4 DUP(?)
STRBUF3 DB 'Display the sum:,$'
SUM DB 5 DUP(?)
STRBUF4 DB 'Please input 1 and exit!'
DATA ENDS
STACK SEGMENT
DB 100 DUP(0)
TOP DB ?
STACK ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA,SS:STACK
START:
MOV AX,DATA
MOV DS,AX
MOV AX,STACK
MOV SS,AX
MOV SP,OFFSET TOP
LEA DX,STRBUF1
MOV AH,9
INT 21H
LEA DX,FIRST
MOV AH,0AH
INT 21H
LEA DX,STRBUF2
MOV AH,9
INT 21H
LEA DX,SECOND
MOV AH,0AH
INT 21H
MOV DI,OFFSET FIRST
CALL READH
MOV DI,OFFSET SECOND
CALL READH
POP AX
POP BX
ADD AX,BX
JNC AA2
MOV BL,1
ADD BL,30H
MOV DI,OFFSET SUM
MOV [DI],BL
INC DI
JMP AA3
AA2:MOV DI,OFFSET SUM
AA3:MOV DX, AX
CALL CONHA
MOV [DI+3],BL
MOV [DI+2],BH
MOV AL,DH
CALL CONHA
MOV [DI+1],BL
MOV [DI],BH
DISPLAY:LEA DX,STRBUF3
MOV AH,09H
INT 21H
LEA DX,SUM
MOV AH,09H
INT 21H
LEA DX,STRBUF4
MOV AH,09H
INT 21H
AA1: MOV AH,01H
INT 21H
CMP AL,31H
JNZ AA1
MOV AH,4CH
INT 21H
READH PROC NEAR
MOV CX,4
MOV SI,CX
MOV BX,0
AA0: MOV AL,[DI]
CALL CONV
SHL BX,CL
ADD BL,AL
INC DI
DEC SI
JNZ AA0
PUSH BX
RET
READH ENDP

CONV PROC
CMP AL,'9'
JBE CONV2
CMP AL,'a'
JB CONV1
SUB AL,20H
CONV1: SUB AL,7
CONV2: SUB AL,30H
RET
CONV ENDP

CONHA PROC
MOV AH,AL
AND AL,OFH
CMP AL,0AH
JB ASC1
ADD AL,07
ASC1: ADD AL,30H
MOV BL,AL
MOV CL,4
SHR AH,CL
CMP AH,0AH
JB ASC2
ADD AH,07
ASC2: ADD AH,30H
MOV BH,AH
RET
CONHA ENDP

CODE ENDS
END START
多谢,第100行的指令的确写错了
现在可以通过编译了,但是还是不能实现题目所要实现的功能,不知为何???
展开
 我来答
冠月朗eI
2007-11-02 · TA获得超过1269个赞
知道小有建树答主
回答量:334
采纳率:0%
帮助的人:0
展开全部
1、第100行的指令可能是你输入时有误,AND AL,OFH 中的0FH(是零FH)误写的OFH(欧FH)。
2、在下面两条指令
MOV AH,4CH
INT 21H
前加两条指令
MOV AH,1
INT 21H
等待按键,保证结果在屏幕上停留一段时间,以便看清结果。

补充答案:终于调试通过了。
DATA SEGMENT
STRBUF1 DB 'Please input the first data:$'
FIRST DB 5,?,5 DUP(?)
STRBUF2 DB 'Please input the second data:$'
SECOND DB 5,?,5 DUP(?)
NUMBER DW ?,?
STRBUF3 DB 'Display the sum:$'
SUM DB 6 DUP(?),'$'
STRBUF4 DB 'Please any key to exit!$'
DATA ENDS
STACK SEGMENT
DB 100 DUP(0)
TOP DB ?
STACK ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA,SS:STACK
START:
MOV AX,DATA
MOV DS,AX
MOV AX,STACK
MOV SS,AX
MOV SP,OFFSET TOP
LEA DX,STRBUF1
MOV AH,9
INT 21H
LEA DX,FIRST
MOV AH,0AH
INT 21H
MOV DL,0DH
MOV AH,2
INT 21H
MOV AH,2
MOV DL,0AH
INT 21H
LEA DX,STRBUF2
MOV AH,9
INT 21H
LEA DX,SECOND
MOV AH,0AH
INT 21H
MOV AH,2
MOV DL,0DH
INT 21H
MOV DL,0AH
INT 21H
LEA BP,NUMBER
MOV DI,OFFSET FIRST+2
CALL READH
MOV DI,OFFSET SECOND+2
CALL READH
MOV AX ,NUMBER
MOV BX ,NUMBER+2
ADD AX,BX
JNC AA2
MOV BL,1
ADD BL,30H
MOV DI,OFFSET SUM
MOV [DI],BL
INC DI
JMP AA3
AA2:MOV DI,OFFSET SUM
AA3:MOV DX, AX
CALL CONHA
MOV [DI+3],BL
MOV [DI+2],BH
MOV AL,DH
CALL CONHA
MOV [DI+1],BL
MOV [DI],BH
MOV BYTE PTR [DI+4],'$'
DISPLAY:LEA DX,STRBUF3
MOV AH,09H
INT 21H
LEA DX,SUM
MOV AH,09H
INT 21H
MOV DL,0DH
MOV AH,2
INT 21H
MOV AH,2
MOV DL,0AH
INT 21H
LEA DX,STRBUF4
MOV AH,09H
INT 21H
MOV AH,1
INT 21H
MOV AX,4C00H
INT 21H
READH PROC NEAR
MOV CX,4
MOV SI,CX
MOV BX,0
AA0: MOV AL,[DI]
CALL CONV
SHL BX,CL
ADD BL,AL
INC DI
DEC SI
JNZ AA0
MOV DS:[BP],BX
ADD BP,2
RET
READH ENDP
CONV PROC NEAR
CMP AL,'9'
JBE CONV2
CMP AL,'a'
JB CONV1
SUB AL,20H
CONV1: SUB AL,7
CONV2: SUB AL,30H
RET
CONV ENDP
CONHA PROC NEAR
MOV AH,AL
AND AL,0FH
CMP AL,0AH
JB ASC1
ADD AL,07
ASC1: ADD AL,30H
MOV BL,AL
MOV CL,4
SHR AH,CL
CMP AH,0AH
JB ASC2
ADD AH,07
ASC2: ADD AH,30H
MOV BH,AH
RET
CONHA ENDP
CODE ENDS
END START
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式