.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.

[Use]

-

Use the .irp and .endm directives to describe a series of statements, only some of which become variables, repeatedly in a source program.

[Description]

-

If the .endm directive corresponding to .irp directive does not exist, the assembler outputs the message.

-

If the .exitm directive appears in the IRP-ENDM block, subsequent expansion of the IRP-ENDM block by the assembler is terminated.

-

Macro definitions cannot be described in the IRP-ENDM block.

-

Assembly control instructions may be described in the IRP-ENDM block.

-

The maximum number of actual parameters that can be used depends on the amount of memory.

[Example]

.cseg   text
 
.irp    PARA 0xA, 0xB, 0xC              ; (1)
    ; IRP-ENDM block
        add     PARA, r12
        mov     r11, r12
.endm                                   ; (2)
    ; Source text

(1)

The formal parameter is "PARA" and the actual parameters are the following three: "0xA", "0xB", and "0xC".
This .irp directive tells the assembler to expand the IRP-ENDM block three times (i.e., the number of actual parameters) while replacing the formal parameter "PARA" with the actual parameters "0xA", "0xB", and "0xC"

(2)

This directive indicates the end of the IRP-ENDM block.