当它点击“Ret 8”时,我的程序停止工作。有人能告诉我为什么吗?
找到用户输入的2个数字的GCD。保持循环直到你停止它。
提前致谢
INCLUDE irvine32.inc
.data
msg1 byte " Enter first number", 0ah, 0dh,0
msg2 byte " Enter second number",0ah, 0dh,0
msg3 byte " GCD is ",0ah,0dh,0
ValA DWORD ?
ValB DWORD ?
.code
main PROC
start:
mov edx, offset msg1
call WriteString
call ReadDec
mov ValA,eax
mov edx, offset msg2
call WriteString
call ReadDec
mov ValB,eax
mov eax,DWORD ptr[ValA]
mov ebx,DWORD ptr[ValB]
push ValB
push ValA
call CalcGcd
call DumpRegs
call start
exit
main ENDP
CalcGcd PROC
push ebp
mov ebp, esp
xor edx,edx
mov eax, [ebp+8]
mov ebx, [ebp+12]
L1:
cmp eax,ebx
JE DONE
JB EXCH
L2:
div ebx
cmp edx,0
JE DONE
mov eax,ebx
mov ebx,edx
JMP L1
EXCH:
XCHG eax,ebx
JMP L1
DONE:
mov eax,ebx
mov edx, offset msg3
call writestring
call writedec
ret 8
CalcGcd ENDP
END main
答案 0 :(得分:0)
代码在返回之前缺少x_test = np.array([[8],[6],[0],[2],[0],[0],[0],[0],[112.128],[0],[0],[2],[0],[1],[1],[2],[2]])
。 pop ebp
将一遍又一遍地循环,直到程序用完堆栈空间。