Function calls need to pass parameters and save return addresses. Managing this manually is error-prone. Can we use a dedicated memory structure (stack) with implicit addressing?
Stack Addressing uses the top of the stack as the operand location. Instructions like PUSH and POP operate on the stack top, with the stack pointer (SP) implicitly specifying the address — no explicit address needed in the instruction.
- Stack pointer (SP) register points to top of stack
- PUSH instruction: decrement SP, write data to address in SP
- POP instruction: read data from address in SP, increment SP
- Example:
PUSH AX— pushes AX onto stack;POP BX— pops top of stack into BX - Stack grows downward (typically) or upward, depending on architecture
- No address in instruction (implicit addressing) — instructions are short
- Used for function calls (saving return address), local variables, expression evaluation
- Stack pointer automatically updated — easy to use
- LIFO order: last pushed = first popped
- Built from: Addressing Mode, Stack, Stack Pointer
- Related: Function Call, PUSH Instruction, POP Instruction
- Builds into: Stack Frame, Function Parameters
- Contrasts with: Direct Addressing — explicit address needed
- Stack overflow: pushing too much data exceeds stack size
- Stack underflow: popping when stack is empty
- Stack grows toward other memory — must manage stack size carefully