Configuration Of Stack Pointer; Data To Be Saved To Stack Memory; Data To Be Restored From Stack Memory - NEC switch User Manual

Nec user's manua switch
Table of Contents

Advertisement

(3) Stack pointer (SP)
This is a 16-bit register that holds the start address of the memory stack area. Only the internal high-speed
RAM area can be set as the stack area.
15
SP
SP15
SP14 SP13 SP12 SP11 SP10 SP9
The SP is decremented ahead of write (save) to the stack memory and is incremented after read (restore) from
the stack memory.
Each stack operation saves/restores data as shown in Figures 3-8 and 3-9.
Caution
Since RESET input makes the SP contents undefined, be sure to initialize the SP before
instruction execution.
PUSH rp
instruction
SP _ 2
SP
Lower half
SP _ 2
register pairs
Upper half
SP _ 1
register pairs
SP
POP rp
instruction
Lower half
SP
register pairs
Upper half
SP + 1
register pairs
SP
SP + 2
42
CHAPTER 3
CPU ARCHITECTURE
Figure 3-7. Configuration of Stack Pointer
SP8
Figure 3-8. Data to Be Saved to Stack Memory
SP _ 2
SP
SP _ 2
SP _ 1
SP
Figure 3-9. Data to Be Restored from Stack Memory
SP
SP + 1
SP
SP + 2
User's Manual U12978EJ3V0UD
SP7
SP6
SP5
SP4
SP3
CALL, CALLT
instructions
SP _ 3
SP
SP _ 3
SP _ 2
PC7 to PC0
SP _ 1
PC15 to PC8
RET instruction
PC7 to PC0
PC15 to PC8
SP + 1
SP + 2
SP
SP + 3
0
SP2
SP1
SP0
Interrupt
PC7 to PC0
PC15 to PC8
PSW
SP
RETI instruction
SP
PC7 to PC0
PC15 to PC8
PSW

Advertisement

Table of Contents
loading

Table of Contents