CHAPTER 8 INTC
Preliminary User’s Manual A14874EJ3V0UM
225
8.4 Software Exception
A software exception, which is an exception that is generated when the CPU executes the TRAP instruction, can
always be acknowledged.
8.4.1 Operation
If a software exception is generated, the CPU performs the following processing and shifts control to the handler
routine.
<1> Save the restored PC in the EIPC.
<2> Save the current PSW in the EIPSW.
<3> Write the exception code in the lower 16 bits (EICC) of the ECR (interrupt source).
<4> Set the EP and ID bits of the PSW.
<5> Set the handler address (00000040H or 00000050H) for the software exception in the PC and shift control.
Figure 8-12 shows the processing format of software exception processing.
Figure 8-12. Software Exception Processing Format
EIPC
←
Restored PC
EIPSW
←
PSW
ECR.EICC
←
Exception
code
PSW.EP
←
1
PSW.ID
←
1
PC
←
Handler
address
CPU processing
TRAP instruction
Note
Exception processing
Note
The TRAP instruction format is “TRAP vector” (where vector is a value from 0 to 1FH).
The handler address is determined by the TRAP instruction operand (vector). When vector is 0 to 0FH, the
address is 00000040H. When vector is 10H to 1FH, the address is 00000050H.