Computed Goto

4 posts / 0 new
Last post
DrZ
Offline
Last seen: 1 week 4 hours ago
Joined: Apr 22 2020 - 18:04
Posts: 12
Computed Goto

Hello Apple I users. 

 

After bringing up my Apple I replica again, i experimented with the Basic language.

i assumed it should be a very limited language due to 4k footprint.

 

I made an interesting observation:

 

Goto and gosub Statements allow expressions as arguments.

In the Apple Bssic Manual there is an example of computed GOTO as a result of evaluating a calculation A+B/2 

To my knowledge this is a very unique feature.

Especially since you can use that with the Gosub command too.

 

It allows complex statements  similar to the case switch in C language.

This feature was not present in Microsoft Basic and therefore missed for many years...

Above is a screenshot of a test program using that festure.

 

Remarkable and surprising after so many years - Thanks WOZ..

 

Dr.Z.

 

 

 

 

Offline
Last seen: 9 hours 5 min ago
Joined: Feb 27 2021 - 18:59
Posts: 27
Since the line labels of the

Since the line labels of the desired control points are unlikely to be an arithmetic function of anything, the more common Computed GOTO, as implemented in the original Dartmouth BASIC, took a sequence of labels:

GOTO A+B+1 OF 100,20,50

This would pass control to line 100 if A=B=0, to line 20 if exactly 1 of A or B equals 1, and to 50 if A=B=1.

Possibly you could try that syntax. Without the OF clause, using the feature is more cumbersome.

Offline
Last seen: 2 days 13 hours ago
Joined: Jul 5 2018 - 09:44
Posts: 503
In many ways Woz's INTBASIC

In many ways Woz's INTBASIC was superior to Microsoft's BASIC.  If Apple had added floating point to it and the graphic commands like AppleSoft had, the world might have been a different place.  It is possible that without AppleSoft the Apple ][+ wouldn't have been such a big seller and Apple would have been a much smaller player, but it is also possible that without the royalties from the sales of Apple ][+ and //e units that Microsoft would have been a much smaller player, never been able to get the IBM PC deal and the computer industry might not have been subjected to the past 40+ years of tyranny from the evil monopolists in Redmond.  But alas, such speculation is like wondering how the world would be different if Patton had been allowed to take out Stalin after WWII and we'd had no cold war or if we had aided the Nationalists in the Chinese civil war and Mao had lost and we'd had no Korean or Vietnam wars.  Coulda woulda shoulda.

But seriously, back on topic...  INTBASIC was great.  It is too bad Apple didn't do another one in house until Apple Business BASIC for the ///.  Unfortunately the ///'s difficulties made that one a non-player and Apple never recycled it for the //e or IIGS like they did ProDOS out of SOS.  It would have been awesome to have a truly great BASIC on the //e or IIGS back in the day.  AppleSoft worked, but it was kind of hackish and lacking in some features.

 

Offline
Last seen: 5 days 16 hours ago
Joined: Feb 11 2021 - 05:22
Posts: 30
I thought exactly the same

I thought exactly the same thing when I stumbled upon this a week ago when completely re-creating the Apple Basic manual. 

This is an awesome feature, especially when used for something like a jump table and similar stuff.

It really should have been in other basic dialects, too, as it certainly is not difficult to implement at all.

 

Log in or register to post comments