Motorola HC12 User Manual

Page of 328
User’s Manual
MCUez HC12 Assembler
156
Assembler Syntax
MOTOROLA
Assembler Syntax
All valid user-defined symbols representing memory locations are simple
relocatable expressions. This includes labels specified in XREF directives,
which are assumed to be relocatable symbols.
7.8.1  Absolute Expressions
Expressions involving constants, known as absolute labels, or expressions are
absolute expressions. An expression containing an operation between an
absolute expression and a constant value is also an absolute expression.
Example of absolute expression:
Base:  SET $100
Label: EQU Base * $5 + 3
Expressions involving the difference between two relocatable symbols defined
in the same file and in the same section evaluate to an absolute expression. An
expression as
label2-label1
can be translated as:
(<offset label2> + <start section address >) –
(<offset label1> + <start section address >)
This can be simplified as:
<offset label2> + <start section address > –
<offset label1> - <start section address>
= <offset label2> - <offset label1>
In the following example, the expression
tabEnd-tabBegin
 evaluates to an
absolute expression and is assigned the value of the difference between the
offset of
tabEnd
and
tabBegin
 in the section
DataSec
.
DataSec: SECTION
tabBegin: DS.B  5
tabEnd:   DS.B  1
CodeSec: SECTION
entry:
LDD #tabEnd-tabBegin <- Absolute expression