Hi Jim,

Yes, before the dat subroutine.

If there is no Goto Mainloop there the program will "fall into" the subroutine as it comes out of the main loop. Since it wasn't intentionally jumped to with a GOSUB at that time it doesn't know where to go once it gets to the RETURN at the end of the subroutine and it all falls to pieces.

Look at this:
Code:
Mainloop:
  Do this
  Gosub Sub_1
  Do something else
  Gosub Sub_2
Goto MainLoop

Sub_1:
  Whatever
RETURN

Sub_2:
  Whatever
RETURN
If the Goto MainLoop isn't there the program will just continue into Sub_1 as if it was actually called with a GOSUB (which it wasn't). So at the end of Sub_1 there's a RETURN but to where should it return? There's no return adress on the stack. Things go bad.

Hope that makes sense. Midnight here, got to go now.

/Henrik.