, , , .
( ) 2 + 4 6
mov eax, 6 ;eax is just an example here or
mov tot_addr, 6 ; mem->mem mov
, ,
push 4 ;assuming 4 byte ints
push 4 ;wrote 2 to be clear that you have to push both variables
call add
- . ( push ). , , RET . , ,
mov eax, 4
add eax, 2
, , , ( )
: . , , , , , CALL . ,
mov eax, 4
mov ecx, 2
push 4 ; size for return value
push eax
push ecx
call add
mov eax, 4
mov exc, 2
add eax, ecx
:
int a = 4;
int b = 2;
int res = add(a, b);
int a = 4;
int b = 2;
int res = a + b;
, .