MACRO

Macro definition.

  label
  MACRO [
  argumentlist] 
                  
  .                 
  .                 
  macro definition statements                 
  .                 
  .                 
  ENDM 
Remarks

The required label is the symbol by which the macro is called. If the macro is named the same as an existing Assembler directive or mnemonic, a warning is issued. This warning can be avoided with the RDIRECT directive.

The definition of a macro consists of three parts: the header, which assigns a name to the macro and defines the dummy arguments; the body, which consists of prototype or skeleton source statements; and the terminator. The header is the MACRO directive, its label, and the dummy argument list. The body contains the pattern of standard source statements. The terminator is the ENDM directive.

The dummy arguments are symbolic names that the macro processor replaces with arguments when the macro is expanded (called). Each dummy argument must obey the same rules as symbol names. Dummy argument names that are preceded by an underscore are not allowed. Within each of the three dummy argument fields, the dummy arguments are separated by commas. The dummy argument fields are separated by one or more blanks.

Macro definitions may be nested, but the nested macro is not defined until the primary macro is expanded.

Example
;swap REG1,REG2 using X0 as temp
SWAP_SYM    MACRO   REG1,REG2 
            MOVE    R\?REG1,X0
            MOVE    R\?REG2,R\?REG1
            MOVE    X0,R\?REG2
            ENDM
See also

DUP

DUPA

DUPC

DUPF

ENDM