So ZX81 Basic, unusually, allows modification of the program without clearing all the variables; and SAVE and LOAD will save them and reload them.
Except, RUN implicitly does a CLEAR, wiping them before the program runs.
Given that the ZX81 does (AFAIK) allow autorunning of programs, how does this make loading variables off tape useful? Where there any titles where the instructions to start the program told you to do GOTO 0 instead of RUN?
(Why, yes, I am desperately trying to save space in a program; why do you ask?)
ZX81 basic: running the program without clearing variables
- PROSM
- Manic Miner
- Posts: 476
- Joined: Fri Nov 17, 2017 7:18 pm
- Location: Sunderland, England
- Contact:
Re: ZX81 basic: running the program without clearing variables
Well, you would have to write something like this for an auto-running program that did not clear the variables:
To save the program, you type GOTO 10 (so as not to clear the variables) and the SAVE command will be executed. Due to the way ZX81 Basic works, the current state of the BASIC program will be saved, thus when this example is loaded back in, it will automatically start at line 20, believing that it has just finished the SAVE command from line 10.
Code: Select all
10 SAVE "PROGRAM"
20 ... (rest of the program here)
All software to-date
Working on something, as always.
Working on something, as always.
Re: ZX81 basic: running the program without clearing variables
Is that why so many ZX81 listings from magazines have something like
9996 STOP
9997 CLEAR
9998 SAVE "THING"
9999 GO TO 1
at the end of them? For example this one.
Some listings even made you type in the LET statements yourself before using GO TO to start the program.
9996 STOP
9997 CLEAR
9998 SAVE "THING"
9999 GO TO 1
at the end of them? For example this one.
Some listings even made you type in the LET statements yourself before using GO TO to start the program.
- 1024MAK
- Bugaboo
- Posts: 3115
- Joined: Wed Nov 15, 2017 2:52 pm
- Location: Sunny Somerset in the U.K. in Europe
Re: ZX81 basic: running the program without clearing variables
Yes
Part of the system variable area gets saved, and that includes the state of the execution of the BASIC program.
Mark
Part of the system variable area gets saved, and that includes the state of the execution of the BASIC program.
Mark
Standby alert
“There are four lights!”
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb
Looking forward to summer later in the year.
“There are four lights!”
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb
Looking forward to summer later in the year.
Re: ZX81 basic: running the program without clearing variables
Oh, yeah, I completely forgot you could do that! Except it didn't save the GOSUB stack along with the program state, hence the warning in the manual...
Gosh, I'd forgotten how... opinionated... ZX81 Basic is. Also slow.
Incidentally, several of the programs in that issue of _Sinclair Programs_ are incorrectly labelled as for the ZX81 when they clearly only run on the Spectrum. I'm appalled at the lack of professionalism. Should I write in and complain?
Gosh, I'd forgotten how... opinionated... ZX81 Basic is. Also slow.
Incidentally, several of the programs in that issue of _Sinclair Programs_ are incorrectly labelled as for the ZX81 when they clearly only run on the Spectrum. I'm appalled at the lack of professionalism. Should I write in and complain?
- 1024MAK
- Bugaboo
- Posts: 3115
- Joined: Wed Nov 15, 2017 2:52 pm
- Location: Sunny Somerset in the U.K. in Europe
Re: ZX81 basic: running the program without clearing variables
One thing to keep in mind with the ZX81, is that in SLOW mode, the CPU is spending a lot of it's time sending screen data to the TV. It runs a bit faster in FAST mode (but without a screen display). But even then, the BASIC is pedestrian. The code in the ROM was written to be compact rather than fast, the idea being to squeeze in as much functionality as possible.
Mark
Mark
Standby alert
“There are four lights!”
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb
Looking forward to summer later in the year.
“There are four lights!”
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb
Looking forward to summer later in the year.
Re: ZX81 basic: running the program without clearing variables
I don't think 'pedestrian' is the right word --- that implies it's somehow ordinary, which ZX81 Basic is anything but.
I think my favourite combination of features are the absence of multiple statements per line and the missing ELSE clause in if statements: these synergise beautifully for maximum inconvenience... I used to think Commodore Basic was tough to work in! Actually writing a useful program on an unexpanded ZX81 is an interesting challenge (I must try it on some of my cow orkers).
I know there's a cottage industry of alternative ROMs for the Spectrum; did anyone ever do any for the ZX81? Not counting the Jupiter Ace, of course.
I think my favourite combination of features are the absence of multiple statements per line and the missing ELSE clause in if statements: these synergise beautifully for maximum inconvenience... I used to think Commodore Basic was tough to work in! Actually writing a useful program on an unexpanded ZX81 is an interesting challenge (I must try it on some of my cow orkers).
I know there's a cottage industry of alternative ROMs for the Spectrum; did anyone ever do any for the ZX81? Not counting the Jupiter Ace, of course.
- 1024MAK
- Bugaboo
- Posts: 3115
- Joined: Wed Nov 15, 2017 2:52 pm
- Location: Sunny Somerset in the U.K. in Europe
Re: ZX81 basic: running the program without clearing variables
Browse Sinclair ZX World forums, as that is where Zeddy folk hang out
There have and still are people who have/are improving the BASIC for the ZX81. I can't remember if there is a whole alternative BASIC though.
There is however a ZX Spectrum "emulator" that runs on a ZX81!
Mark
There have and still are people who have/are improving the BASIC for the ZX81. I can't remember if there is a whole alternative BASIC though.
There is however a ZX Spectrum "emulator" that runs on a ZX81!
Mark
Standby alert
“There are four lights!”
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb
Looking forward to summer later in the year.
“There are four lights!”
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb
Looking forward to summer later in the year.