User’s Manual MCUez HC12 Assembler
174 Assembler Directives MOTOROLA
Assembler Directives
8.10 ELSE — Conditional Assembly
Syntax: IF <condition>
[<assembly language statements>]
[ELSE]
[<assembly language statements>]
ENDIF
Description: If <condition> is true, the statements between IF and the
corresponding ELSE directive generate code.
If <condition> is false, the statements between ELSE and the
corresponding ENDIF directive generate code. Nesting of
conditional blocks is allowed.The maximum level of nesting is
limited by the available memory at assembly time.
Example: This is an example of using conditional assembly directives:
Try: EQU 0
IF Try != 0
LDD #1023
ELSE
LDD #0
ENDIF
The value of Try determines the instruction that generates
code. As shown, the LDD #1023 instruction generates code.
Changing the operand of the equ directive to 1 causes the
LDD #0 instruction to generate code instead.
The following shows the listing provided by theassembler for
these lines of code:
0000 0001 Try: EQU 0
0000 0001 IF Try != 0
ELSE
000000 CC 0000 LDD #0
ENDIF