Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Include irvine32.inc
- ;irvine32.inc already uses this directive for us:
- ; .model flat, STDCALL
- .data
- result DWORD ?
- .code
- add_func PROC C a:SDWORD, b:SDWORD
- ; SDWORD type is a signed 32-bit value
- ; When parameters are specifiec with PROC push ebp and mov ebp, esp
- ; prologue are done automatically
- ; Get the arguments
- mov eax, a
- mov ecx, b
- ; Add a and b
- add eax, ecx
- ; Store the result in a variable
- mov result, eax
- call WriteInt
- exit_function:
- ; Return the result in EAX
- mov eax, result
- ; When a RET instruction is found by MASM inside a PROC
- ; defined function proper epilogue code
- ; will be emitted (restoring ESP from EBP etc). If STDCALL
- ; calling convention is declared with PROC the RET will be
- ; modified by MASM so that it removes the specified number of
- ; byte from the stack based on the arguments defined by PROC.
- ; With CDECL this will just be a RET instruction.
- ret
- add_func ENDP
- END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement