
MOTOROLA
MC68HC16S2
70
MC68HC16S2TS/D
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 subtracts
$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. Asyn-
chronous exceptions have higher priorities than synchronous exceptions. Exception processing for mul-
tiple 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 excep-
tion are processed before the first instruction of that exception’s handler routine. The converse 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 exception 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 except
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.
F
re
e
sc
a
le
S
e
m
ic
o
n
d
u
c
to
r,
I
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
n
c
..
.