MACRO Initiate macro definition Directive
MACRO name [dummy_arg [,dummy_arg]...] ; Ideal mode
macro_body
ENDM
name MACRO [dummy_arg [,dummy_arg]...] ; MASM mode
macro_body
ENDM
Defines a multiline macro to be expanded later when name is encountered.
Macros may be nested to any depth, may call other macros, and may call
themselves. They may also be redefined.
Macros generate code when they are called, not when defined. All
addresses generated are relative to the position of where the macro is
called, not where it is defined.
dummy_arg is a symbolic name used as a place holder for the actual
argument passed to the macro when it's invoked; it has the following
syntax:
dummy_name [:dummy_type]
The optional dummy_type specifies something about the form the actual
argument must take when you invoke the macro. The following types are
supported:
dummy_type Meaning
REQ Argument cannot be null or spaces.
=<text_string> Bracketed text string is the default value for the
dummy argument when the actual argument is null or
contains spaces.
VARARG Actual argument consists of the rest of the macro
invocation, interpreted as a list of arguments.
Commas and angle brackets are added to ensure this
interpretation.
REST Actual argument consists of the rest of the macro
invocation, interpreted as raw text.
Invoking a multiline macro
The syntax for invoking a general multiline macro is this:
macro_name [argument [[,]argument]...]
Each argument (separated by commas or spaces) represents a text
string. You can specify this text string in the following ways:
■ as a contiguous group of characters, not containing any whitespace,
commas, or semicolons
■ as a group of characters delineated by angle brackets (< >), which
can contain whitespace, commas, and semicolons
■ as a single character preceded by a ! character (which is equivalent
to enclosing the character in angle brackets)
■ as an expression preceded by a % character, which represents the
text value of the expression appropriate for the currently selected
radix