IF, IFDEF, and IFNDEF

Conditional assembly.

Conditional assembly includes a set of commands at assembly time. The IFDEF directive will include code till the corresponding ELSE directive if <symbol> is defined. The symbol must be defined with the EQU or SET directive. (Will not work with the DEF directive.) The IF directive will include code if the <expression> is evaluated different from 0. Valid till the corresponding ELSE or ENDIF directive.

Up to five levels of nesting is possible.

Syntax
.IFDEF <symbol>
.IFNDEF <symbol>
.IF <expression>
.IFDEF <symbol> |.IFNDEF <symbol>
…
.ELSE | .ELIF <expression>
…
.ENDIF
Example
.MACRO SET_BAT 
.IF @0>0x3F 
.MESSAGE "Address larger than 0x3f" 
lds @2, @0 
sbr @2, (1<<@1) 
sts @0, @2 
.ELSE 
.MESSAGE "Address less or equal 0x3f" 
.ENDIF 
.ENDMACRO