MOTOROLA
6-10
CENTRAL PROCESSING UNIT
M68HC11
REFERENCE MANUAL
tended addressing mode. The indexed addressing mode becomes very important for
these instructions because the direct addressing mode only permits access to the first
256 memory locations; whereas, the indexed addressing mode allows access to any
memory location in the 64-Kbyte memory map.
The second index register (Y) improves the efficiency of move operations and opera-
tions involving data from more than one table. Most instructions involving index regis-
ter Y require two-byte opcodes, thus requiring one extra byte of program memory
space and one extra cycle of execution time compared to the equivalent index register
X instruction.
6.2.5 Inherent (INH)
In the inherent addressing mode, everything needed to execute the instruction is in-
herently known by the CPU. The operands (if any) are CPU registers and thus are not
fetched from memory. These instructions are usually one or two bytes.
Many M68HC11 MCU instructions use one or more registers as operands. For in-
stance, the ABA instruction causes the CPU to add the contents of accumulators A
and B and place the result in accumulator A. The INCB instruction causes the contents
of accumulator B to be incremented by one. Similarly, the INX instruction causes the
index register X to be incremented by one. These three assembly-language state-
ments are examples of the inherent addressing mode:
Machine Code
1B
5C
08
Label
Operation
ABA
INCB
INX
Operand
Comments
A+B
A
B+1
B
X+1
X
6.2.6 Relative (REL)
The relative addressing mode is used only for branch instructions. Branch instructions,
other than the branching versions of bit-manipulation instructions, generate two ma-
chine code bytes: one for the opcode and one for the relative offset. Because it is de-
sirable to branch in either direction, the offset byte is a signed two’s-complement offset
with a range of –128 to +127 bytes (with respect to the address of the instruction im-
mediately following the branch instruction). If the branch condition is true, the contents
of the 8-bit signed byte following the opcode (offset) are added to the contents of the
program counter to form the effective branch address; otherwise, control proceeds to
the instruction immediately following the branch instruction.
The offset byte is always the last byte of a branch instruction. If the offset byte is zero,
execution will proceed to the instruction immediately following the branch instruction,
regardless of the test involved. A branch always (BRA) instruction with an offset of $FE
will result in an infinite loop back to itself. Direct or indexed X addressing mode branch
if bit clear (BRCLR) and branch if bit set (BRSET) instructions are four-byte instruc-
tions; therefore, an offset byte of $FC will cause the instruction to execute repeatedly
until the bit test becomes false. Indexed Y addressing mode BRCLR and BRSET in-
structions are five-byte instructions; thus, an offset byte of $FB will cause the instruc-
tion to execute repeatedly until the bit test becomes false.