Everything

.IRP


Tells the assembler to repeatedly expand a series of statements described between .IRP directive and the .ENDM directive the number of times equivalent to the number of actual parameters while replacing the formal parameter with the actual parameters (from the left, the order) specified in the operand field.

[Syntax]

Symbol field
Mnemonic field
Operand field
Comment field
[label:]
.IRP
  :
formal-parameter[ actual-parameter[, ... ]] 
[; comment]

[Function]

-

The .IRP directive tells the assembler to repeatedly expand a series of statements described between this directive and the .ENDM directive (called the IRP-ENDM block) the number of times equivalent to the number of actual parameters while replacing the formal parameter with the actual parameters (from the left, the order) specified in the operand field.

[Description]

-

If no corresponding .ENDM directive is found for an .IRP directive within a single file, an error will occur.

-

The maximum number of arguments depends on the usable amount of memory.

[Example]

    .IRP    PAR 0x10, 0x20, 0x30
    ADD     A, #PAR
    MOV     [DE], A
    .ENDM

 

The code is expanded as shown below after assembling.

    ADD     A, #0x10
    MOV     [DE], A
    ADD     A, #0x20
    MOV     [DE], A
    ADD     A, #0x30
    MOV     [DE], A