beautypg.com

Assembler directives – Motorola HC12 User Manual

Page 198

background image

User’s Manual

MCUez HC12 Assembler

198

Assembler Directives

MOTOROLA

Assembler Directives

Example:

The following example demonstrates the definition of a section

aaa

, which is split into two blocks, with section

bbb

between

them. The location counter associated with label

zz

is 1,

because a

NOP

instruction was already defined in this section

at label

xx

.

2 2 aaa: section 4

3 3 000000 A7 xx: nop

4 4 bbb: section 5

5 5 000000 A7 yy: nop

6 6 000001 A7 nop

7 7 000002 A7 nop

8 8 aaa: section 4

9 9 000001 A7 zz: nop

The optional qualifier

SHORT

specifies that the section is a

short section. Objects defined there can be accessed using the
direct addressing mode.

Example:

The following example demonstrates the definition and usage
of a

SHORT

section. On line number 12, the symbol

data

is

accessed using the direct addressing mode.

2 2

dataSec: SECTION SHORT

3 3 000000

data: DS.B 1

4 4

5 5

0000 0AFE

initSP: EQU $AFE

6 6

7 7

codeSec: SECTION

8 8

9 9

entry:

10 10 000000 CF 0AFE LDS #initSP

11 11 000003 C600 LDAB #0

12 12 000005 5Bxx STAB data