The MASM Forum

General => The Campus => Topic started by: JamieJean on February 08, 2021, 01:58:38 AM

Title: Going through Lczelion's tutorials... push and pop?
Post by: JamieJean on February 08, 2021, 01:58:38 AM
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?
Title: Re: Going through Lczelion's tutorials... push and pop?
Post by: Vortex on February 08, 2021, 02:08:46 AM
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
Title: Re: Going through Lczelion's tutorials... push and pop?
Post by: JamieJean on February 08, 2021, 02:15:23 AM
Thanks!