Page 1 of 4

ZX Basic vs Commodore V2.00 (Vic 20)

Posted: Sat Nov 17, 2018 11:51 pm
by Crayon21
any differences that stand out to you? drawbacks?

Re: ZX Basic vs Commodore V2.00 (Vic 20)

Posted: Sun Nov 18, 2018 1:12 am
by 1024MAK
Err. How long have you got?

There are rather a lot.

One of the biggest, is the different string handling.

Another biggie is the character sets, the ZX81 character set and codes being unique to it only. The Commodore character set and codes also being non-standard. The ZX Spectrum character set almost looks sane by comparison!

Different ways that variables and their names are handled.

Oh, the wonderful helpful error messages...

The ZX81 did get some limited graphics commands. The ZX Spectrum expanded on this.

Mark

Re: ZX Basic vs Commodore V2.00 (Vic 20)

Posted: Sun Nov 18, 2018 1:39 am
by Crayon21
anything else? maybe a video comparison?

Re: ZX Basic vs Commodore V2.00 (Vic 20)

Posted: Sun Nov 18, 2018 11:02 am
by Shaun_B
Commodore BASIC only allowed each line number to be a maximum of 255 tokenised bytes, but realistically four lines by 22 columns may be entered. This means 88 characters on entry per BASIC line, either in your programme listing or in direct mode; with keyword abbreviations, this would mean more than 88 characters, but then it would be difficult to edit those lines of your programme after the fact.

BASIC v2 also has some idea of integer types, for instance

Code: Select all

LET A%=100
The range of A% would therefore -32768 to +32767, however internally this was still essentially handled as a floating point number except for integer arrays:

Code: Select all

DIM A%(255): A(0)=-128: A(1)=128
This would be more memory efficient than

Code: Select all

DIM A(255): ...
Regarding dimensional arrays, you also didn't need to declare the first 11 elements within an array. You could simply do this in BASIC v2:

Code: Select all

0 FOR I=0 TO 10: A(I) = INT(RND(0)*16): NEXT I
This is not possible on Sinclair BASIC. Also you do not need the LET command to declare variables (although it's faster later on in your programme if you do declare your variables first).

You may enter line zero on your programme without any fancy POKEs as well.

You have a DATA statement, which may contain mixed data types, like so:

Code: Select all

0 FOR I=0 TO 3
1 READ A$(I)
2 NEXT
3 READ A,B
999 DATA "HELLO", "SAILOR", "WIBBLE", "FIN", 128, 256
You may use the INPUT command on BASIC v2 with a text prompt, like this:

Code: Select all

0 INPUT "HELLO ";A$
1 PRINT "HI, ";A$
String manipulation is used with the LEFT$, RIGHT$ and MID$ commands, unlike Sinclair BASIC which uses A$(1 TO 4), you would use LEFT$(A$, 3) because BASIC v2 zero indexes its strings.

Finally, for my quick guide, you may use simple mathematical functions in BASIC v2, like:

Code: Select all

0 DEF FN A(X)=X*X
1 PRINT FN A(9)
Regards,

Shaun.

Re: ZX Basic vs Commodore V2.00 (Vic 20)

Posted: Sun Nov 18, 2018 11:16 am
by Shaun_B
The biggest difference, of course, is that the ZX81 ROM is 8K whereas the BASIC Kernal on the Commodore VIC-20 is 16k, therefore Commodore BASIC was more verbose.

Regards,

Shaun.

Re: ZX Basic vs Commodore V2.00 (Vic 20)

Posted: Sun Nov 18, 2018 11:41 am
by dr beep
Shaun_B wrote: You may use the INPUT command on BASIC v2 with a text prompt, like this:

Code: Select all

0 INPUT "HELLO ";A$
1 PRINT "HI, ";A$
Also allowed on the ZX Spectrum

Regards,

Shaun.

Re: ZX Basic vs Commodore V2.00 (Vic 20)

Posted: Sun Nov 18, 2018 11:51 am
by Shaun_B
Hi Dr Beep,

I though the comparison was for ZX81 BASIC against VIC-20 BASIC. If not, then one may also define mathematical functions in ZX Spectrum BASIC, but more complex than those on BASIC v2.

Regards,

Shaun.

Re: ZX Basic vs Commodore V2.00 (Vic 20)

Posted: Sun Nov 18, 2018 3:03 pm
by 1024MAK
Well, it does depend on which “ZX BASIC”! There have been three for Z80 based machines:
  • BASIC for the ZX80 (4K byte ROM)
  • BASIC for the ZX81, also available for upgrading a ZX80 (8K byte ROM)
  • BASIC for the ZX Spectrum (16k byte ROM)
[I’m not including the expansions to BASIC in the later 128k ZX Spectrums because the core BASIC is the same]

Although each version expands on earlier versions, each is different in many ways. They are not code compatible. Some source may be forwards compatible, but not all commands and functions work the same.

Mark

Re: ZX Basic vs Commodore V2.00 (Vic 20)

Posted: Sun Nov 18, 2018 3:08 pm
by 1024MAK
For me, the most annoying limitation of the ZX80 and ZX81 BASICs is no multi-statement lines :(

A ZX Spectrum was the first computer in our house when I was young. At school I used Acorn BBC Model B machines. So I got into the habit of using the full screen width of a line (well, as much as possible). Either with working code, or with comments after a REM.

But you can’t do this on a ZX81 :twisted:

Mark

Re: ZX Basic vs Commodore V2.00 (Vic 20)

Posted: Sun Nov 18, 2018 7:43 pm
by Shaun_B
1024MAK wrote: Sun Nov 18, 2018 3:08 pm For me, the most annoying limitation of the ZX80 and ZX81 BASICs is no multi-statement lines :(
This is the apparent annoyance with ZX Spectrum BASIC (and all other variants except for ZX80/81 BASIC) because multi-statemented BASIC lines might make it more difficult to debug.

As this is primarily a ZX81 forum (although there is some interest in ZX80 as well), let's stick to the differences between CBM BASIC v2 and ZX81 BASIC. The differences between ZX80 and ZX81 BASIC should be documented somewhere, and if not here then maybe a thread about ZX80 BASIC vs ZX81 BASIC as well.

Regards,

Shaun.