[comp.lang.forth] small generic Forth for the 68k family

rob@idacom.uucp (Rob Chapman) (01/07/90)

I've just ported bot-Forth to the 68k with the intent of using it on the 020
as well.  I consider the kernel PD since a lot of the good ideas in it are
PD as well.  Some of the features that have been incorporated specifically
for the 68k:
	- subroutine threaded for speed
	- immediate assembler words so that they may be intermixed with Forth
	- calls and memory access are bounced off a 'page' register so that
	  the code is totally relocatable anywhere in memory just by changing
	  the page register.
	- 16 bit data stack for speed but 32 bit return stack so that calls
	  may be returned from anywhere in memory.
	- top two data stack items are in data registers for speed
	- FOR NEXT loop index is in data register for speed
	- inlining of definitions less than n (currently 5) words
	- some optimizations done on:
		- subroutine calls to less than 128 bytes away
		- literals smaller that +-128
		- EXITs convert previous call into a jump
		- phrase optimizer is in the works; but only if it is simple
	- metacompiler, mini-assembler and kernel all in approx 600 lines
	  and it compiles to less than 10k
	- NO FORWARD referencing; everything is built from the basic operators:
	  stack manipulation, math/logic and memory access.

A brief history of bot-Forth:
bot-Forth is built on the philosophy, "It's so simple, it has to work.".  It
originated on the RTX2000 and has been ported to the 8051, the RTX2001A (real
tough) and now the 68k family.  Future ports might include the National HPC
and maybe an Intel processor.  bot-Forth is a small kernel built for solving
real-time problems.  We've already built and sold a datacom product with it.
bot-Forth draws some of its origins from fig-Forth, cmForth and a lot from
late night tinkering.

A look inside:
The kernel is connected to the outside world through 2 QUEUEs: emitq and keyq
(some might call this streaming using current jargon).  The other end of the
queues are usually connected to a UART but may be data-vectored (as opposed
to control-vectored via deferred words) to other sources.  A simple multitasker
based on QUEUEs and the Forth concept of words, allows for several different
code threads to be running.  The traditional QUERY INTERPRET has been replaced
by a key COLLECTOR which invokes INTERPRET once it has collected enough keys.
The metacompiler is very simple (thank goodness), and it has been used for
metacompiling as well cross compiling to other cpus.

Thats enough blabbing for now.  If you wish a copy of the kernel as it currently
exists let me know.  The only method that I know of would be to post it to the
net.  If you use it, I only ask one thing: don't complicate it, and if you can
simplify it, let me know what you did so that I may benifit as well.

rob@idacom