A simple, indirect-threaded Forth, written in C; for target compiling; runs on Linux, BSD, OSX, and Cygwin
Switch branches/tags
Nothing to show
Clone or download
nimblemachines [s08] Improvements to (JS16) USB chat code
For the one S08JS16 user - me. :-(

I've cleaned up the code, renamed a few things that were misleading,
moved code around, and fixed a bug: it used to be that zero-length
writes would fail (hang). The chip would still be chatting - it doesn't
run off into the weeds - but it meant that my code for copying the host
stack to the target for remote execution of Forth code (stack>) would
fail if the host stack was empty.

I could have fixed this by preventing the host from initiating
zero-length writes (zero-length reads work fine) but instead I thought
I'd try to solve the problem at the root. It took six more bytes of
code.

Anyhoo. the code is now as tight as I think I can get it. And I finally
understand completely how it works - I'm not "guessing" about it any
more. (Or so I hope.)
Latest commit f315df9 Nov 15, 2018

README.md

What is muforth?

muforth is a small, simple, fast, indirect-threaded code (ITC) Forth intended for use as a cross-compiler for microcontrollers and other embedded devices. It is written in C and its core is very portable. Because of its Forth nature, it is naturally extensible, scriptable, and customizable.

It is very well-suited to interactive coding, debugging, and exploration, and is a great tool for bringing up new hardware.

It has support - in varying degrees of completeness - for the following architectures:

Why yet another Forth?

I initially wrote muforth because I wanted to try out some implementation ideas. Today there is very little that distinguishes muforth from fig-FORTH - but the differences go rather deep.

Its implementation is no longer the point. Its sole reason for existing is to be a cross/meta/target-compiler for other Forths, and their implementations are in no way tied to muforth's.

Starting points

BUILDING will tell you how to build muforth. It's stupid simple.

Sadly, there isn't a lot of documentation right now. A good place to start is to read the source. It's generally well-commented, and is intended to be read and understood. mu/startup.mu4 - which is read and executed every time muforth starts - is the heart of the system.

Look in mu/target/ to find a target that interests you. There is generally a mu/target//build.mu4 that loads the cross-build environment. Use it as an "index" to find the assembler, disassembler, meta-compiler, kernel, and other key pieces of code.

muforth.nimblemachines.com is also, finally, spreading its wings.

Above all, enjoy!