IFcc <condition>
[<assembly language statements>]
[ELSE]
[<assembly language statements>]
ENDIF
None
These directives can be replaced by the IF directive Ifcc <condition> is true, the statements immediately following the Ifcc directive are assembled. Assembly continues until the corresponding ELSE or ENDIF directive is reached, after which assembly moves to the statements following the ENDIF directive. Nesting of conditional blocks is allowed. The maximum level of nesting is limited by the available memory at assembly time.
The following table lists the available conditional types:
| Ifcc | Condition | Meaning |
|---|---|---|
| ifeq | <expression> | if <expression> == 0 |
| ifne | <expression> | if <expression> != 0 |
| iflt | <expression> | if <expression> < 0 |
| ifle | <expression> | if <expression> <= 0 |
| ifgt | <expression> | if <expression> > 0 |
| ifge | <expression> | if <expression> >= 0 |
| ifc | <string1>, <string2> | if <string1> == <string2> |
| ifnc | <string1>, <string2> | if <string1> != <string2> |
| ifdef | <label> | if <label> was defined |
| ifndef | <label> | if <label> was not defined |
The following listing is an example of the use of conditional assembler directives:
Try: EQU 0 IFNE Try LD D6,#103 ELSE LD D6,#0 ENDIF
The value of Try determines the instruction to be assembled in the program. As shown, the LD D6,#0 instruction is assembled. Changing the directive to IFEQ causes the LD D6,#103 instruction to be assembled instead.
The following listing shows the listing provided by the Assembler for these lines of code
1 1 0000 0000 Try: EQU 0 2 2 0000 0000 IFNE Try 4 4 ELSE 5 5 000000 A600 LD D6,#0 6 6 ENDIF