MOTOROLA
MC68349 USER’S MANUAL
5- 39
When T1, T0 = 00, tracing is disabled, and instruction execution proceeds normally.
When T1, T0 = 01 at the beginning of instruction execution, a trace exception will be
generated if the PC changes sequence during execution. All branches, jumps, subroutine
calls, returns, and SR manipulations can be traced in this way. No exception occurs if a
branch is not taken.
When T1, T0 = 10 at the beginning of instruction execution, a trace exception will be
generated when execution is complete. If the instruction is not executed, either because
an interrupt is taken or because the instruction is illegal, unimplemented, or privileged, an
exception is not generated.
At the present time, T1, T0 = 11 is an undefined condition. It is reserved by Motorola for
future use.
Exception processing for trace starts at the end of normal processing for the traced
instruction and before the start of the next instruction. Exception processing follows the
regular sequence; tracing is disabled so that the trace exception itself is not traced. A
vector number is generated to reference the trace exception vector. The address of the
instruction that caused the trace exception, the trace exception vector offset, the current
PC, and a copy of the SR are saved on the supervisor stack. The saved value of the PC is
the address of the next instruction to be executed.
A trace exception can be viewed as an extension to the function of any instruction. If a
trace exception is generated by an instruction, the execution of that instruction is not
complete until the trace exception processing associated with it is also complete.
If an instruction is aborted by a bus error or address error exception, trace exception
processing is deferred until the suspended instruction is restarted and completed
normally. An RTE from a bus error or address error will not be traced because of the
possibility of continuing the instruction from the fault.
If an instruction is executed and an interrupt is pending on completion, the trace exception
is processed before the interrupt exception.
If an instruction forces an exception, the forced exception is processed before the trace
exception.
If an instruction is executed and a breakpoint is pending upon completion of the
instruction, the trace exception is processed before the breakpoint.
If an attempt is made to execute an illegal, unimplemented, or privileged instruction while
tracing is enabled, no trace exception will occur because the instruction is not executed.
This is particularly important to an emulation routine that performs an instruction function,
adjusts the stacked PC to beyond the unimplemented instruction, and then returns. The
SR on the stack must be checked to determine if tracing is on before the return is
executed. If tracing is on, trace exception processing must be emulated so that the trace
exception handler can account for the emulated instruction.