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> |
nam conxampl
ttl ** Conditionals **
list
una
clist
00000001 flag set 1
00000001 flag2 set 1
005F0000 org $5F0000
* if flag=0, assemble to endc
00000001 ifeq flag
move D1,albert
move fred,D1
endc
* if flag=1 assemble to endc
00000000 ifeq flag-1
005F0000 33C1005F0012 move D1,albert
005F0006 3239005F0016 move morris,D1
*
* Nested conditional
*
* if flag2<=3, assemble
FFFFFFFE ifle flag2-3
005F000C 3239005F0014 move fred,D1
* if flag2=1, assemble
00000000 ifeq flag2-1
* trap flag2=1
**** WARNING at line 31 Fail directive encounted
fail
endc
endc
endc
005F0012 0000 albert dc 0
005F0014 0000 fred dc 0
005F0016 0000 morris dc 0
end
24 bytes generated.