RL78/G15 CHAPTER 3 CPU ARCHITECTURE
R01UH0959EJ0110 Rev.1.10 Page 92 of 765
Mar 7, 2023
3.5.9 Stack addressing
[Function]
The stack area is indirectly addressed with the stack pointer (SP) values. This addressing is automatically employed
when the PUSH, POP, subroutine call, and return instructions are executed or the register is saved/restored upon
generation of an interrupt request.
Only the internal RAM area can be set as the stack area.
[Description format]
Identifier Description
— PUSH PSW AX/BC/DE/HL
POP PSW AX/BC/DE/HL
CALL/CALLT
RET
BRK
RETB
(Interrupt request generated)
RETI
Each stack operation saves or restores data as shown in Figure 3-32 to Figure 3-37.
Figure 3-32. Example of PUSH rp
Instruction code
OP-code
Memory
F0000H
• Stack addressing is specified <1>.
• The higher-order and lower-order bytes of the pair of
registers indicated by rp <2> are stored in addresses SP – 1
and SP – 2, respectively.
• The value of SP <3> is decreased by two (if rp is the program
status word (PSW), the value of the PSW is stored in SP – 1
and 0 is stored in SP – 2).
Higher-order byte of rp
SP – 1
SP – 2
PUSH
<1>
rp
<2>
SP
Lower-order byte of rp
Stack
area
SP
<3>
rp
<
1>
<2>