Direct Addressing Mode (Dir); Extended Addressing Mode (Ext) - NXP Semiconductors MC9S08SU16 Reference Manual

Table of Contents

Advertisement

The size of the immediate operand is implied by the instruction context. In the third
example, the instruction implies a 16-bit immediate value, but only an 8-bit value is
supplied. In this case the assembler generates the 16-bit value $0067 because the CPU
expects a 16-bit value in the instruction stream.

10.3.4 Direct Addressing Mode (DIR)

This addressing mode is sometimes called zero-page addressing because it accesses
operands in the address range $0000 through $00FF. Since these addresses always begin
with $00, only the low byte of the address needs to be included in the instruction, which
saves program space and execution time. A system can be optimized by placing the most
commonly accessed data in this area of memory. The low byte of the operand address is
supplied with the instruction and the high byte of the address is assumed to be zero.
Examples:
LDA
$55
The value $55 is taken to be the low byte of an address in the range $0000 through
$00FF. The high byte of the address is assumed to be zero. During execution, the CPU
combines the value $55 from the instruction with the assumed value of $00 to form the
address $0055, which is then used to access the data to be loaded into accumulator.
LDHX
$20
In this example, the value $20 is combined with the assumed value of $00 to form the
address $0020. Since the LDHX instruction requires a 16-bit value, a 16-bit word of data
is read from addresses $0020 and $0021. After execution, the H:X index register has the
value from address $0020 in its high byte and the value from address $0021 in its low
byte. The same happens for CPHX and STHX.
BRSET
0,$80,foo
In this example, direct addressing is used to access the operand and relative addressing is
used to identify the destination address of a branch, in case the branch-taken conditions
are met. This is also the case for BRCLR.

10.3.5 Extended Addressing Mode (EXT)

In extended addressing, the full 16-bit address of the memory location to be operated on
is provided in the instruction. Extended addressing can access any location in the 64 KB
memory map.
Example:
NXP Semiconductors
MC9S08SU16 Reference Manual, Rev. 5, 4/2017
Chapter 10 Central processor unit
133

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mc9s08su16vfkMc9s08su8vfk

Table of Contents