(*
Example code for while/wend

While/wend is a way to repeat a block of instructions while a condition is true.

Note that the statements inside the loop will not be executed at all if the condition
is false to start with.

So, here are some examples:
*)

; 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
	
		while . < $100				;
  		  db $00,$01,$02,$03,$04,$05,$06,$07	;
    		  wend		 			; 

(*
Do you see what happened? the ". < $100" was true, so the statements inside the loop
were 'executed'. The wend caused Zeus to jump back to the start of the loop.
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 after the "wend"

while/wend loops can be nested. They behave as you would expect.
*)

; Same thing again, using variables this time...

		org $100	; Move a bit so you can see the separate data

Value = 0			; Set up a variable
	while Value < $100	; Loop while it's less than 256
  	  db Value		; Plant the current value
          Value = Value + 1	; Increment it
          wend			; Note the while .. wend

(*
Now, one thing you should be wondering about is what happens if we set an infinite
loop? We need some way to break out of them - that is why the "Assemble" button
changes to "ABORT!" during assembly. If you have infinite loops pressing the ABORT
button will abort the assembly process. You may have to press it a couple of times; 
that's windows for you...
*)