Introduction to AVR Assembly Language Programming II: Stack Operations
“Those who are last now will be first then, and those who are first will be last.” -Matthew 20:16
READING
The AVR Microcontroller and Embedded Systems using Assembly and C
by Muhammad Ali Mazidi, Sarmad Naimi, and Sepehr Naimi
Section: 3.2
AVRBeginners.Net
Jumps, Calls and the Stack
Table of Contents
WORKING WITH STACKS
- Stacks
FIFO and LIFO
SP
Initialization - LIFO Stack Operations (Push and Pop)
Explicit push and pop
Implicit rcall, call, icall, ret, reti
- Working with the Stack (3 questions and answers)
Word Size: 1 byte
Points At: Empty Byte
Direction: Decrements stack by 2 for implicit (call) and by 1 for explicit (push) stack operations - The Program Counter byte ordering on the SRAM stack is Big Endian.
STACK OPERATION ON A CALL INSTRUCTION
AMAZING LAB DESIGN EXAMPLE
CALL INSTRUCTION ENCODING
- All control transfer addressing modes modify the program counter.
- The Program Counter byte ordering on the SRAM stack is Big Endian.