CONT or CONTINUE in BASIC programs

Anything Sinclair ZX Basic related; history, development, tips - differences between BASIC on the ZX80 and ZX81
Post Reply
MOB-i-L
Posts: 56
Joined: Mon Apr 19, 2010 12:13 am
Location: Lund, Skåne/Scania, Sweden
Contact:

CONT or CONTINUE in BASIC programs

Post by MOB-i-L »

Is there any use for CONT (or CONTINUE for ZX Spectrum) inside a BASIC program?

CONT inside programs works different in e.g. ZX81/ZX Spectrum vs VIC20/C64.

I know that CONT is useful on the command line.

CONT
Suppose p/q was the last report with a non-zero. Then CONT has
the effect GOTO q if p <> 9, GOTO q+1 if p = 9 (STOP statement)
(Vickers 1981)
User avatar
XavSnap
Posts: 1530
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: CONT or CONTINUE in BASIC programs

Post by XavSnap »

Hi MOB-i-L,

The CONT can't be used to store machine code, but can be followed by a zero bloc.

CONT in a programme is like a REM
CONT don't use the NXT_LINE BASIC variable.
CONT don't use the ADD_CHAR variable.
I tried to use CONT to jump to a line, but i haven't found the good process.

It should retrieve the last stack used in the BASIC ROM, but it can't be use with the BASIC monitor...
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
MOB-i-L
Posts: 56
Joined: Mon Apr 19, 2010 12:13 am
Location: Lund, Skåne/Scania, Sweden
Contact:

Re: CONT or CONTINUE in BASIC programs

Post by MOB-i-L »

CONT in a programme is like a REM
I don't agree to that because CONT is like GOTO last executed line unless STOP because then GOTO last executed line +1.
In this program you RUN and then press CONT and then SPACE/BREAK key, then CONT again and BREAK etc. You can also try RUN 75 and then press CONT for an infinite loop.

Code: Select all

   5 STOP 
  10 PRINT "1";
  20 PRINT "2";
  30 PRINT "3";
  40 PRINT "4";
  50 PRINT "5";
  60 PRINT "6";
  70 CONT 
  75 STOP 
  80 CONT 
 100 FOR I=1 TO 24
 110 SCROLL 
 120 NEXT I
 130 SAVE "DICE"
 140 RUN
The program was saved using RUN 100, since that should make the .p file smaller.
Attachments
dice.p
(364 Bytes) Downloaded 5 times
User avatar
XavSnap
Posts: 1530
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: CONT or CONTINUE in BASIC programs

Post by XavSnap »

Hi MOB-i-L,

Yes, it's a weird behavior...
It loops to the last error or break point.

Or...

Code: Select all

  1 POKE 16384,08
  2 POKE 16391,20
  10 PRINT "1";
  20 PRINT "2";
  30 PRINT "3";
  40 PRINT "4";
  50 PRINT "5";
  60 PRINT "6";
  70 CONT 

Code: Select all

  10 PRINT "1";
  20 PRINT "2";
  25 POKE 16384,8
  30 PRINT "3";
  40 PRINT "4";
  50 PRINT "5";
  60 PRINT "6";
  80 CONT 
Loop drived with the ERR_SP value...
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
Post Reply