新手求大神指点,为什么程序运行和调试结果不一样。。
将一组有符号数“38H,4AH,0C5H,83H,9CH,0B4H,7FH,0C4H,05H,0F5H”中的负数求和,并在屏幕上以十进制的形式显示结果。
MASM6.0编写,运行环境是32位XP虚拟机。程序运行的时候显示错误结果“-0”,但是调试时候却能显示正确结果“-206”。。求问一下到底是哪里出错了。。
DATAS SEGMENT DECIMALST DB 15 DUP(0) NEGETIV DB 15 DUP(0) NUMBERS DB 38H,4AH,0C5H,83H,9CH,0B4H,7FH,0C4H,05H,0F5HDATAS ENDSCODES SEGMENT ASSUME CS:CODES,DS:DATASSTART: MOV AX,DATAS MOV DS,AX MOV AX,0 MOV BX,0 CALL JUDGE CALL ADDITION CALL OUTPUT MOV AH,4CH INT 21H JUDGE PROC NEAR LEA SI,NEGETIV LEA DI,NUMBERS MOV CX,0AH MOV DL,0A0HCHECKS: MOV BL,[DI] INC DI CMP BX,DX JG NEGETIVEBACKCHECK: LOOP CHECKS RETNEGETIVE: MOV [SI],BL INC SI JMP BACKCHECK JUDGE ENDPADDITION PROC NEAR LEA SI,NEGETIVADDS: MOV BL,[SI] INC SI NEG BL CMP BL,0 JZ EXITA ADD AX,BX JMP ADDSEXITA: RETADDITION ENDPOUTPUT PROC NEAR MOV DX,0 MOV CX,10D LEA DI,DECIMALSTDIVID: DIV CX MOV [DI],DL INC DI INC BH MOV DX,0 CMP AX,0 JZ PRINTFIRST JMP DIVIDPRINTFIRST: MOV AH,2 MOV DL,'-' INT 21HPRINT: MOV AH,2 DEC DI MOV DL,[DI] ADD DL,30H INT 21H DEC BH JZ EXITOP JMP PRINTEXITOP: RETOUTPUT ENDP CODES ENDS END START