III.11.3 Repeat Macros

Repeat macros don't have a macro name, and therefore cannot be called multiple times. They are always expanded immediately after their definition. During expansion, their macro body is repeated n times (0 <= n <= 65535). Repeat macros start with the keyword REPT, followed by an expression, which must be known on pass 1. In analogy to callable macros, there is a macro body, which must be terminated with an ENDM instruction:

REPT <expression>
<body line 1>
<body line 2>
    .
    .
<body line m>
ENDM

The expression value specifies how many times the macro body is to be repeated. Since repeat macros start with the keyword REPT, they are sometimes also called “REPT blocks”.

Example:

	REPT 5
	NOP
	ENDM
This REPT block will expand to five NOP instructions immediately after its definition:
	NOP
	NOP
	NOP
	NOP
	NOP