The syntax of the expression evaluate operator (%) is
%expression
The expression is evaluated and its value is used to replace the
expression itself. Typically, this operator is used to provide
an argument in a macro call.
Example: Consider a macro to allocate and initialize an
array of a given size. Assume that the macro receives the array name and size,
element size (B for byte, W for word, ...), and the initial value. |
init_array MACRO element_size, name, size, init_value
name D&element_size size DUP (init_value)
ENDM
| | |
To reserve space for an integer array of 47x7 (marks) and initialize it to -1,
we can call the macro as:
init_array W, marks, %47*7, -1
The macro call will be expanded as
marks DW 329 DUP (-1)