English
Language : 

45111 Datasheet, PDF (54/184 Pages) List of Unclassifed Manufacturers – 14-DAY MONEY BACK GUARANTEE
7 The SASM Assembler
The following example demonstrates the use of the IF...ELSE directive.
Delay EQU 10
Choice EQU 1
IF
ENDIF
Delay >=9
mov $08, #5
add $09, #%011
IF
ELSE
ENDIF
Choice = 0
mov $0A, #$1B
mov $0A, #$1C
The condition for an IF...ELSE directive can contain expressions and multiple conditional statements.
Two or more conditional statements may be specified by appending them together with the conditional
operators NOT, AND, OR and XOR. For example:
IF choice = 1 AND delay > 9
would assemble the code block following it if choice equals 1 and delay is greater than 9 at assemble time.
If the statement or expression evaluates to anything other than zero (0), the condition is true; otherwise,
the condition is false.
7.3.13 The IF{N}DEF…ELSE…ENDIF Directives
The IFDEF…ELSE (if defined) and IFNDEF…ELSE (if not defined) directives are very similar to the
IF…ELSE directive. The difference is they assemble or prevent assembly of code blocks based on
whether a symbol is defined or not. For example:
DriverOn
EQU 1
IFDEF
DriverOn
{some code block here}
ENDIF
would assemble the code block in the IFDEF statement because the DriverOn symbol was defined. If
DriverOn was not defined (i.e. line number 1, above, was commented out) the code block would be ig-
nored.
Note that SASM considers labels to be defined when there is an assignment using EQU or “=” in the
code before the IF{N}DEF directive, whereas the Parallax Assembler only accepts assignments using
EQU.
Page 54 • SX-Key/Blitz Development System Manual 2.0 • Parallax, Inc.