![](http://datasheet.mmic.net.cn/330000/MB90F562_datasheet_16437954/MB90F562_68.png)
44
CHAPTER 2 CPU
MB90560 series
2.7
2.7.2 Stack Pointers (USP, SSP)
Dedicated Registers
There are two types of stack pointers: a user stack pointer (USP) and a system stack
pointer (SSP). Each stack pointer is a register that indicates the memory address of the
location of the destination for saved data or a return address when PUSH instructions,
POP instructions, and subroutines are executed. The upper 8 bits of the stack address
are specified by the user stack bank register (USB) or system stack bank register
(SSB).
When the S flag of the condition code register (CCR) is 0, the USP and USB registers
are valid. When the S flag is 1, the SSP and SSB registers are valid.
I
Stack selection
The F
2
MC-16LX uses two types of stack: a system stack and a user stack.
The stack address is determined, as shown in Table 2.7-2, by the S flag in the processor status
register (PS:CCR).
Table 2.7-2 Stack address specification
: Initial value
Because the S flag is initialized to 1 by a reset, the system stack is used as the default.
Ordinarily, the system stack is used for interrupt routine stack operations, and the user stack is
used for all other types of stack operation. When separation of the stack space is not particularly
necessary, only the system stack should be used.
<Check>
Since the S flag is set to 1 when an interrupt is accepted, the system stack is always used for
interrupts.
Figure 2.7-7 shows an example of stack operation with the system stack.
S flag
Stack address
Upper 8 bits
Lower 16 bits
0
1
User stack bank register (USB)
System stack bank register (SSB) System stack pointer (SSP)
User stack pointer (USP)