Chapter 11 Writing Macro Control Statements

11.8 rept

Syntax

reptexpression block

endm

Functional description

The rept directive repeatedly expands the specified block the specified number of times. It is used for simple repeating without parameters. The rept directive can be coded anywhere in a program or even within a macro definition.

Coding rules

Symbols cannot be used within a block. If used, a double definition error will occur. The local directive cannot be used either.

Further rept and irp directives and macro calls can be coded within a block. Up to 20 nesting levels are allowed.

Usage example

In the following example, the rept directive is in a macro definition that is used twice in the program main.

repeat

macro

p1

 

rept

p1

 

add

1, D0

 

endm

 

;

endm

 

 

 

_TEXT

section

CODE, PUBLIC,1

 

repeat

2

 

rept

3

 

add

1, D1

 

endm

 

218 rept

Page 230
Image 230
Panasonic MN1030 user manual Reptexpression block