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.
Macro Block
◄Example► ◄Up► ◄Contents► ◄Index► ◄Back►
────────────────────────────────────────────────────────────────────────────
Syntax: name MACRO [parameter[:tag]] [,parameter[:tag]]...]
[LOCAL varlist]
statements
[EXITM [textitem]]
ENDM
See also: ENDM, LOCAL, EXITM, OPTION OLDMACROS, .LISTMACRO,
FARDATA, PUSHCONTEXT, Using VARARG in Macros,
MASM 5.1 Compatibility
Description:
Marks the beginning of a macro definition called <name> and takes
optional parameters. The assembler generates the statements in the
macro block each time the macro is called in source code. Macro
procedures and macro functions can be nested up to 40 levels. Text
macros may be nested up to 20 levels.
Macro procedures can be redefined at any time. The new definition
affects any subsequent calls to this macro. Macro functions can
only be redefined, if they have not been called yet.
Example:
mymacro MACRO value:REQ, reg:=<AX>, options:VARARG
LOCAL returnval
∙
∙
∙
EXITM returnval
ENDM
Parameter Description
name A unique symbol name. It can appear later in source
code, to call the macro.
parameter A valid symbol name. Each parameter can appear in
the statements and is replaced by the corresponding
item in the argument list whenever the macro is
called.
:tag Either :REQ, :=default, or :VARARG. :REQ causes an
assembler error if the parameter is given a blank
argument. :=default causes <parameter> to be
assigned <default> if given a null argument.
:VARARG allows a variable number of arguments to be
passed as a comma-separated list to <parameter>. If
:VARARG is used, it must be applied only to the
last parameter of the MACRO directive.
statements Any valid assembler statements.
value Optional return value for macro function.
-♦-