Sunday, April 27, 2014

Bare bones CForth

The F3 Gizmo includes a Forth line engine that I call CForth.  Its name is related to the fact that is a Forth like engine developed in C. CForth is machine independent. That way I could develop the engine without needing to use the ARM cross compiler nor needing to flash the STM32 F3 Discovery board.

The bare bones CForth is a simple CForth port that can be compiled in most 32 bit systems that provide a GCC compiler and the basic I/O LIBC functions. Currently I have tested it under MinGW on Windows XP and 7 and under Linux Ubuntu.
It should also compile in 64 bit operating systems but you could run into problems using CForth pointer operations.

As current win command windows don't support the ANSI escape sequences, I use Ansicon to create the console that runs CForth.

MinGW executable


The link below points to the executable MinGW CForth port. Just run the contained cforth.exe file.

 MinGW cforth executable v1.0(2014-04-27).zip

Upon start you should get into the CForth console:

CForth start on Ansicon
The CForth manual can be obtained from the reference below:

CForth Manual v1.0 (2014-04-20).pdf



CForth Sources

If you want to run CForth in other system different from windows you would need to compile from its sources. The link below points to the bare bones CForth sources:


You can also use the sources to expand the CForth built-in word dictionary using your own C functions. 
CForth is different from normal Forth implementatios because all its built-in words are created in C, not in Forth.
The information about how can it be done is on the included _CForth API.txt file.


CForth Limitations

CForth was never developed to run on a PC. It tragets medium size microcontrollers. The PC bare bones port was develop to ease the CFoth engine development as it doesn't neeed to access a real microcontroller. That's the reason why you don't get any file operation words. The only file operations that this port implements are the ones needed to create and read the userDict.bin file that is used to implement the SAVE and LOAD words.

13/5/2014 Update

The project is nowat Github:

https://github.com/R6500/MinGW_CForth

No comments:

Post a Comment