KS57C2308/P2308/C2316/P2316 ADDRESSING MODES
3-5
SELECT BANK REGISTER (SB)
The select bank register (SB) is used to assign the memory bank and register bank. The 8-bit SB register
consists of the 4-bit select register bank register (SRB) and the 4-bit select memory bank register (SMB), as
shown in Figure 3-2.
During interrupts and subroutine calls, SB register contents can be saved to stack in 8-bit units by the PUSH SB
instruction. You later restore the value to the SB using the POP SB instruction.
SMB 3 SMB 2 SMB 1 SMB 0 0 0 SRB 1 SRB 0
SB
REGISTER
SMB (F83H) SRB (F82H)
Figure 3-2. SMB and SRB Values in the SB Register
Select Register Bank (SRB) Instruction
The select register bank (SRB) value specifies which register bank is to be used as a working register bank. The
SRB value is set by the SRB n instruction, where n = 0, 1, 2, 3.
One of the four register banks is selected by the combination of ERB flag status and the SRB value that is set
using the SRB n instruction. The current SRB value is retained until another register is requested by program
software. PUSH SB and POP SB instructions are used to save and restore the contents of SRB during interrupts
and subroutine calls. RESET clears the 4-bit SRB value to logic zero.
Select Memory Bank (SMB) Instruction
To select one of the four available data memory banks, you must execute an SMB n instruction specifying the
number of the memory bank you want (0, 1 or 15). For example, the instruction SMB 1 selects bank 1 and
SMB 15 selects bank 15. (And remember to enable the selected memory bank by making the appropriate EMB
flag setting.
The upper four bits of the 12-bit data memory address are stored in the SMB register. If the SMB value is not
specified by software (or if a RESET does not occur) the current value is retained. RESET clears the 4-bit SMB
value to logic zero.
The PUSH SB and POP SB instructions save and restore the contents of the SMB register to and from the stack
area during interrupts and subroutine calls.