我写了 GreatCommonDivisor 并使用了声明 ret down repeat....until
,但发现它仍然进入repeat ..... until
并导致除以零错误。
我认为ret
弹出调用者下一行的地址,但为什么它会跳转到repeat...until
?
ps:eax is dividend and ebx is divisor.
提前谢谢。
INCLUDE Irvine32.inc
.data
.code
main PROC
mov eax, 75
mov ebx, 18
call gcd
main ENDP
gcd PROC
or eax,eax;set SF
.IF Sign?
Neg eax
.Else
.EndIf
or ebx,ebx;set SF
.IF Sign?
Neg ebx
.Else
.EndIf
.Repeat
mov edx, 0
div ebx
mov eax, ebx
mov ebx, edx
.Until ebx <= 0
call WriteInt
ret
gcd ENDP
END main