装配重新编号

时间:2013-05-05 09:22:39

标签: assembly x86

我正在制作一个汇编计算器来添加和减去数字,但是我的代码挂在一个特定的位置,我真的不明白为什么它会挂起。至于我可以测试它挂在puttogether部分

所以这是一个过程(并非完全完整,只是尝试执行这些步骤):

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

0 个答案:

没有答案