58
µPD750008 USER'S MANUAL
4.7 STACK POINTER (SP) AND STACK BANK SELECT REGISTER (SBS)
The µPD750008 uses static RAM as stack memory (LIFO scheme), and the 8-bit register holding the start
address of the stack area is the stack pointer (SP).
The stack area is located at addresses 000H to 1FFH in memory banks 0 and 1. One memory bank is
selected according to the value of the 2-bit SBS. (See Table 4-2.)
Table 4-2. Stack Area to Be Selected by the SBS
SBS Stack area
SBS1 SBS0
0 0 Memory bank 0
0 1 Memory bank 1
Other than above Not to be set
The SP is decremented before a write (save) operation to stack memory, and is incremented after a read
(restoration) operation from stack memory.
Figures 4-12 to 4-15 show data saved to and restored from stack memory in these stack operations.
To place the stack area at a given location, the SP can be initialized with an 8-bit memory manipulation
instruction, and the SBS can be initialized with a 4-bit memory manipulation instruction. Both can be read
from as well.
When the SP is initialized to 00H, a stack operation starts at the high-order address (nFFH) of memory
bank (n) specified with the SBS.
A stack area must be within the memory bank specified with the SBS. If a stack operation exceeds address
n00H, the operation returns to address nFFH in the same bank. Linear stacking beyond memory bank
boundaries is enabled only by resetting the SBS.
A RESET signal causes the contents of the SP to be undefined, and causes the contents of the SBS to
be 1000B. Remember to initialize the SP and SBS to a desired value at the start of a program.