Tethered Forth for the STM8
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Alexander Shpilkin 43c9db5011
Add tests for unary instructions
1 year ago
.gitattributes Clean up and fix small bugs 2 years ago
.gitignore Add tracing to VM 1 year ago
DEDICATION Add description of project and CC0 dedication 2 years ago
NEWS Clean up and fix small bugs 2 years ago
README Implement echo in the monitor 2 years ago
assem.fth Fix wrong encoding of WFE 1 year ago
assem.txt Copyedit assembler documentation 1 year ago
atest.ans Add tests for unary instructions 1 year ago
atest.out Implement an STM8 assembler and resident monitor 2 years ago
connect.ans Clean up and fix small bugs 2 years ago
forth.c Implement stack manipulation primitives in VM 1 year ago
forth.h Implement stack manipulation primitives in VM 1 year ago
image.fth Implement an STM8 assembler and resident monitor 2 years ago
live.fth Implement echo in the monitor 2 years ago
monitor.ans Clean up and fix small bugs 2 years ago
notes.txt Implement an STM8 assembler and resident monitor 2 years ago
prims.c Implement a VM in C 1 year ago
prims.h Implement a VM in C 1 year ago
proto.fth Implement echo in the monitor 2 years ago
shim.ans Update brand string to reflect new name 1 year ago
tester.fth Use a test harness for assembler tests 1 year ago
where.fth Clean up and fix small bugs 2 years ago

README

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
are welcome.