User Stack Pointer (Usp) And System Stack Pointer (Ssp) - Fujitsu F2MCTM-16LX Hardware Manual

16-bit microcontroller
Table of Contents

Advertisement

2.7.2
User Stack Pointer (USP) and System Stack Pointer
(SSP)
USP and SSP are 16-bit registers that indicate the memory addresses for saving and
restoring data when a push/pop instruction or subroutine is executed.

User Stack Pointer (USP) and System Stack Pointer (SSP)

The USP and SSP registers are used by stack instructions. The USP register is enabled when the S flag in
the processor status register is "0", and the SSP register is enabled when the S flag is "1" (see
Figure 2.7-5 ). Since the S flag is set when an interrupt is accepted, register values are always saved in the
memory area indicated by SSP during interrupt processing. SSP is used for stack processing in an interrupt
routine, while USP is used for stack processing outside an interrupt routine. If the stack space is not
divided, use only the SSP.
During stack processing, the high-order eight bits of an address are indicated by SSB (for SSP) or USB (for
USP). USP and SSP are not initialized by a reset. Instead, they hold undefined values.
Example of PUSHW A when S flag is "0"
Before execution
After execution
Example of PUSHW A when S flag is "1"
Note:
Specify an even-numbered address in the stack pointer whenever possible.
Figure 2.7-5 Stack Manipulation Instruction and Stack Pointer
AL
A624
USB
H
S flag
0
SSB
AL
A624
USB
H
0
SSB
AL
A624
USB
H
1
SSB
AL
A624
USB
H
1
SSB
C6
USP
F328
H
H
56
1234
SSP
H
H
C6
USP
F326
H
H
56
1234
SSP
H
H
C6
USP
F328
H
H
56
1234
SSP
H
H
C6
USP
F328
H
H
56
1232
SSP
H
H
CHAPTER 2 CPU
MSB
C6F326
XX
H
System stack is used because S
flag is "0".
C6F326
A6
H
H
561232
XX
H
561232
A6
H
H
System stack is used because
S flag is "1".
LSB
XX
24
H
XX
24
H
41

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mb90360 series

Table of Contents