viewtopic.php?t=11146
I understand that they took Basic 4 from the Pet 4032, stripped the disk commands out and put it in the Vic20 as Basic 2.0. That was then put in the c64. Then gfx commands were added for Basic 3.5/7, but critically it still only has 2 letter variable names,, no named proceedures/functions, and slow seq search for var names and goto targets. Bank switching made this even slower - a well thought out interpiler could have avoided some of that.Mike wrote: ↑Sat Nov 23, 2024 10:52 amAt that time, priorities were set to cram the most functionality into a given ROM size, possibly at the expense of speed. Often enough, also a quick 'time-to-market' took importance over everything else.orac81 wrote:One of those what-if's is whether commodore went the right direction after basic 2. The very early MS Basic offered a floating point interpreter that could run on a 4k altair 8080. But by the time of the 64 they still used the same primitive system, only 2 char var name, slow search for vars and goto targets, no proper int arithmetic, etc.
When it comes to scientific applications, you want to do stuff with float, an integer-only BASIC is completely unusable for that! Put the other way round, it's fairly easy to add integer variables for more compact storage on top of a float library, and that had been the design choice of MS BASIC then.
By this time there is the ram/rom for a better approach - you could tokenise long var/proceedure names on line entry, (or when run) giving fast access when used. Numeric constants can be tokenised.
At the time I dug around a bit in the Petspeed compiler, and it was very instructive. It could switch quickly between fast integer and float. It generated a fast single byte pcode for common vars/ops.
I do understand that commodore were tied to what Microsoft delivered. And of course its all moot, a what-if.
I know, but only the main basic keywords. Really i am talking about doing more work to partly compile other parts.
Not that I know of.In contrast, other systems (hp, atari 800, bbc, apple integer basic) took something closer to an "interpiler" approach.
Atari had a bog-standard interpreter, Apple Integer BASIC was somewhat faster but as implied, integer-only and thus out of question for serious stuff. Acorn actually had a very efficient interpreter indeed, developed in house, with later extremely fast re-incarnations on the Acorn Archimedes. However, it also had definitely a bigger ROM size (about 32K for BASIC and Acorn MOS combined) and ran on a 2 MHz 6502, so the comparison is somewhat skewed.
What HP BASIC are you actually referring to?
This is what you got from later versions of Acorn BBC BASIC, but ...A full version of that would be tokenising/resolving long var/proceedure names, constants, etc, (even tokenising as each line is typed), offering better structured features, generating something close to pcode.
... BASIC V3.5 and V7 also offered extensions for program structure - IF .. THEN .. ELSE, DO .. LOOP in both, BEGIN .. BEND to enable multi-line blocks within selection structures with V7, trap/error and event handling, the latter which required an own runtime stack instead of sharing that with other stuff on the 65xx hardware stack, which would have made it unfeasible to unwind the stack.That would have been the thing to fix before implementing those other gfx features in basic 3.5/7.
To note, even BASIC V2 already tokenizes the program lines as they are stored in program memory.
Atari 6502 basic does a much more complete tokenisation of lines on entry, but they messed up other aspects so overall it doesn't run very fast.
I am not really criticising gfx features as such, but I believe the internal working of that Basic needed fixing before adding more features. By the time of the +4/128 they had 5-7 years from the original pet basic, a team would have had time to work on it.If you point to the graphics commands as criticism, the question remains whether any of the 8-bit BASICs would have provided enough performance to do anything like real-time vector graphics. The graphics commands were included so people could do graphics in the supplied high-level language without the need to wrap their brains around machine code to draw things at least at a bearable speed. Nothing more. What you can expect then is something like VICtoria did for the map display, where a selection of empires is drawn from predefined shapes.
...
Further discussion about "what ifs?" in design decisions that had be made in those times and then led to the language implementations we got then should probably go into a new thread in either the General or Programming section.
As I said, I did start trying to write an interpiler (just in C) that could actually do all this, even with a database storage structure working as each line is entered. Or the program could just compile when run, like a more normal compiler, which does have advantages.