Friday, January 20, 2017

Building a 68000 Single Board Computer - Forth

Forth is an interesting programming language. It is an imperative, stack-based, language that the programmer extends by defining new commands. Years ago, I used an in-house developed variant of Forth (we called it Alice) for programming test software. It happened to run on 6809 and 68000 processors.

I looked for available implementations for the 68000 and found a few options. One, for example, was written for early Sun workstations that used 68000 series processors. This was in the 1980s when a Unix workstation with a few megabytes of RAM cost tens of thousands of dollars. I got it to assemble with only a few changes but it relies heavily on calls to the Unix operating system to perform i/o, and would not be easy to port to the TS2. It also looks a little too large for the TS2, wanting to have 96K of memory for storing Forth code.

The Easy68K web site has a copy of this version called eForth. Wrtiten by Bill Muench and C. H. Ting around 1990, this version was adapted by Paul R. Santa-Maria to run on the Motorola MC68000 Education Computer Board (ECB).

Both source code and a S record binary file are in the archive. The binary works perfectly on my TS2, since it is compatible with the ECB.

Here is a short sample session:

TUTOR  1.3 > GO 1000
PHYSICAL ADDRESS=00001000

eForth 68k v1.1
1 .S
 1
1 2 3 4 .S
 1 1 2 3 4
+ ok
.S
 1 1 2 7
* ok
.S
 1 1 14
0 32 DUMP
   0   0  0  4 44  0  0 81 46  0  0 80 30  0  0 80 3A  ___D___F___0___:
  10   0  0 8D E4  0  0 83 AC  0  0 83 B6  0  0 83 C0  ___d___,___6___@
  20   0  0 83 CA  0  0 8C BA  0  0 83 DE  0  0 83 E8  ___J___:___^___h ok
 ok

It should build using the VASM assembler with only a few trivial changes, but I didn't need to since it works "out of the box".

No comments: