Invoking Macros

To invoke a macro, use its name in your assembler listing, separating parameters with commas. To pass a parameter that includes a comma, enclose the parameter in angle brackets.

For example, the following listing shows macro pattern, which repeats a pattern of bytes passed to it the number of times specified in the macro call.

Listing: Pattern Macro Definition
pattern:    .macro times,bytes                 .rept times 
                .byte bytes 
                .endr 
            .endm 

The following listing shows a statement that calls pattern, passing a parameter that includes a comma.

Listing: Macro Argument with Commas
            .data halfgrey:   pattern 4,<0xAA,0x55> 

The following listing is another example calling statement; the assembler generates the same code in response to the calling statement of either of the above listings.

Listing: Alternate Byte-Pattern Method
halfgrey:   .byte 0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55