377
CHAPTER 22
INTERRUPT FUNCTIONS
User’s Manual U12697EJ4V1UD
Register bank
(0 to 7)
A
B
R5
R7
X
C
R4
R6
D
H
VP
UP
E
L
V
U
T
W
Register bank n (n = 0 to 7)
7 Transfer
3 Register bank switching
(RBS0-RBS2
← n)
4
RSS
← 0
(
IE
← 0
)
1 Save
2 Save
(Bits 8 to 11 of
temporary register)
6 Exchange
5 Save
PC15-0
PC19-16
0000B
Temporary register
PSW
22.4 Software Interrupt Acknowledgment Operations
A software interrupt is acknowledged in response to execution of the BRK or BRKCS instruction. Software
interrupts cannot be disabled.
22.4.1 BRK instruction software interrupt acknowledgment operation
When the BRK instruction is executed, the program status word (PSW) and program counter (PC) are saved in
that order to the stack, the IE flag is cleared (0), the vector table (003EH/003FH) contents are loaded into the lower
16 bits of the PC, and 0000B into the higher 4 bits, and a branch is performed (the start of the service program must
be in the base area).
The RETB instruction must be used to return from a BRK instruction software interrupt.
Caution The RETI instruction must not be used to return from a BRK instruction software interrupt.
22.4.2 BRKCS instruction software interrupt (software context switching) acknowledgment operation
The context switching function can be initiated by executing the BRKCS instruction.
The register bank to be used after context switching is specified by the BRKCS instruction operand.
When the BRKCS instruction is executed, the program branches to the start address of the interrupt service
program (which must be in the base area) stored beforehand in the specified register bank, and the contents of the
program status word (PSW) and program counter (PC) are saved in the register bank.
Figure 22-8. Context Switching Operation by Execution of BRKCS Instruction
The RETCSB instruction is used to return from a software interrupt generated by the BRKCS instruction. The
RETCSB instruction must specify the start address of the interrupt service program for when context switching is next
performed by the BRKCS instruction. This interrupt service program start address must be in the base area.
Caution The RETCS instruction must not be used to return from a BRKCS instruction software interrupt.