Example 1
The following macro definition uses the .REPEAT directive to
store an ASCII string a specified number of times, followed by
a 0 byte:
.MACRO COPIES STRING,NUM
.REPEAT NUM
.ASCII "STRING"
.ENDR
.BYTE 0
.ENDM COPIES
Example 2
The following macro call stores five copies of the string
ABCDEF. This example is divided into four parts:
Macro invocation:
COPIES <ABCDEF>,5
Macro expansion of .REPEAT invocation:
.REPEAT 5
.ASCII "ABCDEF"
.ENDR
.REPEAT expansion:
.ASCII "ABCDEF"
.ASCII "ABCDEF"
.ASCII "ABCDEF"
.ASCII "ABCDEF"
.ASCII "ABCDEF"
End of macro expansion:
.BYTE 0
Example 3
The following macro call stores three copies of the string How
Many Times. This example is divided into four parts:
Macro invocation:
VARB = 3
COPIES <How Many Times>,VARB
Macro expansion of .REPEAT invocation:
.REPEAT VARB
.ASCII "How Many Times"
.ENDR
.REPEAT expansion:
.ASCII "How Many Times"
.ASCII "How Many Times"
.ASCII "How Many Times"
End of macro expansion:
.BYTE 0