
M68HC11
REFERENCE MANUAL
RESETS AND INTERRUPTS
MOTOROLA
5-21
the XIRQ input pin. The illegal opcode fetch interrupt is a non-maskable interrupt
source intended to improve system integrity. Although it performs like an interrupt,
SWI is an instruction rather than an asynchronous interrupt. The XIRQ input is an up-
dated version of the non-maskable interrupt (NMI) input of earlier MCUs.
5.4.1 Non-Maskable Interrupt Request (XIRQ)
Non-maskable interrupts are useful because they can always interrupt CPU operation.
The most common use for such an interrupt is for very serious system problems, such
as program runaway or power failure. The XIRQ mechanism over-comes two signifi-
cant problems with an NMI input while retaining the important capabilities associated
with a non-maskable source.
The first NMI problem is as follows: What if an NMI is requested before the stack point-
er has been initialized If this request happens, the register stacking operation causes
register values to be written to a random area of memory. If the stack pointer is point-
ing to some unimplemented memory area or to a read-only area, there will be no way
to return to the program in progress at the time of the interrupt. If the stack pointer is
pointing at a data area in memory, the register values will be written over the data (thus
corrupting it). Since this situation is not desirable, the NMI had to be externally inhibit-
ed after reset until the stack pointer could be initialized.
The second NMI problem is as follows: What if the NMI signal bounces so that NMI is
nested If nesting occurs, the stack can be filled with several copies of the register val-
ues, possibly filling the stack beyond its allotted space. Nesting in this way would also
cause excessive latency from the request until the resulting program actions are exe-
cuted.
The M68HC11 solves both these problems with the X bit in the CCR. The X bit is very
similar to the I bit except that there are special restrictions on setting and clearing of
the X bit. Since X can only be cleared by a software instruction, the programmer has
control over when the XIRQ input becomes enabled. The two software instructions
that can clear the X bit are TAP and RTI (provided the stacked CCR value has a zero
in the X bit position). The two hardware conditions that can set the X bit are system
reset and the recognition of an XIRQ.
Immediately after any reset, the X bit is set; thus, XIRQ is inhibited. When software
has established initial conditions, including setting the stack pointer, the X bit may be
cleared with a TAP instruction to enable XIRQ. These two steps overcome the first
NMI problem. Since software cannot set the X bit, the XIRQ can be considered a non-
maskable source at this point. When an XIRQ occurs, the CCR value is stacked (with
the X bit clear); the X bit is then automatically set to inhibit additional interrupts. This
step overcomes the second NMI problem. When an RTI instruction is executed, the
CCR is restored to the stacked value (which had the X bit clear). A common miscon-
ception is that the X bit can be set by executing an RTI instruction with a one in the X
bit position of the stacked CCR value. In reality, the X bit is implemented as a set-reset
flip-flop rather than a D-type flip-flop. The set input is connected to the OR of reset and
XIRQ acknowledge. The reset input is connected to the AND of a CCR write and data
bit 6 equals zero. If an attempt is made to TAP or unstack a one to the X bit, neither