A simple model Forth system
Bill Muench

NEW 20110908 — eForth for GreenArrays, Inc GA144
download — eF22a-dev.zip (865KB) MD5: 1cfe27708659eb6f3888adae02a75297

I wrote eForth so that it would be easier for me to develop Forth systems for many processors. Processors included 56000, 6502, 68332, 68HC11, 8051, 8080, 80C166, 80C196, 80x86, RTX2000, RTX2001, RTX2010, SC32, StrongARM, TMS320, Z80, and I may have forgotten some.

eForth allows me to make a complete Forth system with about 30 very simple machine code routines. With so few words to code, I could do the coding by hand, that is, without the need to write an assembler first. After this simple model is running, it is desirable to code much of the rest in assembly.

C. H. Ting asked if I would make a MASM version. Dan Kelly embedded the MASM version in a large commercial CAD project written in "C" to aid in debugging. I have never used the MASM version for my own work.

The name eForth possible came from: educational Forth, experimental Forth, easy Forth, or the fact that "e" was next letter in the alphabet of unused Forth system names.

All the information provided remains as it was, several years ago, a work in progress ( a work that is now suspended indefinitely ). If you have comments or wish to extend any of this sparse documentation, please send it to smile and include the word "eForth" in your email subject line.

EFORTH.X86 - eForth source
A simple Forth system for DOS, mostly written in hilevel Forth. eForth should be considered a model, not a working Forth development system. This eForth includes: a cooperative multitasker and CREATE...DOES>.
Next to the stack notes, provided for each Forth word, will be an ANS reference number in the form 0.0.0000 and the Boot Firmware byte code in the form 0x00, where applicable.
EMETA.X86 - eForth MetaCompiler
The MetaCompiler used to generate eForth. At this point I think this metacompiler is almost an ANS complient program. (I have not been actively programming in Forth for a few years.)
The final step in the transformation of the metacompiler to an ANS complient program was making sure the metacompiler kept control of all aspects of the compiling process. The most difficult step was dealing with number conversion, and looking back, was a very easy solution.
In a normal compiler input is looked up in the dictionary, if a word is found its token is compiled. If a word is not found, the first attempt is to convert the text to a number, failing valid number conversion, an error is reported saying that the word cannot be found. Since there is no standard way to change the action of a host Forth compiler, metacompilers have typically complex workarounds to trap number conversion.
In this metacompiler the process is similar, except that number conversion is not a default action. That is, number conversion is specifically requested. All numbers must be preceeded with a word that tells the metacomplier a number is following. These specifiers not only convert single or double numbers, but also store them with the correct number of bits for the target system and allow a local radix change.
Number conversion specifiers
D# ( n|d -- ) decimal
H# ( n|d -- ) hex
EMETA.X86  is written to be run with the DOS executable  B.EXE  which is included in the zipped file  E4.ZIP  .  B.EXE  is short for bForth, the system I used for writing turnkey field research applications, it is not available in source form.
To compile the metacompiler on a Forth other then bForth, a number of changes must be made. The ones I can think of now are: file handling and if the word  NUMBER?  If it does not exist in your host, you could copy its source from the eForth source file or rewrite  X#  .
MC.BAT - MetaCcompiler batch file
Use  MC.BAT  to run the metacompiler.  MC.BAT  is a DOS batch file that runs bForth, starts a timer, loads the metacompiler, compiles eForth, and displays the elapsed time.
LIB.E4 - eForth extras library
Includes DO-LOOP, FOR-NEXT, CASE, DEFER, VALUE, double number extensions, and more.
TASK.E4 - eForth multitasker examples and extensions
Including channels and buffers by Michael B. Montvelishsky.
VOCS.E4 - eForth VOCABULARY structure
Includes VOCABULARY, ONLY, ALSO, ORDER built on top of ANS wordlists.
EFORTHO.X86 - eForth source optimized
The same word set as  EFORTH.X86  but many more routines coded in assembly.
LOCALS.B - local variables
Local variables written in hilevel Forth, tested on win32forth and bForth.
Be careful if you change this for eForth as it uses the return stack in implementation specific ways.
This software is provided for informational purposes only,
you assume all responsibility for any problems associated, or not, with its use.
EFORTH.ZIP - eForth archive
Includes all source, eForth, eMeta, and bForth.
Download  EFORTH.ZIP  (63,141 Bytes) for the complete package.

Copyright Bill Muench All rights reserved.
Permission is granted for non-commercial use, provided this notice is included.
Contact Bill Muench concerning commercial use.

Revised: 20110909
HTML hit counter - Quick-counter.net