(*
Example code for repeat/until

Repeat/until is a way to repeat a block of instructions until a condition becomes
true.

Note that the statements inside the loop will be used at least once.

So, here is an example:
*)

; A simple loop that fills a block of memory with a pattern.
; (look at the code tab to see it)

		org 0					; Start at zero
	
		repeat					;
  		  db $00,$01,$02,$03,$04,$05,$06,$07	;
    		until . >= $100 			; 

(*
Do you see what happened? the until statement evaluated the expression ". >= $100"
and jumped back to the repeat statement if it wasn't true. After enough times 
through the loop the db statement had generated enough data that the assembly
position "." was equal to (or greater than) $100, so the loop stopped at that time
and Zeus carried on with the next statement.

Repeats can be nested. They behave as you would expect.
*)

; Here's another example, using variables this time

		org $200	; Somewhere else

Value = 0			; Set up a variable
	repeat			; Loop
  	  db Value		; Plant the current value
          Value = Value + 1	; Increment it
	until Value > $100	; Go back until we've done enough

