Assembler Syntax
Source Line
MCUez HC12 Assembler User’s Manual
MOTOROLA Assembler Syntax 137
7.4.3.9 Indexed, Indirect 16-Bit Offset
This addressing mode adds a 16-bit offset to the base index register to form the
address of a memory location containing a pointer to the memory location
referenced in the instruction. The 16-bit offset may be considered either as
signed or unsigned ($FFFF may be considered to be –1 or 65,535). The base
index register may be X, Y, SP, PC, or PCR.
For information about indexed PC and indexed PC relative addressing modes,
see 7.4.3.16 Indexed PC versus Indexed PC Relative Addressing Mode.
Example:
ORG $1000
CST_TBL1: DC.W $1020, $1050, $2001
ORG $2000
CST_TBL2: DC.B $10, $35, $46
ORG $3000
main:
LDX #$CST_TBL
LDAA [4,X]
The offset 4 is added to the value of register X ($1000) to form the address
$1004.
Then an address pointer ($2001) is read from memory at $1004. Accumulator
A is loaded with $35 and the value is stored at address $2001.