ZX Basic vs Commodore V2.00 (Vic 20)

Anything Sinclair ZX Basic related; history, development, tips - differences between BASIC on the ZX80 and ZX81
User avatar
mrtinb
Posts: 906
Joined: Fri Nov 06, 2015 5:44 pm
Location: Denmark
Contact:

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

Post by mrtinb » Mon Dec 10, 2018 4:14 pm

Yes Sinclair Basic is more dynamic here. E.g. GOTO VARNAME works fine in Sinclair Basic, but gives an error in Commodore Basic, where GOTO and GOSUB can only be followed by a number.
Martin
ZX81, Lambda 8300, Commodore 64, Mac G4 Cube

Shaun_B
Posts: 451
Joined: Wed Apr 22, 2009 10:22 am

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

Post by Shaun_B » Wed Dec 12, 2018 9:03 pm

Moggy wrote:
Mon Dec 10, 2018 4:09 pm
Mathematical functions simple and complex can be defined within a string in zx81 basic and the evaluation of said function, after whatever values needed are entered, can be called by simply asking the strings value.
That would require a GOSUB or GOTO.

Regards,

Shaun.
Last edited by Shaun_B on Wed Dec 12, 2018 9:27 pm, edited 1 time in total.

Shaun_B
Posts: 451
Joined: Wed Apr 22, 2009 10:22 am

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

Post by Shaun_B » Wed Dec 12, 2018 9:09 pm

mrtinb wrote:
Mon Dec 10, 2018 4:14 pm
Yes Sinclair Basic is more dynamic here. E.g. GOTO VARNAME works fine in Sinclair Basic, but gives an error in Commodore Basic, where GOTO and GOSUB can only be followed by a number.
A quirk of Microsoft (Commodore) BASIC is that you can do this:

Code: Select all

 100 GOSUB 1000 UPDATE SCORE:PRINT S
 999 END
1000 S=S+10:RETURN
i.e., The string after the number is ignored until the : marking the next statement, which means that if readability is important to your BASIC then you don't need the REM statement at the start of your sub routines.

Any variable length of more than two characters in Commodore BASIC will ignore everything after the 2nd char. So LET SCA = 100: LET SCB = 101: PRINT SCA will produce the result for the latter declaration (101).

Regards,

Shaun.

Moggy
Posts: 1750
Joined: Wed Jun 18, 2008 2:00 pm

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

Post by Moggy » Wed Dec 12, 2018 10:19 pm

Shaun_B wrote:
Wed Dec 12, 2018 9:03 pm
Moggy wrote:
Mon Dec 10, 2018 4:09 pm
Mathematical functions simple and complex can be defined within a string in zx81 basic and the evaluation of said function, after whatever values needed are entered, can be called by simply asking the strings value.
That would require a GOSUB or GOTO.

Regards,

Shaun.
Not sure what you're driving at but no GOSUB or GOTO is required when defining a function within a string or its later evaluation.


IE..

10 INPUT A
20 INPUT B
30 INPUT X
40 LET Z$="A*B/SIN X"
50 PRINT VAL Z$

Functioned defined within Z$ and evaluated in line 50 using the variables previously input and if the program is written in what was used to be termed the "call and fall" manner then I can't see where the GOTO etc fits in?

Or are you meaning a defined funtion pointing to a jump to a line number?

Shaun_B
Posts: 451
Joined: Wed Apr 22, 2009 10:22 am

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

Post by Shaun_B » Wed Dec 12, 2018 10:52 pm

Moggy wrote:
Wed Dec 12, 2018 10:19 pm

Not sure what you're driving at but no GOSUB or GOTO is required when defining a function within a string or its later evaluation.

IE..

10 INPUT A
20 INPUT B
30 INPUT X
40 LET Z$="A*B/SIN X"
50 PRINT VAL Z$

Functioned defined within Z$ and evaluated in line 50 using the variables previously input and if the program is written in what was used to be termed the "call and fall" manner then I can't see where the GOTO etc fits in?

Or are you meaning a defined funtion pointing to a jump to a line number?
CBM BASIC V2 can't do string functions for sure, but this:

Code: Select all

  0 DEF FN A(X) = X * X
100 PRINT FN A(10)
200 PRINT FN A(20)
300 PRINT FN A(30)
400 A=FN A(11)
500 PRINT A
Regards,

Shaun.

Crayon21
Posts: 64
Joined: Sun Nov 04, 2018 2:33 am

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

Post by Crayon21 » Sun Feb 03, 2019 11:37 pm

have not posted in a while, forgot I was even still here, thought they had forgot about me. hope the rams win SB LIII :D
zx81: great yet flawed
Zx spectrum: masterpiece that keeps on giving

(wish it weren't so expensive) :o

Post Reply