Chapter 11 Writing Macro Control Statements
220 irp
11.9 irp
Syntax
irp dummy_parameter, parameter (, parameter) ...
block
endm
NOTE: Up to10 dummy parameters can be specified.
Functional description
The irp directive repeatedly expands the specified block the specified number of times. The dummy
parameter is used within the block. The macro expansion replaces the dummy parameter with each
parameter in turn, repeated for the number of parameters.
Coding rules
Symbols cannot be used within a block. If used, a double definition error will occur. The local directive
cannot be used either.
If a comma (,) delimiters in a row are specified, the corresponding parameter will be processed as
though a null character had been specified.
To specify strings that include commas and spaces, use the macro operator <>.
Usage example
In the following example, the irp directive is in a macro definition that is used twice in the program.
init macro p1
irp opr, <pl\& 0x0f>
mov opr, D0
endm
endm
;
_TEXT section CODE, PUBLIC, 1
init 1
irp reg, D2, D3
mov 0, reg
endm