Assembler Commands - Conditional Assembly


Conditional assembly is supported in all code areas including macros. The assembler recognizes two different conditional statements. One syntax compares the equality of two strings and has the form:

        IFxx string1,string2
            code
        ENDC

The condition xx is either C or NC. IFC means if compare (the strings are equal). IFNC means if not compare (the strings are not equal). If the condition is true the following code is included in the program.

Another syntax compares an expression against zero and has the form:

        IFxx expression
            code
        ENDC

The condition xx is either:
 EQ (expression = 0)
 NE (expression <> 0)
 LT (expression < 0)
 LE (expression <= 0)
 GT (expression > 0)
 GE (expression >= 0)

The expression is compared with 0. If the condition is true the following code is included in the program.

The expression must be absolute, no forward references are allowed. IFxx and ENDC directives may not be labeled.

Conditional assembly may be used to temporarily add or remove code. In the following example, debug code may be included during assembly by changing the 0 to a 1.

debug   equ   0             set to 1 to include debug code

        ifne  debug
           debug code goes here
        endc

Refer to the Examples folder for additional sample code.