Nakagawa’s Tiny Forth (web page) is very readable after google translate (from Japanese to English for example).
The same can be said of his clean C code of a Tiny Forth implementation.
I simply cleaned up some addressing with tagging, and made it Arduino compatible.
The big extension is to bring Arduino hardware functions into a new primitive list. Note that all the primitives are 3-character keywords.
I also added the light-weight protothreads, so that the Tiny Forth interpreter can run alongside hardware tasks.
Also the Forth dictionary can be saved in EEPROM and gets reloaded.
Here is an application of running TM1637 and two buttons for a chess clock. Arduino code:
The kicking of the second “thread” sits next to Serial.available() poll, not very intuitive, but concise.
The “GRN” and “BLE” are Forth dictionary, which was coded in pure Tiny Forth as
: GRN DUP 10 MOD 0 DSP 10 / 1 DSP ;
It display two digits (representing minutes) on position 0 and 1 of a Grove 4-digit display (https://wiki.seeedstudio.com/Grove-4-Digit_Display/)
The hardware thread runs “INI” Forth primitive on boot-up, which can start the whole application.
May the Forth be with you