Table of Contents Previous topic Next topic
CROSS ASSEMBLER->Conditional Assembly
Conditional assembly allows code to be included or excluded from the assembly depending on particular conditions. The IFcc and ENDC directives serve to define the statements to be conditional assembled. If the operand to the particular IFcc directive satisfies the required condition, the statements up to the following ENDC will be assembled, otherwise they will be skipped. The required condition depends on the particular IFcc directive as follows:
| Directive | Condition |
| IFEQ | <Expression> = 0 |
| IFNE | <Expression> <> 0 |
| IFGE | <Expression> >= 0 |
| IFGT | <Expression> > 0 |
| IFLE | <Expression> <= 0 |
| IFLT | <Expression> < 0 |
| IFC | <Character string 1> = <Character string 2> |
| IFNC | <Character string 1> <> <Character string 2> |
PAGE 001 ifexample.asm Sat Nov 13 22:33:02 1993 conxampl ** Conditionals ** 1 nam conxampl 2 ttl ** Conditionals ** 3 list 4 0040 pagewidth 64 5 fields 7,7,11 6 una 7 clist 8 9 0001 flag defl 1 10 0001 flag2 defl 1 11 12 5F00 org $5F00 13 14 0001 ifeq flag 15 ld a,(albert) 16 ld (fred),a 17 endc 18 19 0000 ifeq flag-1 if flag=1 assemble to endc 20 5F00 3A 09 5F ld a,(albert) 21 5F03 32 0B 5F ld (morris),a 22 23 5F06 * Nested 24 5F06 * conditional 25 26 FFFE ifle flag2-3 if flag2<=3, assemble 27 5F06 32 0A 5F ld (fred),a 28 0000 ifeq flag2-1 if flag2=1, assembleifexample.asm: **** WARNING at line 29 Fail directive encountered 29 fail trap flag2=1 30 endc 31 endc 32 endc 33 34 5F09 albert defs 1 35 5F0A fred defs 1 36 5F0B morris defs 1 37 endAssembly completeTotal bytes generated: 120 errors1 warnings