Stack:
0xDDDD
0xCCCC
0xBBBB
0xAAAA
pop ax Means:
- 0xAAAA will be placed in ax
- SS:SP will point now to 0xBBBB.
Now, I get this.
0xDDDD
0xCCCC
0xBBBB
I want to save ax's value.
push ax.
0xDDDD
0xCCCC
0xBBBB
0xAAAA
Here I go again.
mov ax, [ss:sp+2]
0xBBBB will be loaded in ax.
After my function is done, I will want to remove both 0xAAAA and 0xBBBB from the stack. First, I will restore ax.
pop ax. (Now loaded with 0xAAAA)
How do I get rid of 0xBBBB from my stack? Do I simply "pop" without arguments (Do this exist?) or do I add sp, 2 ?
Thank you.
popexist, whatadd sp, 2will do and whether there's any other error in the instructions from the question.mov ax, [ss:sp+2]does not exist and won't assemble.popwithout arguments also does not exist in x86 assembly and won't assemble, useadd sp,2for that.popitself doesn't clear the values popped from the stack, but usually they get overwritten very soon by the next interrupt.