EQU Create equate Directive
name EQU expression
name is assigned the result of evaluating expression. The name
parameter must be a new symbol name that you haven't previously
defined in a different manner.
In MASM mode, EQU can generate any one of three kinds of equates:
1. a string equate (name represents a text string)
2. an alias equate (name represents another symbol)
3. a numeric equate (name represents a numeric value)
In MASM mode, you can only redefine a symbol that you defined using
the EQU directive if you first define it as a string
equate.
In Ideal mode, the EQU directive always defines a text macro (string
equate).
Text macros
Syntax: name EQU text_string
Text macros (string equates) are redefinable; you can redefine a text
macro name in the same module to another text string.
It is recommended that you enclose text_string in angle brackets when
defining a text macro, e.g.
copr EQU <'Copyright (c) '>
because if you omit the brackets in MASM mode, Turbo Assembler will
try to evaluate text_string to an expression, and an error may result.
Only if it can't evaluate text_string will Turbo Assembler treat it as
a text macro (to remain compatible with MASM). If you don't enclose
text_string in brackets, and it's the name of another text macro, TASM
will use that macro's contents. Otherwise, the macro will be defined
to the text.
In Ideal mode, EQU always defines a text macro.
Text macro manipulation examples
ideal ; Enter Ideal mode
abc equ <abc> ; abc = "abc"
abc2 equ abc ; abc2 = "abc"
abc equ <def> ; abc = "def" (redefined)
abc3 catstr abc2,<,>,abc,<,>,abc2 ; abc3 = "abc,def,abc"
abclen sizestr abc ; abclen = 3
abc3len sizestr abc3 ; abc3len = 11
comma1 instr abc3,<,> ; comma1 = 4
comma2 instr comma1+1,abc3,<,> ; comma2 = 8
abc4 substr abc3,5 ; abc4 = "def,abc"
abc5 substr abc3,5,3 ; abc5 = "def"
abc6 equ 3+2+1 ; abc6 = "3+2+1"
abc7 equ %3+2+1 ; abc7 = "6"
abc8 equ %comma1 ; abc8 = "4"