Assembly language EQU directive

EQU directive to an integer with a symbolic name or an expression of any text connected, which has three formats:

 

name EQU expression
name EQU symbol
name EQU <text>

The first format, expression must be a valid integer expression. Second format, symbol symbolic name of an existing, has been defined by a = or EQU. The third format, any text can now Chu <...> inside. When the assembler later encounters name, it is an integer value instead of text or symbol.

When defining a non-integer values, EQU useful. For example, real numbers may be used EQU defined constants:

PI EQU <3.1416>

[Example 1] The following example of a symbol strings together, and define a variable using the notation:

  pressKey EQU <"Press any key to continue...", 0>  .data  prompt BYTE pressKey

[Example 2] Suppose you want to define a symbol to calculate the number of elements a 10 x 10 integer matrix. Now two different methods to symbol definitions An integer expression with a text. Then the two data symbols are used to define:

  matrix1 EQU 10 * 10  matrix2 EQU <10 * 10>  .data  M1 WORD matrix1  M2 WORD matrix2

M1 and M2 assembler will generate different data definition. Matrix1 calculation of integer expressions and assigns it to M1. And matrix2 text is copied directly to the data definition M2:

  M1 WORD 100  M2 WORD 10 * 10

= Different and directive, the same source code file, a symbol defined by EQU can not be redefined. This restriction prevents existing symbol is assigned a new value inadvertently.

Next: TEXTEQU directive

Highly recommended reading articles

40 + annual salary of big data development [W] tutorial, all here!

Guess you like

Origin blog.csdn.net/Javaxuxuexi/article/details/93312915