multi-statement in zx81 basic?

Anything Sinclair ZX Basic related; history, development, tips - differences between BASIC on the ZX80 and ZX81
Post Reply
User avatar
msknight
Posts: 386
Joined: Fri Dec 15, 2023 8:26 pm
Location: Sussex, UK

multi-statement in zx81 basic?

Post by msknight »

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.
User avatar
1024MAK
Posts: 5116
Joined: Mon Sep 26, 2011 10:56 am
Location: Looking forward to summer in Somerset, UK...

Re: multi-statement in zx81 basic?

Post by 1024MAK »

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
ZX81 Variations
ZX81 Chip Pin-outs
ZX81 Video Transistor Buffer Amp

:!: 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.
User avatar
msknight
Posts: 386
Joined: Fri Dec 15, 2023 8:26 pm
Location: Sussex, UK

Re: multi-statement in zx81 basic?

Post by msknight »

Thanks for confirming. Just going to have to write more code :-)
dr beep
Posts: 2076
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: multi-statement in zx81 basic?

Post by dr beep »

msknight wrote: Thu Feb 29, 2024 9:28 pm Thanks for confirming. Just going to have to write more code :-)

Easiest is
IF condition THEN GO SUB linenumber

and at linenumber code mutiple lines and end with RETURN
User avatar
msknight
Posts: 386
Joined: Fri Dec 15, 2023 8:26 pm
Location: Sussex, UK

Re: multi-statement in zx81 basic?

Post by msknight »

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.
User avatar
GCHarder
Posts: 427
Joined: Sat Dec 14, 2013 7:46 pm

Re: multi-statement in zx81 basic?

Post by GCHarder »

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
Post Reply