An unnamed Forth project for the STM8
The C compilers for the STM8 are rather bad, and no wonder, given that it
is essentially an old-style accumulator architecture completely unsuitable
for modern register allocators. I was asked by one of my friends to
to review the situation and thought it would be interesting to change the
problem and implement a (tethered) Forth for it. This is the record of
that effort, but it might also end up bringing together other related
pieces of code I have lying around. I currently assume an STM8S-DISCOVERY
board whenever necessary, the generalization will come later.
The files here are dedicated to the public domain, or failing that
permissively licensed. See the DEDICATION for details.
Getting it running
The one thing you can currently do is assemble things into the RAM of a
live STM8S-DISCOVERY board over a serial connection. Run `monitor.ans`
under an ANS Forth system, save the output into an Intel HEX file and
program it onto the board (using stm8flash or what have you). Connect its
UART2 to your computer, then read through and run `connect.ans`, modifying
it as needed. Your assembly language routines can jump to 8080 hex to
return back to the monitor loop.
Offline assembly is also possible; use `monitor.ans` as a model. Aside
from Intel HEX (generated from the current memory image by `IHEX`), the
Motorola S-record format is also supported through the word `SREC`.
The monitor itself is a variation on Sergeant's "3-instruction Forth" for
the 68HC11 and is 57 bytes long. I do not see how it could be made
shorter (even at the cost of changing the protocol), but any suggestions