Assembly Language Help (alang.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
Numeric and String Equate
 Example                                   Up Contents Index Back
────────────────────────────────────────────────────────────────────────────
 
  Syntax:   name EQU expression
 
            name EQU <text>
 
            name TEXTEQU textmacro
 
            name TEXTEQU %expression
 
  See also: Equal Sign (=), EQ, ==, Angle Brackets (<>),
            Escape character (!), text item, /D, MASM 5.1 Compatibility
 
  Description:
 
     The EQU directive assigns <expression> or <text> to <name>. Angle
     brackets indicate that <text> should not be evaluated as an
     expression.
 
     EQU evaluates the numeric value of <expression> and assigns
     the resulting constant value to <name>. Unlike =, EQU does not
     allow numeric equates to be redefined. If <expression> cannot be
     evaluated, EQU treats <expression> as text.
 
     The TEXTEQU directive acts like the EQU directive with text
     equates but performs macro substitution at assembly and does not
     require angle brackets. The TEXTEQU directive will also resolve
     the value of an expression preceded by a percent sign (%). The EQU
     directive does not perform macro substitution or expression
     evaluation for strings.
 
     Text equates are limited to 255 characters. Text equates can be
     redefined to another value but not to a different type of symbol.
 
     Parameter      Description
 
     name           Symbolic name for <expression> or <text>
 
     expression     Variable or constant numeric expression (not a
                    memory expression)
 
     text           String enclosed in angle brackets (<>)
 
     textmacro      A text macro (such as @Date) or a string enclosed in
                    angle brackets (<>).
 
     expression     An expression preceded by a %.
 
  Example:
 
       MASM    EQU      5.1 + 0.9        ;Evaluates to 6.0
       Msft    EQU      <Microsoft>      ;String equate
       libpath TEXTEQU  @Environ(<LIB>)  ;Text Macro Equate
       endstr  TEXTEQU  %(endadr-staradr);String equate to numeric value
 
     In MASM 5.1, you can equate one symbol with another. These equates are
     called aliases. Unless you specify OPTION M510, MASM 6.1 does not allow
     aliases defined with EQU. An immediate expression or text must appear as
     the right operand of an EQU directive. Change aliases to use the TEXTEQU
     directive. This change may cause an expression to evaluate differently.
                                    -♦-