multi-statement in zx81 basic?
multi-statement in zx81 basic?
From what I'm reading, I believe that ZX81 doesn't allow multiple commands off the back of one IF THEN statement, but I thought I'd ask here to be sure.
All that I've learned - https://msknight.com/bbc/index.html#zx81
- 1024MAK
- Posts: 5426
- Joined: Mon Sep 26, 2011 10:56 am
- Location: Looking forward to summer in Somerset, UK...
- Contact:
Re: multi-statement in zx81 basic?
ZX81 BASIC only allows one command per line. IF being a "special" case, but you can only have one command after the THEN, the THEN being mandatory.
Of course, you can have another IF after the THEN. You can also have a complex expression as part of the IF.
Mark
Of course, you can have another IF after the THEN. You can also have a complex expression as part of the IF.
Mark
ZX81 Variations
ZX81 Chip Pin-outs
ZX81 Video Transistor Amp
Standby alert 
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb
Bah humbug, it’s the winter. Looking forward to 2025.
ZX81 Chip Pin-outs
ZX81 Video Transistor Amp


There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb

Bah humbug, it’s the winter. Looking forward to 2025.
Re: multi-statement in zx81 basic?
Thanks for confirming. Just going to have to write more code 

All that I've learned - https://msknight.com/bbc/index.html#zx81
Re: multi-statement in zx81 basic?
Cheers. In my case, it's just two statements so I might as well leave it at that for what I'm doing... but I'll keep that in mind for the future.
All that I've learned - https://msknight.com/bbc/index.html#zx81
Re: multi-statement in zx81 basic?
Implementing multistatement lines is actually fairly simple, in MC. It's just a matter of keeping track of the chr addresses in the line.
The program "SHREB" from 1986 uses multistatement lines. Since you have a ZXPand you maybe interested in these programs...
https://www.sinclairzxworld.com/viewtop ... =11&t=4739
Greg
The program "SHREB" from 1986 uses multistatement lines. Since you have a ZXPand you maybe interested in these programs...
https://www.sinclairzxworld.com/viewtop ... =11&t=4739
Greg
Re: multi-statement in zx81 basic?
You cannot in basic but you can do some multiple things mathematically such as
Let k$=inkey$
.a=a+(a<30 and k$="8")-(a>1 and k$="5")
Only add 1 to a if a is less than 30 and keypress 8,
Minus 1 if a mor than 1 and you pressed 5 etc
So this statement is testing 4 things amd adding or removing 1 from a variable
Let k$=inkey$
.a=a+(a<30 and k$="8")-(a>1 and k$="5")
Only add 1 to a if a is less than 30 and keypress 8,
Minus 1 if a mor than 1 and you pressed 5 etc
So this statement is testing 4 things amd adding or removing 1 from a variable