3 stack pointer (sp) – NEC 78K/0 Series User Manual
Page 16

16
CHAPTER 2 REGISTERS
User's Manual U12326EJ4V0UM
Interrupt and
BRK instructions
PSW
PC15-PC8
PC15-PC8
PC7-PC0
Lower half
register pairs
SP SP _ 2
SP _ 2
CALL, CALLF and
CALLT instructions
PUSH rp
instruction
SP _ 1
SP
SP SP _ 2
SP _ 2
SP _ 1
SP
PC7-PC0
SP _ 3
SP _ 2
SP _ 1
SP
SP SP _ 3
Upper half
register pairs
2.1.3 Stack pointer (SP)
This is a 16-bit register that holds the start address of the memory stack area. Only the internal high-speed
RAM area can be set as the stack area.
Figure 2-3. Stack Pointer Configuration
The SP is decremented ahead of write (save) to the stack memory and is incremented after read (reset) from
the stack memory.
Each stack operation saves/resets data as shown in Figures 2-4 and 2-5.
Caution Since RESET input makes SP contents undefined, be sure to initialize the SP before instruction
execution.
Figure 2-4. Data to Be Saved to Stack Memory
Figure 2-5. Data to Be Reset from Stack Memory
15
0
SP
RETI and RETB
instructions
PSW
PC15-PC8
PC15-PC8
PC7-PC0
Lower half
register pairs
RET instruction
POP rp
instruction
SP
PC7-PC0
Upper half
register pairs
SP + 1
SP SP + 2
SP
SP + 1
SP SP + 2
SP
SP + 1
SP + 2
SP SP + 3