uPD789871 Subseries 8-Bit Single-Chip Microcontrollers PUM
uPD789871 Subseries 8-Bit Single-Chip Microcontrollers PUM
uPD789871 Subseries 8-Bit Single-Chip Microcontrollers PUM
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
CHAPTER 3 CPU ARCHITECTURE<br />
(3) Stack pointer (SP)<br />
This is a 16-bit register to hold the start address of the memory stack area. Only the internal high-speed RAM<br />
area can be set as the stack area.<br />
Figure 3-9. Stack Pointer Configuration<br />
15<br />
0<br />
SP SP15 SP14 SP13 SP12 SP11 SP10 SP9 SP8 SP7 SP6 SP5 SP4 SP3 SP2 SP1 SP0<br />
The SP is decremented ahead of write (save) to the stack memory and is incremented after read (restore)<br />
from the stack memory.<br />
Each stack operation saves/restores data as shown in Figures 3-10 and 3-11.<br />
Caution Since RESET input makes the SP contents undefined, be sure to initialize the SP before<br />
instruction execution.<br />
SP SP _ 2<br />
SP _ 2<br />
SP _ 1<br />
SP<br />
PUSH rp<br />
instruction<br />
Register pair<br />
lower<br />
Register pair<br />
higher<br />
POP rp<br />
instruction<br />
Figure 3-10. Data to Be Saved to Stack Memory<br />
SP SP _ 2<br />
SP _ 2<br />
SP _ 1<br />
SP<br />
CALL, CALLT<br />
instructions<br />
PC7 to PC0<br />
PC15 to PC8<br />
SP SP _ 3<br />
SP _ 3<br />
SP _ 2<br />
SP _ 1<br />
Figure 3-11. Data to Be Restored from Stack Memory<br />
RET instruction<br />
PC15 to PC8<br />
Interrupt<br />
PC7 to PC0<br />
PC15 to PC8<br />
PSW<br />
Preliminary User’s Manual U14938EJ1V0UM 41<br />
SP<br />
RETI instruction<br />
Register pair<br />
SP SP PC7 to PC0<br />
SP<br />
lower<br />
PC7 to PC0<br />
SP + 1<br />
SP SP + 2<br />
Register pair<br />
higher<br />
SP + 1<br />
SP SP + 2<br />
SP + 1<br />
SP + 2<br />
SP SP + 3<br />
PC15 to PC8<br />
PSW