News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Going through Lczelion's tutorials... push and pop?

Started by JamieJean, February 08, 2021, 01:58:38 AM

Previous topic - Next topic

JamieJean

I'm going through Lczelion's tutorials, but I need some confirmation for push and pop.

So is it correct that by doing:
push varOne
pop varTwo

...I'm copying the value of varOne onto the stack, then removing the value from the stack and moving it to varTwo?
So
varOne would stay the same,
the stack would ultimately stay the same,
and varTwo would obtain the value of varOne?

Vortex

Hi JamieJean,

Your observation is correct. After the consecutive push & pop operations, the variable varOne remains intact and varTwo becomes equal to varOne. Finally, the stack remains unmodified, the value of esp ( the stack pointer ) before push = the value of esp after pop