7 dc — define constant, Dc — define constant – Motorola HC12 User Manual

Page 170

Advertising
background image

User’s Manual

MCUez HC12 Assembler

170

Assembler Directives

MOTOROLA

Assembler Directives

8.7 DC — Define Constant

Syntax:

[<label>:]

DC

[<size>] <expression> [, <expression>]...

where

<size> =

B

(default),

W

, or

L

.

Description:

The

DC

directive defines constants in memory. It can have one

or more <expression> operands, which are separated by
commas. The <expression> can contain an actual value
(binary, octal, decimal, hexadecimal, or ASCII). Alternately,
the <expression> can be a symbol or expression that can be
evaluated by the assembler as an absolute or simple relocatable
expression. One memory block is allocated and initialized for
each expression.

These rules apply to size specifications for

DC

directives:

DC.B

— One byte is allocated for numeric expressions.

One byte is allocated per ASCII character for strings.

DC.W

— Two bytes are allocated for numeric expressions.

ASCII strings are right aligned on a 2-byte boundary.

DC.L

— Four bytes are allocated for numeric expressions.

ASCII strings are right aligned on a 4-byte boundary.

Example for

DC.B

:

000000 4142 4344 Label: DC.B "ABCDE"

000004 45

000005 0A0A 010A DC.B %1010, @12, 1, $A

000009 xx DC.B PAGE(Label)

Example for

DC.W

:

000000 0041 4243

Label: DC.W "ABCDE"

000004 4445

000006 000A 000A

DC.W %1010, @12, 1, $A

00000A 0001 000A

00000E xxxx DC.W Label

Advertising