IF

Abbreviation

None.

Arguments

A numeric expression.

Default

None.

Description

The IF control begins an IF-ELSE-ENDIF construct that is used for conditional assembly of 8051 program code. The specified numeric expression is evaluated, and if it is non-zero (TRUE), the IF block is assembled. If the expression is zero (FALSE), the IF block is not assembled, and the subsequent blocks of the IF construct are evaluated.

IF blocks can be terminated by an ELSE, ELSEIF, or ENDIF control statement.

NOTES

The A51 assembler generates a fatal error if the number of ENDIF control statements does not equal the number of IF control statements.

IF-ELSE-ENDIF blocks may be nested up to 10 deep.

You may not specify this control on the command line; however, you may use this control any number of times within the source file.

The IF control may be specified both with and without the preceding dollar sign ($). When specified with the $, the IF control accesses only symbols defined with the SET and RESET controls. When used without the $, the IF control accesses all symbols.

See Also

IF, ELSEIF, ENDIF, RESET, SET

Example
.
.
.
$IF (DEBUG_VAR = 3)

Version_3: MOV DPTR, #TABLE_3
.
.
.
$ ENDIF
.
.
.