What is the difference between the two lines
push eax
mov [esp], eax
Doesn't push eax on to the stack (where esp is pointing to just as mov [esp], eax does?)
"push" will automatically bump the value of "esp" (your stack pointer). The "mov" won't. So i if you wanted to put multiple items on the stack, with push
, you just do:
push eax
push ebx
...
With mov
, to get the same results, you'd have:
sub esp,4
mov [esp], eax
sub esp,4
mov [esp], ebx
...
And the nice thing about push
is that there is the reverse operation, pop
which allows you to pull things back off in reverse order. Which is, of course, what a stack is all about. :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With