You can refer to the parameters directly by name. The following listing shows the setup macro, which moves an integer into a register and branches to the label _final_setup.
setup: .macro name mov name,d0 jsr _final_setup .endm
The following listing shows a way to invoke the setup macro.
#define VECT=0 setup VECT
The following listing shows how the assembler expands the setup macro.
move VECT, d0 jsr _final_setup
If you refer to named macro parameters in the macro body, you can precede or follow the macro parameter with &&. This lets you embed the parameter in a string. For example, The following listing shows the smallnum macro, which creates a small float by appending the string E-20 to the macro argument.
smallnum: .macro mantissa .float mantissa&&E-20 .endm
The following listing shows a way to invoke the smallnum macro.
smallnum;10
The following listing shows how the assembler expands the smallnum macro.
.float 10E-20
Macro syntax includes positional parameter references (this feature can provide compatibility with other assemblers). For example, The following listing shows a macro with positional references \1 and \2.
doit: .macro move \1,d0 jsr \2 .endm
The following listing shows an invocation of this macro, with parameter values 10 and print.
doit 10,print
The following listing shows the macro expansion.
move 10,d0 jsr print