In short (maybe) I know that functions can pass arguments such as:
Code: Select all
' ${Language = NASM}
SECTION .text
. . .
foo:
. . .
push dummy_var
call bar ; bar(dummy_var)
add esp, 4
. . .
. . .
bar: ; bar(byte uB)
. . .
mov eax, [esp+4] ; (byte)eax = uB;
. . .
leave
ret
Example, just for those who may not be familiar with this:
Code: Select all
' ${Language = NASM}
[GLOBAL main]
[EXTERN printf]
SECTION .data
fmt: db '%s',10,0
SECTION .text
main:
mov ecx, [esp+4] ; argc
mov edx, [esp+4*2] ; argv
push ecx ; Because printf
push edx ; -- likes to destroy the ecx and edx register contents :P
push dword [edx] ; argv[0]
push dword fmt
call printf ; printf('%s\n', *argv[0]);
add esp, 8
leave
ret
' Assembled and linked with a standard C-library that contains 'printf'
Thank you,
Matt