i want to push some valules, then i want to call a function - in function i want to pop those values, and then i want to ret. But after calling function, at top of heap is adress of next instruction, so that wont work.
Did i solved this problem right? is this gonna work? - http://nopaste.gamedev.pl/?id=4082 (im using fasm, but i dont think that make any difference.
no
you may access data on the stack, then let the RET instruction remove them after you are done
push val2
push val1
call function
.
.
.
function PROC
push ebp
mov ebp,esp
mov eax,[ebp+8] ;val1
mov edx,[ebp+12] ;val2
.
.
.
pop ebp
ret 8 ;return, then pop 8 bytes
function ENDP
notice that [ebp] is the saved ebp value, and [ebp+4] is the return address for the CALL - [ebp+8] is the last-pushed parameter
the INVOKE directive may also be used
invoke function,val1,val2
there are also other ways to access them in the PROC
now, you may pop them off the stack inside the PROC if you like, but it isn't neccessary...
function PROC
pop ecx ;return address
pop eax ;val1
pop edx ;val2
push ecx ;put the return address back on the stack
.
.
.
ret
function ENDP
the MASM manual explains the other ways of accessing the values as LOCAL variables
:lol
don't use invoke , proc and all this sort of things like macro,structures ....
The best write is this one
Quote
0000072C 6A 00 ; push +000000000h
0000072E E8 00000000 ; call ExitProcess
now, now, Yves
let's not confuse the new guy :naughty:
(http://avatars.jurko.net/uploads/avatar_23077.gif)
No confuse,it's so best that I let it done by a listing !
Quote
BUT Now ,I think I need my grand Mother !
Granny can't save you, now