4.9.17 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).
When working with multiple assembly modules, it's possible to have multiple local symbols
with the same name. However, only EQU symbols marked as globally
accessible (see Global Directive)
will be visible during debugging. The IDE will display the value of globally defined
symbols, but the value of local symbols will be used by the code within the modules where
they are defined. To avoid confusion, it's advisable not to define symbols with the same
name in different modules.
GLOBAL mode
mode EQU 2the mode symbol will be watchable in IDEs, with an
indicated "address" of 2.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.
