Figure 2.1.2F Stack Manipulation Instruction And Stack Pointer - Fujitsu F2MC-16LX MB90580 Series Hardware Manual

16-bit microcontrollers
Hide thumbs Also See for F2MC-16LX MB90580 Series:
Table of Contents

Advertisement

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 in the
event of a push/pop instruction or subroutine execution. 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.1.2f). 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 process-
ing 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 1 PUSHW A when the S flag is '0'
Before execution
After execution
Example 2 PUSHW A when the S flag is '1'
MB90580 Series
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

Figure 2.1.2f Stack manipulation instruction and stack pointer

Note: Specify an even-numbered address in the stack pointer whenever possible.
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
MSB
C6F326
XX
H
User stack is used because
the S flag is '0.'
C6F326
A6
H
H
561232
XX
H
561232
A6
H
H
System stack is used because
the S flag is '1.'
Chapter 2: CPU
2.1 CPU
LSB
XX
24
H
XX
24
H
23

Advertisement

Table of Contents
loading

This manual is also suitable for:

F2mc-16lx mb90v580F2mc-16lx mb90583F2mc-16lx mb90f583

Table of Contents