Crossware

Table of Contents        Previous topic       Next topic       

CROSS ASSEMBLER->Structured Assembly->REPEAT/UNTIL

The REPEAT/UNTIL construct will generate a loop testing for repetition at the end of the loop.

     REPEAT
     <your assembly code>
     UNTIL.<size> <expression>

<size> can be .B, .W or .L and the assembler will use this size when it generates the compare instructions.  If no size is specified, the assembler will assume .W.  However if either of the operands of a pair is an address register, the size of the compare will always be .L.

No forward branches are generated and so there is not <distance> requirement.

See IF/THEN/ELSE/ENDI for the syntax of <expression>.

Example 1:

    REPEAT
    <your assembly code>
    UNTIL.L <CC>

will generate the following assembler code:

.00000
         <your assembly code>
         BCS       .00000

Example 2:

    REPEAT
    <your assembly code>
    UNTIL.L D1 <EQ> D2

will generate the following assembler code:

.00001
         <your assembly code>
         CMP.L     D2,D1
         BNE       .00001

Example 3:

    REPEAT
    <your assembly code>
    UNTIL.L D1 <EQ> (A1) AND D1 <NE> #35

will generate the following assembler code:

.00002
         <your assembly code>
         CMP.L     (A1),D1
         BNE       .00002
         CMP.L     #35,D1
         BEQ       .00002