Speed of Forth vs. BASIC on C64

Topics relating to various Forth models on the 6502, 65816, and related microprocessors and microcontrollers.
kc5tja
Posts: 1706
Joined: 04 Jan 2003

Re: Speed of Forth vs. BASIC on C64

Post by kc5tja »

JimBoyd wrote:
As my previous post hinted, Forth has one more advantage over BASIC, the use of low level code. Once the logic of a program is tested, the slower parts ( like inner loops ) can be rewritten as CODE words. A code definition gets compiled to the same dictionary as high level words, at least on the C64 Forths I've seen ( including my own Fleet Forth .) The entire dictionary can be saved to disk as a new Forth with a single command. In Fleet Forth it is FSAVE. In Blazin' Forth it is SAVE-FORTH. In BASIC, someone can still use low level code with the SYS and USR commands, but then has to decide where to put it and usually manage the loading and saving of the low level code separate from the BASIC code.
We need to be specific here; Acorn BBC BASIC also lets you use inline assembly, and by all accounts, seems to be more powerful than most Forth assemblers I've seen.
whartung
Posts: 1004
Joined: 13 Dec 2003

Re: Speed of Forth vs. BASIC on C64

Post by whartung »

kc5tja wrote:
We need to be specific here; Acorn BBC BASIC also lets you use inline assembly, and by all accounts, seems to be more powerful than most Forth assemblers I've seen.
Actually, no we don't have to be specific. BBC BASIC seems to be an outlier of the large array of BASIC implementations, especially BASICs on micros. In contrast, the statements about Forth (especially micro Forths) are widely supported. Yet there are certainly examples of Forth that did not have such a facility.

So saying "Forth has one more advantage over BASIC, the use of low level code" as a broad, general statement is perfectly valid.

And the assembler in BBC basic doesn't address the high level extensibility of Forth as particularly manifest by the existent of Forth assemblers. FIG-Forth, as an example, does NOT come with an assembler. It starts as an assembly source file, that compiled in to an operating Forth system. But it's quite possible, without access to the original FIG assembly source listing, to create a first class assembler in Forth, in to something that one would be hard pressed to discern was not "built in" to the system.

This first class extensibility of Forth is vastly different from BASIC in the large, and BBC BASIC specifically. However good the assembler in BBC BASIC is, that's as good as it's going to get. It can't be readily augmented, it can't be readily replaced, it can't be anything. Not by the end user, at least. You get what you get since you can not recreate BBC BASIC readily yourself. The extensibility of BASICs in general is quite limited in comparison to Forth.
kc5tja
Posts: 1706
Joined: 04 Jan 2003

Re: Speed of Forth vs. BASIC on C64

Post by kc5tja »

I'm very well versed in Forth, having implemented several dialects myself over the years and having personal interactions with a number of significant members of the Forth community, including Moore, Dr. Ting, and others. I'm a regular contributor to the Silicon Valley Forth Interest Group, where my talks are frequently uploaded via Youtube. You can also search this forum for my nickname and my conversations with GARTHWILSON to see how steeped in Forth I am. It is my preferred programming language and programming environment, even today.

I understand that your scope of context was the majority of BASIC-hosting microcomputers. My aim was not to be confrontational, but to enlighten: not all BASIC systems were so crippled as the thesis of the paragraph I quoted implied.
JimBoyd
Posts: 931
Joined: 05 May 2017

Re: Speed of Forth vs. BASIC on C64

Post by JimBoyd »

kc5tja wrote:
We need to be specific here; Acorn BBC BASIC also lets you use inline assembly, and by all accounts, seems to be more powerful than most Forth assemblers I've seen.
Huh? I thought "Speed of Forth vs. BASIC on C64" was pretty specific.
Quote:
not all BASIC systems were so crippled as the thesis of the paragraph I quoted implied.
Again, I thought we were discussing the Commodore 64.

Oh wait, I see my mistake. I inadvertently caused topic drift. This:
Quote:
Different Forths for the 65XX with the same threading could have vastly different speeds depending on the ratio of primitives ( and which words are primitives ) in each kernel.
Should have been this:
Quote:
Different Forths for the C64 with the same threading could have vastly different speeds depending on the ratio of primitives ( and which words are primitives ) in each kernel.
JimBoyd
Posts: 931
Joined: 05 May 2017

Re: Speed of Forth vs. BASIC on C64

Post by JimBoyd »


Before I get flamed for this, keep in mind this thread has been dormant for over three years. [It's actually over four. I was thinking about this last year.]

Code: Select all

$400 CONSTANT SCREEN
#1000 CONSTANT SCREEN-SIZE
1 CONSTANT A-CODE
: DOIT
   SCREEN SCREEN-SIZE A-CODE FILL ;

1 is the screen code for the PETSCII character 'A'.
Post Reply