Operating Procedures
Working with Relocatable Sections
MCUez HC12 Assembler User’s Manual
MOTOROLA Operating Procedures 221
11.3 Working with Relocatable Sections
A relocatable section is a section whereby the start address is determined at link
time. See modules fibo.asm and fibo.prm in the demo directory.
11.3.1 Defining Relocatable Sections in the Assembly Source File
A relocatable section is defined using the directive SECTION.
Example:
Defining a relocatable section containing data:
constSec: SECTION ; Relocatable constant data section.
cst1: DC.B $A6
cst2: DC.B $BC
dataSec: SECTION ; Relocatable data section.
var: DS.B 1
In the previous portion of code, the label cst1 will be located at offset 0 from
the section constSec start address, and label cst2 will be located at offset 1
from the section constSec start address.
1 1 constSec: SECTION
2 2 000000 A6 cst1: DC.B $A6
3 3 000001 BC cst2: DC.B $BC
4 4
5 5 dataSec: SECTION
6 6 000000 var: DS.B 1
Defining a relocatable section containing code:
codeSec: SECTION ; Relocatable code section.
entry:
LDAA cst1 ; Load value in cst1
ADDA cst2 ; Add value in cst2
STAA var ; Store in var
BRA entry