0

我正在制作一个汇编计算器来添加和减去数字,但我的代码挂在一个特定的点上,我真的不明白它为什么挂起。据我所知,它挂在拼凑部分。

所以这是过程(不完全完成,只是尝试执行步骤):

ADDER PROC
CALL NUM1
XOR CX, CX  ;CX resetting
MOV CX, 10  ;set CX to 10
MOV DL, 10  ;multiplier of number(x * 10^n)
moveend:
LODSB       ;here i move the index to the end and sub 1 from it to be on the     last character
CMP AL, '0' 
JNE moveend     
SUB SI, 1d  
MOV AL, [SI]   
MOV BL, AL  ;moving al to bl(this will contain the whole number)
puttogether:
DEC SI      ;si decreasing
CMP SI, 0
JB veg ;jumps to end, and print if si is before the first character
MOV AL, [SI]
IMUL DL     ;multiply with 10^n
ADD BL, AL  ;BL contains the number so far
XOR AX, AX      ;increasing DL to 10^(n+1)
MOV AL, DL  ;
XOR DX, DX  ;
IMUL CX     ;
MOV DL, AL  ;
XOR AX, AX  ;
JMP puttogether 
veg:
MOV AX, BX
int 21h
RET
ADDER ENDP
4

0 回答 0