4-Bit Short Constant Offset from X, Y, or SP (IDX)

A 4-bit unsigned constant (0-15) is added to X, Y, or SP to form the effective address of the operand. This addressing mode is very compact and efficient and handles the most common indexed addressing offsets.

Larger offsets are supported with other indexed addressing mode variations which use additional extension bytes to specify the larger offsets.

Listing: Example - 4-Bit Short Constant Offset

ORG $1000
CST_TBL: DC.B $5, $10, $18, $20, $28, $30

ORG $800

DATA_TBL: DS.B 10

main:

     LD X,#CST_TBL

     LD D0(3,X)

     LD Y,#DATA_TBL

     ST D0,(8,Y)

Register D0 is loaded with byte value stored in memory location $1003 ($1000 + 3) and the contents of D0 are stored to memory $808 ($800 + 8).