eForth

From Wiki
Jump to navigationJump to search

eForth, by C.H. Ting, is designed to be a highly portable Forth interpreter. It has very few core words actually written in assembly, so porting it to a new architecture is pretty straight forward. The problem with this is that on slower processors, such as the 8031, it's painfully slow to use.

Way back when, I wanted a usable Forth on the 8031, so I started converting eForth to straight assembly. In some areas, the degree of improvement is pretty remarkable. Converting UM* to assembly resulted in an incredible speed up. The test word of : TEST 0 20000 OR $FFFF $FFFF UM* 2DROP NEXT ; took 4 minutes and 6 seconds. The recoded version of UM* resulted in the word taking 5 seconds to execute.

I learned a good bit about Forth through this project, and had a lot of fun with it. There still exists one major problem, and that's the inability to store words that have been entered into some form of non-volatile storage. Modern Forths are either tethered, or have some NVRAM on the target. I didn't have that luxury at the time :) Instead, I'd develop words in the interpreter (at least where practical), move them into the source, assemble the source, then download it into the ROM emulator.

There was still some work to do to get this Forth where I wanted it, but I eventually ran out of time (or interest, I can't remember that far back), and moved on to other things.

To create the binary, MASM and LINK are required. I don't remember what versions where in use back in '91, and I haven't fired up MASM in at least 10 years, so I have no idea if modern versions will successfully assemble it or not.

The hardware to support this Forth is minimal. An 8031 (or 8051) with an 11.0592Mhz crystal, a serial port, and an 8K EPROM at address 0x0000 and an 8K RAM at address 0x6000 are all that are necessary to run it. The RAM can be easily relocated by changing the constants in the source.

Subversion Repository (username 'guest', password is empty)