## ALP Programming Guide and Reference

[prev][next][parent][TOC]

### = (Assign an Expression to an Assembler Variable)

The = directive lets you create a symbolic assembler-time variable. Numeric expressions may be assigned to the variable as many times as necessary.

Syntax

    Name   =   Expression

Remarks

The = directive is similar to the EQU assembler directive except you can redefine Name without causing an error condition. However, the = directive is more restrictive about the allowable ExpressionType s that can be utilized in the Expression field, and it cannot be used to create Text- EquateName s.

Name is a globally-scoped Identifier. The Expression entry must evaluate to an Operand-ExpressionType. If an evaluation error occurs, or if the Expression references an external identifier, or if the Expression evaluates to one of the following Operand-ExpressionType s:

Indexed-ExpressionType
Register-ExpressionType
Floating-Point-ExpressionType
Compound-ExpressionType
Duplicated-ExpressionType

then an error message is issued and the assignment does not take place. Otherwise, the Identifier is converted to a Numeric-EquateName.

See also the EQU assembler directive and the EQU preprocessor directive.

Example

    EMP   =   6         ; Establish   as   redefineable   numeric   equate
    EMP   EQU   6       ; OK ,   value   is   the   same ,   EMP   remains   redefinable
    EMP   EQU   7       ; Error ,   can ' t   change   value   with   EQU
    EMP   =   7         ; OK ,   EMP   is   redefineable   with   =
    EMP   =   EMP + 1     ; Can   refer   to   its   previous   definition

Note: The Expression-Attribute s inherited from the Expression during an assignment are not retained in subsequent assignments. For example:

    VECTOR   =   WORD   PTR   4            ;   Type - Declaration   attribute
            MOV   [ BX ] , VECTOR         ;   Store   the   4   as   a   word
    VECTOR   =   6                      ;   Type - Declaration   attribute   discarded
            MOV   [ BX ] , VECTOR         ;   Error ,   no   size   for   operands