TITLE Calculating a Factorial
INCLUDE Irvine32.inc
.code
main PROC
    push 12
    call Factorial
ReturnMain:
    call WriteDec
    call Crlf
    ret
main ENDP
Factorial PROC
    enter 0,0
    mov eax,[ebp+8]
    cmp eax,0
    ja L1
    mov eax,1
    jmp L2
L1: dec eax
    push eax
    call Factorial
ReturnFact:
    mov ebx,[ebp+8]
    mul ebx
L2: leave
    ret 4
Factorial ENDP
END main

这段代码疑惑了很久,认为程序根本没办法正常运行,但调试之后结果却是正常的

最后终于明白了。。。

原来 call  之后压入栈堆是返回到ReturnFact   我本能的以为要返回到Factorial