13 indexed, post-increment, Indexed, post-increment – Motorola HC12 User Manual

Page 141

Advertising
background image

Assembler Syntax

Source Line

MCUez HC12 Assembler

User’s Manual

MOTOROLA

Assembler Syntax

141

7.4.3.13 Indexed, Post-Increment

This addressing mode allows the user to increment the base register by a
specified value after indexing takes place. The content of the base register is
read and then incremented by the specified value.

The valid range for a pre-increment value is [1...8]. The base index register may
be X, Y, or SP.

Example:

ORG $1000

CST_TBL:

DC.B $5, $10, $18, $20, $28, $30

END_TBL:

DC.B $0

main:

CLRA

CLRB

LDX #$CST_TBL

loop:

ADDD 1,X+

CPX #END_TBL

BNE loop

Base register X is loaded with the address of the table

CST_TBL

($1000).

The value at address $1000 ($5) is added to register D and then register X is
incremented by 1 (its value is $1001).

Register X is not equal to the address of

END_TBL

, so the value at address

$1001 ($10) is added to register D and then register X is incremented by 1 (its
value is $1002).

This loop is repeated as long as register X did not reach the end of the table

END_TBL

($1006).

Advertising