SLAU131V October 2004 – February 2020
Macro definition: The following code defines a macro, add3, with four parameters:
1 add3 .macro P1,P2,P3,SUM
2 MOV #0,SUM
3 ADD P1,SUM
4 ADD P2,SUM
5 ADD P3,SUM
6 .endm
Macro call: The following code calls the add3 macro with four arguments:
7
8 0000 add3 R11,R12,R13,R14
Macro expansion: The following code shows the substitution of the macro definition for the macro call. The assembler substitutes R11, R12, R13, and R14 for the P1, P2, P3, and SUM parameters of add3.
1 0000 430E MOV #0,R14
1 0002 5B0E ADD R11,R14
1 0004 5C0E ADD R12,R14
1 0006 5D0E ADD R13,R14