Page 1 of 1

Load and immediately run a ZX81 Basic program

Posted: Sun Apr 25, 2021 10:30 am
by loftcat
Apologies in advanced if this seems like a straight-forward question, I've looked in the ZX81 Basic manual and can't find the answer...

Is it possible to save a Basic program so when it's loaded back in it runs immediately, rather like in Spectrum Basic by using SAVE "NAME" LINE 10 ?

Thanks!

Re: Load and immediately run a ZX81 Basic program

Posted: Sun Apr 25, 2021 11:30 am
by 1024MAK
ZX81 BASIC Manual wrote:LOAD & SAVE can also be used in programs. With SAVE, the program will save itself in such a state then when loaded it will immediately carry on executing from the line after the SAVE statement.
See Chapter 16 - Tape storage

So to jump to a line number, use a GO TO after the SAVE:

Code: Select all

9050 SAVE “myprog”
9060 GO TO 10
Mark

Re: Load and immediately run a ZX81 Basic program

Posted: Sun Apr 25, 2021 11:47 am
by BarryN
Basically you save the program from within itself while it is running. Since it was saved in a running state it continues running when loaded back in.

10 PRINT "HELLO"
20 GOTO 10
100 SAVE"RUNNING"
110 GOTO 10

RUN 100

Re: Load and immediately run a ZX81 Basic program

Posted: Sun Apr 25, 2021 12:29 pm
by loftcat
Perfect just what I was looking for thank you both.

Rechecked the manual too and found the page you're referring to in Chapter 16... I must have missed that page, thanks again!