
MC68HC916X1
MC68HC916X1TS/D
MOTOROLA
77
Because of pipelining, the value of PK : PC at the time a synchronous exception executes is equal
to the address of the instruction that causes the exception plus $0006. Because RTI always sub-
tracts $0006 upon return, the stacked PK : PC must be adjusted by the instruction that caused the
exception so that execution resumes with the following instruction. For this reason, $0002 is added
to the PK : PC value before it is stacked.
4.7.5 Multiple Exceptions
Each exception has a hardware priority based upon its relative importance to system operation.
Asynchronous exceptions have higher priorities than synchronous exceptions. Exception process-
ing for multiple exceptions is completed by priority, from highest to lowest. Priority governs the order
in which exception processing occurs, not the order in which exception handlers are executed.
Unless a bus error, a breakpoint, or a reset occurs during exception processing, the first instruction
of all exception handler routines is guaranteed to execute before another exception is processed.
Because interrupt exceptions have higher priority than synchronous exceptions, the first instruction
in an interrupt handler are executed before other interrupts are sensed.
Bus error, breakpoint, and reset exceptions that occur during exception processing of a previous
exception are processed before the first instruction of that exception’s handler routine. The con-
verse is not true. If an interrupt occurs during bus error exception processing, for example, the first
instruction of the exception handler is executed before interrupts are sensed. This permits the ex-
ception handler to mask interrupts during execution.
4.7.6 RTI Instruction
The return-from-interrupt instruction (RTI) must be the last instruction in all exception handlers ex-
cept the RESET handler. RTI pulls the exception stack frame that was pushed onto the system
stack during exception processing, and restores processor state. Normal program flow resumes at
the address of the instruction that follows the last instruction executed before exception processing
began.
RTI is not used in the RESET handler because RESET initializes the stack pointer and does not
create a stack frame.