REPT, ENDR

Suppose you’re feeling lazy and you want to unroll a time consuming loop. REPT is here for that purpose. Everything between REPT and ENDR will be repeated a number of times just as if you done a copy/paste operation yourself

REPT 4
add  a,c
ENDR

This will assemble add a,c four times.

You can also use REPT to generate tables on the fly:

; --
; -- Generate a 256 byte sine table with values between 0 and 128
; --
ANGLE   SET     0.0
        REPT    256
        DB      (MUL(64.0,SIN(ANGLE))+64.0)>>16
ANGLE   SET     ANGLE+256.0
        ENDR

REPT is also very useful in recursive macros and as in macros you can also use the special label operator \@. REPT-blocks can be nested.

See also:


Last updated 21 June 1997 by Carsten Sorensen