3.7.4 Stack pointer (SP)
The 24-bit register saves the starting address of the stack (LIFO: 00000H to FFFFFFH) (refer to Figure 3-7). The
stack is used for addressing during subroutine processing or interrupt servicing. Always set the higher four bits to
zero.
The contents of the SP are decremented before writing to the stack area and incremented after reading from the
stack (refer to Figures 3-8 and 3-9).
SP is accessed by special instructions.
Since the SP contents become undefined when RESET is input, always initialize the SP from the initialization
program immediately after clearing the reset (before accepting a subroutine call or interrupt).
Example Initializing SP
MOVG SP,#0FEE0H ; SP ← 0FEE0H (when used from FEDFH)
78
CHAPTER 3 CPU ARCHITECTURE
Figure 3-7. Format of Stack Pointer (SP)
23
SP
User's Manual U12697EJ3V0UM
0