DEFINED symbol

You can use the DEFINED operator to see whether a symbol is defined. Typically, this is used with conditional directives to control whether a portion of a file will be assembled.

The DEFINED operator returns a Boolean result which is true if the symbol is defined at that point in the file, and is false otherwise. Note that this operator only inquires whether the symbol is known to the assembler, not whether it has a known value: imported symbols are considered to be defined even though the assembler does not know their value.

DEFINED cannot detect whether a macro has been defined.


The following shows how DEFINED works in a number of cases.

Y       EQU    10
B1      EQU    DEFINED X   ; true (1)
B2      EQU    DEFINED Y   ; true (1)
B3      EQU    DEFINED Z   ; false (0) — not defined yet
B4      EQU    DEFINED U   ; false (0) — never defined
Z       EQU    100