PF11 -- An ANS Forth Implementation for the 68HC11

Andrew Sterian
Padnos School of Engineering
Grand Valley State University


Top-Level | Glossary | Compiler Design | Rationale | Notes
Version 1.0

July 18, 2003
Motivation | Why pForth | Other Solutions

Motivation

I was motivated to investigate Forth for the 68HC11 by noting how inefficient the edit-compile-link-download-test process was in a college class and as part of the GVSU Firefighting Robot team. We have been using BUFFALO on Axiom CMM-E9 development boards and the GNU GCC tools for the 68HC11 to develop programs in C. BUFFALO was effectively serving as nothing more than an S-record loader. To write a simple monitor to continuously display what bits were set in Port E, for example, required an investment in the edit-compile-link-download-test cycle. My goal was to replace BUFFALO+C with a single language that could do both: interactive manipulation of the hardware and program development.

I had used Forth as a student many years ago and was impressed by its elegance, its small size, and its ability to function well as both an interactive exploration language and a low-level program development language. I was convinced that my students would benefit from the higher level of interactivity, spending more time with the 68HC11 hardware and less time finding and fixing bugs in C code (that's reserved for other classes).

I investigated some existing Forth implementations for the 68HC11 (see below) but did not feel that any of them were exactly what I wanted. I decided to port an existing Forth implementation to the 68HC11, customizing it along the way. This process was also intended to be a good re-introduction to the language (and it was!) After settling upon pForth as the implementation to customize (why pForth? see below), the rest was just a natural development process, and the result is what you see here.

There are many "Forths" out there, each oriented towards a different target audience and operating environment. My main objectives were:
As a result of the above objectives, PF11 does not do as well along some dimensions as other solutions:

Why pForth

PF11 is a heavily modified version of pForth, a public domain Forth written in C. After looking at various Forth implementations, pForth was the one I chose as the basis for PF11 because it was:
The anti-pForth, for example, is gForth, the GNU implementation of Forth. Although gForth is an excellent tool and very useful for Forth work on modern computers, it is a very "big" Forth, with lots of features and doodads. I could not even begin to consider porting gForth to the 68HC11 due to gForth's size. But pForth seemed to be not-too-far from a 68HC11 implementation, and it turned out to be so. Still, pForth implemented a good part of the ANS standard, despite its simplicity.

Other Solutions

Why write another Forth for the 68HC11 when others were available? Here are some of the other solutions I looked at and some reasons behind why I rejected them.

tiny4th

Karl Lunt's tiny4th is a cross-compiler for the 68HC11 and 68HC12. It's a cross-compiler, hence relies upon additional assembly and a resident run-time engine but is interesting nonetheless because of its tiny footprint (less than 1K!)

68se4th

This is a subroutine-threaded implementation of eForth for the 68HC11, available from the eForth Academy, as are other variants. It is written in assembly language thus making it very difficult to understand and modify (at least for me).  It is also written in MASM format, which is a tool I do not have. I'm assuming it's an extremely tiny implementation due to having been written in assembly language.

hc11e4th

This is another pure-assembly implementation of eForth for the 68HC11 (no known home page -- do a Google search for it). As above, the pure-assembly approach gives a very small implementation (the author says 7k), but makes it hard to modify and extend.

FICL

FICL is a 32-bit Forth that is written in C and is ANS-compliant, much like pForth. In fact, had I come across FICL before pForth, I might have used FICL for my porting efforts.

pygmyForth

This is the Forth that is used on the FIG-UK 68HC11 boards. It is not free, hence was never really under consideration, but I mention it because the combination of pygmyForth on a 68HC11 board as provided by FIG-UK is exactly the development system combination that I was aiming for.


© 2003, Copyright by Andrew Sterian; All Rights Reserved. mailto: steriana@claymore.engineer.gvsu.edu