KS57C2308/P2308/C2316/P2316 ADDRESS SPACES
2-19
ERB FLAG (ERB)
The 1-bit register bank enable flag (ERB) determines the range of addressable working register area. When the
ERB flag is "1", the working register area from register banks 0 to 3 is selected according to the register bank
selection register (SRB). When the ERB flag is "0", register bank 0 is the selected working register area,
regardless of the current value of the register bank selection register (SRB).
When an internal RESET is generated, bit 6 of program memory address 0000H is written to the ERB flag. This
automatically initializes the flag. When a vectored interrupt is generated, bit 6 of the respective address table in
program memory is written to the ERB flag, setting the correct flag status before the interrupt service routine is
executed.
During the interrupt routine, the ERB value is automatically pushed to the stack area along with the other PSW
bits. Afterwards, it is popped back to the FB0H.0 bit location. The initial ERB flag settings for each vectored
interrupt are defined using VENTn instructions.
++ PROGRAMMING TIP — Using the ERB Flag to Select Register Banks
ERB flag settings for register bank selection:
1. When ERB = "0":
SRB 1;Register bank 0 is selected (since ERB = "0", the
;SRB is configured to bank 0)
LD EA,#34H ;Bank 0 EA #34H
LD HL,EA ;Bank 0 HL EA
SRB 2;Register bank 0 is selected
LD YZ,EA ;Bank 0 YZ EA
SRB 3;Register bank 0 is selected
LD WX,EA ;Bank 0 WX EA
2. When ERB = "1":
SRB 1;Register bank 1 is selected
LD EA,#34H ;Bank 1 EA #34H
LD HL,EA ;Bank 1 HL Bank 1 EA
SRB 2;Register bank 2 is selected
LD YZ,EA ;Bank 2 YZ BANK2 EA
SRB 3;Register bank 3 is selected
LD WX,EA ;Bank 3 WX Bank 3 EA