the first value that we will get on pop will be 5, then 4, 3, 2, and only
then 1.
It is very important to do equal number of PUSHs and POPs,
otherwise the stack maybe corrupted and it will be impossible to return to
operating system. As you already know we use RET instruction to return
to operating system, so when program starts there is a return address in
stack (generally it's 0000h).
PUSH and POP instruction are especially useful because we don't have
too much registers to operate with, so here is a trick:
· Store original value of the register in stack (using PUSH).
· Use the register for any purpose.
· Restore the original value of the register from stack (using POP).
Here is an example:
the first value that we will get on pop will be 5, then 4, 3, 2, and onlythen 1.It is very important to do equal number of PUSHs and POPs,otherwise the stack maybe corrupted and it will be impossible to return tooperating system. As you already know we use RET instruction to returnto operating system, so when program starts there is a return address instack (generally it's 0000h).PUSH and POP instruction are especially useful because we don't havetoo much registers to operate with, so here is a trick:· Store original value of the register in stack (using PUSH).· Use the register for any purpose.· Restore the original value of the register from stack (using POP).Here is an example:
การแปล กรุณารอสักครู่..