6.1.9.16 Equ Directive
EQUdirective defines a symbol and equates this to the
value of its constant expression argument. For
example:thomas EQU 123h
engine EQU thomaswill equate the identifiers thomas and
engine with the value 123h.This directive performs a similar function to that of the preprocessor’s
#define directive (see Preprocessor Directives), which is often
preferred in assembly programs to represent values with symbols.
The EQU directive is legal only when the symbol has not
previously been defined in the same module. See the SET directive (Set Directive) if symbol values
need to be redefined at different points in the same source file.
Note that this directive does not create variables. It does not reserve
any memory for the symbol created. Use the DS directive to reserve data
memory associated with a label (see Ds Directive).
EQU symbols that are marked as being globally accessible (See Global Directive) will be visible in
debuggers. For example, in the following
code:GLOBAL mode
mode EQU 2the mode symbol will be watchable in IDEs.Since EQU directives do not contribute to the output, they are processed
separately to other instructions and directives. Thus, the program location counter cannot
be used in EQU operand expressions.
