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

Mb90550a/b series, 16-bit
Hide thumbs Also See for F2MC-16LX:
Table of Contents

Advertisement

2.4.2

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

The user stack pointer (USP) and system stack pointer (SSP) are 16-bit registers, and
indicate an address for data saving and return during execution of a push or pop
instruction or a subroutine.
■ User Stack Pointer (USP) and System Stack Pointer (SSP)
The user stack pointer (USP) and system stack pointer (SSP) are used by stack instructions.
However, if the S flag for the processor status is "0", the USP register becomes valid. If the S
flag is "1", the SSP register becomes valid (see Figure 2.4-6 and Figure 2.4-7). If an interrupt is
accepted, the S flag is set. In other words, register saving at an interrupt always occurs in the
memory area indicated by the SSP. The SSP is used for stack processing by an interrupt
routine. The USP is used for stack processing by a routine other than an interrupt routine. If it
is unnecessary to split the stack space, use only the SSP. SSP, SSB, USP, and USB indicate
the higher eight bits of an address for stack processing. USP and SSP are not initialized by a
reset and their values become undefined in that case.
Figure 2.4-6 Stack Operation Instructions and Stack Pointers (Example of PUSHW A when the S Flag is "0")
Before execution
AL
S flag
After execution
AL
S flag
Figure 2.4-7 Stack Operation Instructions and Stack Pointers (Example of PUSHW A when the S Flag is "1")
Before execution
AL
S flag
After execution
AL
S flag
Note:
As a general rule, use an even-numbered address as the value for the stack pointer.
A624
USB
C6
H
H
0
56
SSB
H
A624
USB
C6
H
H
0
56
SSB
H
A624
USB
C6
USP
H
H
1
56
SSB
SSP
H
A624
USB
C6
USP
H
H
1
56
SSB
SSP
H
USP
F328
C6F326
H
1234
SSP
H
The user stack is used because the S flag is "0".
USP
F326
H
1234
C6F326
SSP
H
F328
561232
H
H
1234
H
F328
561232
H
H
The system stack is used because the S flag is "1".
1232
H
2.4 Dedicated Registers
MSB
XX
XX
H
A6
24
H
H
H
XX
XX
A6
24
H
H
LSB
35

Advertisement

Table of Contents
loading

Table of Contents