P2CCForth Another Forth written in C
If you want to know more, there is a PDF in the ZIP. This text contains also a comparison to Taqoz. Also it intents to describe the internals of P2CCForth. This might be interesting, even if you don’t intend to use P2CCForth.
So why would we need another Forth?
There have been some main reasons for me to create CCForth:
• We already have got Taqoz, which is a very impressive Forth, hand-optimized for P2, compact, complete and fast. But it lives in it’s own world, completely separate from what has evolved over the last years. For example, it might be interesting to combine a Forth with an USB-driver or HDMI output, or any other code from Obex. Forth can be seen as a fast scripting language. And/or a mighty communication protocol.
• It would be nice to have the same Forth, or nearly the same one for different microcontrollers. This Forth is written in C, so we can hope, that it will be not too difficult to port it to other 32bit controllers. To see if this is true, PicoCCForth.ino is included.
• This Forth provides some structural means, which make the implementation of some advanced features easy: cooperative multitasking, a help system, local variables, a "nice" source code editor.
• Last not least it has been said, that at some point, every Forth friend will want to do their own. So, this is my first take. From Scratch. 😊
Core Features of P2CCForth:
• 32bit.
• Can access all HUB memory of P2
• Strings are handled C-style, ending with NULL.
• Can run “pause” style cooperative multitasking.
• Can run words in other cogs on P2.
• Uses a FAT file system on SD card to host a block file system. Also boots from SD card via _BOOT_P2.BIX.
• Uses large 32kByte blocks. The tiny 1k blocks of the past have been a main reason, that code was squeezed with scarce comments and was therefore not well readable. With the immense storage room of a SD card, there is no longer any need for this.
• Provides named local variables. Too many swap rot dup -rot drops have been the second reason for bad readability, so local variables come handy and still keep the code reentrant.
• Uses the dictionary as main database. There is a field for each word, which can hold a link to the source for fast access to the definition. Also there is a field which holds information about the type of the word. For example “repeat” is tagged as ISLOOP. These loop words are printed in red.
• You are free to add new words not only on the Forth side but also as “primitives”, written in C or it’s inline assembler, or even calling SPIN routines.
There is a lot of heritage in P2CCForth. I have read lots of papers about Forth and have been inspired by a lot of good ideas. A main influence has been Dr. Tings books describing F83 or his own cForth. https://sites.google.com/view/forth-books/home/forth-books/dr-tings-collection15 They have encouraged me to do the project.
At the time of writing, P2CCForth has a much lower number of words in comparison to Taqoz. I wanted to have a strong backbone of core elements. As a first application, I have begun to port FED, my editor from Taqoz to P2CCForth. At the moment FED begins to be sufficiently attractive to be used.
Before I decided to do this new Forth, I tried to bring one of the existing Forths written in C to P2. I gave up for different reasons. In some case, features of GnuC++ have been used, that do not exist for FlexC. In some case, they tried to cover too many different cases like 16...64bit machines.
When I had a working version of P2CCForth with FED, I wanted to try to port it to a different processor. I choose RPI Pico, because it makes sense to use a simpler lower cost board sometimes. I also choose to implement this in the Arduino environment, to bring this more easily over to other machines later. During the port I learned, that the ARM M0+ processor can only access aligned 32bit longs. So I had to add alignment and also I had to go to a 32 bit Flags fields from 8 bits only, which changed the structure of the dictionary.
I want to express, that I am very thankful for all the open sources and for all the help I get! Especially for Kiss boards, for FlexC, for the helpful people at the Parallax Forum!
FED editor for CCForth can use information in the dictionary for colouring. ^w will print the glossary entry of the word under the cursor.
Comments? Suggestions?
Have Fun!
Christof

Comments
@"Christof Eb."
I have just two comments.
1. I have downloaded the file and have not tried it yet but your news is great news (and that despite the fact that I have had rather unpleasant experience with the Arduino IDE recently) and
2. you will most probably be guilty of robbing me from a good night sleep tonight.
Cheers,
Maciek
ditto!
@"Christof Eb." ,
I'm struggling with the Arduino IDE trying to try your CCForth.
Could you please advise, which version of IDE and libraries you use ?
The one I try to use is a linux version of Arduino IDE v2.3.4 and the library used is Arduino Mbed OS RP2040 boards v4.2.4 but it throws an error while compiling your PicoCCForthF.ino file:
include <LittleFS.h>
compilation terminated.
exit status 1
Compilation error: LittleFS.h: No such file or directory
Most probably I am doing something utterly wrong or stupid but Arduino stuff is not my cup of tea at all. Thanks.
Cheers,
Maciek
@Maciek

Hi Maciek,
this was compiled with IDE 2.3.4 using:
@"Christof Eb." ,
Thank you. Looks like this particular library is not available for Linux version of the Arduino IDE 2.3.4. (not true, my assumption was wrong)
Selecting a Raspberry Pi Pico board in Board Manager and an option All for the Type only shows two libraries available: Arduino Mbed OS RP2040 boards v4.2.4 and the other one, which is deprecated , v.3.3.0.
I do not have a Windows based machine so a show stopper for me for now, which is a pity (also not true but I do not need one as it turns out which is good).
OK, my Arduino ignorance just got a bit smaller.
The required library got installed and the file compiled successfully.
Now on to find a Pico board I know I have somewhere . But there is progress...
So far so good. Now back to do some reading of the docs and the source code.
That'f for the Pico (rp2040).
Next thing would be to try it on a P2 (KISS board) once I properly install and configure FlexC.