CHAPTER 4 INTERNAL CPU FUNCTION
71
Users Manual U10676EJ3V0UM
When 00H is set to SP as the initial value, memory bank 0 specified by SBS is used as the stack area, starting
from the highest address (07FH).
The stack area can be used only in memory bank 0. If stack operation is performed from address 000H onwards,
the stack pointer will point to unmounted area 0FFH. Therefore, be careful not to allow the stack pointer to exceed
000H.
The contents of SP become undefined and the contents of SBS become 1000B when the RESET signal is asserted.
Therefore, be sure to initialize these to the desired values at the beginning of the program.
Figure 4-8. Stack Pointer and Stack Bank Selection Register Configuration
SP7 SP6 SP5 SP4 SP3 SP2 SP1 0
SBS3 SBS2 SBS1 SBS0
Fix to 0
000H
07FH
080H
0FFH
Memory Bank 0
Unmounted
SP
If the stack pointer exceeds
00H, it will point to the
unmounted area 00FH, and
therefore attention should be
paid to the depth of the stack to
ensure that the stack pointer
does not exceed 00H.
F80H
Address
SP
Symbol
F84H SBS
Mk I/Mk II mode switching
Example of SP initialization
To set the stack area in memory bank 0, and perform stack operations from address 07FH.
SEL MB15 ; Or CLR1 MBE
MOV A, #0
MOV SBS, A ; Specify memory bank 0 as stack area
MOV XA, #80H
MOV SP, XA ; SP 80H (stack operations from 7FH)