SHASM Macro Definition

A macro is a sequence of source statements that are collectively named and handled together. Typically, the macro definition specifies formal parameters that can be replaced by specific parameters at expansion time. Defaults for formal parameters can be specified in macro definitions. The default specifies the character string that replaces the formal parameter if the corresponding specific parameter is omitted.

You can designate macro parameters by positional specification or keyword specification.

  • Positional specification

    The macro parameters are specified in the same order as that of the formal parameters declared in the macro definition.

  • Keyword specification

    Each macro parameter is specified following its corresponding formal parameter, separated by an equal sign (=).

The syntax for formal parameters is the same as that for symbols. The assembler distinguishes uppercase and lowercase letters, and an apostrophe (') can be added to clearly distinguish the formal parameter name from the rest of the source statement. If any of the following characters are included in the default, the default must be enclosed by double quotation marks ("") or angle brackets (< >).

  • Space
  • Tab
  • Comma (,)
  • Semicolon (;)
  • Double quotation marks ("")
  • Angle brackets (< >)

The assembler inserts defaults at macro expansion by removing the double quotation marks or angle brackets that enclose the character strings.

Macros cannot be defined between .AREPEAT and .AENDR directives, and between .AWHILE and .AENDW directives.

See Also

SHASM Macro Directives | Macro Generation Numbers

 Last updated on Thursday, April 08, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.