If this is your actual listing, then there is no code after you call the function so the program just exits.
Your store your result in EAX so if you wanted to do something with the answer you can write some more code
that deals with that after the 'call Addition' line.
Ret is like 'return' in C++, and just is there so the program knows to return to the line after which the call
was made (as you probably read somewhere: ebp = old ebp value, ebp+4 = return address, ebp+8=1st argument etc, so basically
'ret' says 'jmp to ebp+4' and ebp should be restored to the old ebp value
Say you push 2 32bit values before a function call. If you see 'ret 8' in the function it means it's cleaning up the stack those 8 bytes for you (updating where esp points). Depending on the caling convention the caller may need to do the cleanup instead, and that's when you see:
Code:
push eax
push ebx
call someFunction
add esp, 8 ;This cleans up the stack pointer to 'get rid' of the 2 arguments we pushed earlier
Depending on how a function call is setup, ESP can point to 'local variables' in the function. Wikipedia had this interesting example:
Code:
As an example, the following C code:
void MyFunction3(int x, int y, int z)
{
int a, int b, int c;
...
return;
}
Will create the following assembly code:
push ebp
mov ebp, esp
sub esp, 12 ; sizeof(a) + sizeof(b) + sizeof(c)
;x = [ebp + 8], y = [ebp + 12], z = [ebp + 16]
;a = [ebp - 12] = [esp], b = [ebp - 8] = [esp + 4], c = [ebp - 4] = [esp + 8]
mov esp, ebp
pop ebp
ret 12 ; sizeof(x) + sizeof(y) + sizeof(z)
Hope that clears things up a bit