Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- global _start
- extern ExitProcess
- section .data
- section .text
- factorial: push ebp
- mov ebp,esp
- my_loop: mov ebx,eax
- dec ebx
- mul ebx
- cmp ebx,1
- jne my_loop
- mov esp,ebp ; stack-frame leave (obnoveni ESP)
- pop ebp ; stack-frame leave (obnoveni EBP)
- ret
- _subfact: push ebp
- mov ebp,esp
- mov eax,[ebp+8]
- call factorial
- mov ebx,eax
- mov eax,[ebp+12]
- call factorial
- sub eax,ebx
- mov esp,ebp ; stack-frame leave (obnoveni ESP)
- pop ebp ; stack-frame leave (obnoveni EBP)
- push eax
- push ebx
- ret
- _start:
- push dword 5
- push dword 7
- call _subfact
- end:
- ;
- ; VOID WINAPI ExitProcess( _In_ UINT uExitCode ) ;
- ;
- push dword 0 ; Arg1: push exit code
- call ExitProcess
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement