Indexed pc versus indexed pc relative, Addressing mode – Motorola HC12 User Manual

Page 144

Advertising
background image

User’s Manual

MCUez HC12 Assembler

144

Assembler Syntax

MOTOROLA

Assembler Syntax

7.4.3.16 Indexed PC versus Indexed PC Relative Addressing Mode

When using the indexed addressing mode with PC as the base register, the
macro assembler allows use of either indexed PC (<offset>, PC) or indexed PC
relative (<offset>, PCR) notation.

When indexed PC notation is used, the offset specified is inserted directly in the
opcode.

Example:

main:
LDAB 3, PC
DC.B $20, $30, $40, $50

In the previous example, register B is loaded with the value stored at address
PC + 3 ($50).

When Indexed PC relative notation is used, the offset between the current
location counter and the specified expression is computed and inserted in the
opcode.

Example:

main:
LDAB x4, PCR
x1: DC.B $20
x2: DC.B $30
x3: DC.B $40
x4: DC.B $50

In the previous example, register B is loaded with the value stored at label

x4

($50). The macro assembler evaluates the offset between the current location
counter and the symbol

x4

to determine the value, which must be stored in the

opcode.

Inside an absolute section, expressions specified in an indexed PC relative
addressing mode may be:

A label defined in any absolute section

A label defined in any relocatable section

An external label, defined in an XREF directive

An absolute EQU or SET label

Advertising