Hi im learning Memory Addressing Modes and also playing around with the stack(LIFO)

instead of call, i want to manually write this

so do i use mov?
like this?

mov eax, ;instaled of call TESTTEST and pop is

i understand that my function TESTTEST proc.........is stored at parameter 1 which is

so how do you wrtie out push and pop
Posted on 2010-02-15 18:57:11 by snoopyromeo
Each instruction you want to replace, requires more than one instruction.

; push eax
lea esp,    ; sub esp,4 would affect condition flags
mov ,eax

; pop eax
mov eax,
lea esp,    ; add esp,4 would affect condition flags

; call func
; return_point_1:  ; label to identify location immediately following CALL
push offset return_point
jmp func
return_point_1:
Posted on 2010-02-17 15:10:52 by tenkey

Each instruction you want to replace, requires more than one instruction.


It gets interesting with multiple arguments though...
Eg:
push arg3
push arg2
push arg1
push arg0
call func

Could become:
mov , arg3
mov , arg2
mov , arg1
mov , arg0
lea esp,
call func

Various C/C++ compilers generate code like this, because it removes the dependency on esp that push has (it modifies esp everytime, now it is only modified after it's already been used for addressing). This will allow more instruction level parallelism on most modern CPUs.
Posted on 2010-02-17 15:59:19 by Scali