3 direct, Direct – Motorola HC12 User Manual

Page 131

Advertising
background image

Assembler Syntax

Source Line

MCUez HC12 Assembler

User’s Manual

MOTOROLA

Assembler Syntax

131

One very common programming error is to omit the # character. This causes the
assembler to misinterpret the expression as an address rather than explicit data.

Example:

LDAA $60

means load accumulator A with the value stored at address

$60

.

7.4.3.3 Direct

The direct addressing mode is used to access operands in the direct page of the
memory (location $0000 to $00FF).

Access to this memory range (also called zero page) is faster and requires less
code than the extended addressing mode (see next example). To speed up the
application, a programmer can place the most commonly accessed data in this
area of memory.

Example:

ORG $50

data: DS.B 1

MyCode: SECTION

Entry:

LDS #$AFE

; init Stack Pointer

LDAA #$01

main: STAA data

BRA main

In this example, the value in register A is stored in the variable

data

which is

located at address

$50

.

Advertising