48
CHAPTER 2 CPU
Figure 2.7-7 Stack Operation Instruction and Stack Pointer
Note:
To set a stack address in the stack pointer, use an even-numbered address. If an odd-
numbered address is used, a word is accessed in two separate times.
The USP and SSP registers have undefined initial values.
s System Stack Pointer (SSP)
To use the system stack pointer (SSP), set the S flag in the condition code register (CCR) to
"1". If the S flag is set to "1", the upper 8 bits of the address to be used for the stack operation
are indicated by the system stack bank register (SSB).
For more information on the condition code register (CCR), see Section
2.7.4 "Condition Code
Register (PS:
CCR)".
For more information on the system stack bank register (SSB), see
Section
2.7.9 "Bank Registers (PCB, DTB, USB, SSB, ADB)".
s User Stack Pointer (USP)
To use the user stack pointer (USP), set the S flag in the condition code register (CCR) to "0". If
the S flag is set to "0", the upper 8 bits of the address to be used for the stack operation are
indicated by the user stack bank register (USB).
For more information on the condition code register (CCR), see Section
2.7.4 "Condition Code
Register (PS:
CCR)".
For more information on the system stack bank register (SSB), see
Section
2.7.9 "Bank Registers (PCB, DTB, USB, SSB, ADB)".
PUSHW A with the S flag set to 0
PUSHW A with the S flag set to 1
Before execution AL
0
USB
USP
S flag
SSB
SSP
XXH
C6H
F328H
A624H
56H
1234H
MSB
LSB
After execution
AL
0
USB
USP
S flag
SSB
SSP
A6H
C6H
F326H
A624H
56H
1234H
24H
The user stack is used because
the S flag is 0
Before execution AL
1
USB
USP
S flag
SSB
SSP
XXH
C6H
F328H
A624H
56H
1234H
MSB
LSB
After execution
AL
1
USB
USP
S flag
SSB
SSP
A6H
C6H
F328H
A624H
56H
1232H
24H
The system stack is used
because the S flag is 1
C6F326H
561232H
X:
Undefined
MSB:
Most Significant Bit
LSB:
Least Significant Bit