The stack is a region of data memory that is set aside by the programmer specifically for the main purpose of storing the microprocessor’s state information when it branches to a subroutine. A stack is a last-in, first-out memory structure.
- local variables
- function arguments
- control information such as return addresses.
#Push
Decrements the value of the stack pointer and inserts value at that position.
#Pop
Read the value pointed by SP and increments the stack pointer.