history of FORTH

FORTH was the most unique and ingenious programming language ever invented. Interpreting and compiling are done by the same routine, a flag controls whether a FORTH word is executed (interpreted) or stored (compiled). FORTH has been implemented in 8 KB (eight kilobytes) of memory. In era of microcomputers, FORTH was ideal, and served as a interactive programming environment. Assembly language implementations (FIG-FORTH), amazingly, were coded partly in FORTH though written in assembler syntax.

FORTH is best suited to software that is tiny, and still remains useful for programming firmware. Postfix syntax of FORTH required as much diligence as assembly language requires. Yet programming in FORTH progresses to very high level code, by being based on words, top-level of a FORTH program will amazingly resemble English prose. FORTH provided an interactive programming system, I once fixed a buggy FORTH word while a programming was running.


FORTH documents

  • "FIG-FORTH internals"

    This document is based on notes I wrote while studying source code of FIG-FORTH. It describes how a FORTH interpreter executes internally, how interpreting and compiling are virtually the same operation, ingenious solutions used to assemble a FORTH interpreter.

  • "FORTH pictured numeric output"

    Brief document about FORTH syntax for printing numbers.

  • "interactively run Gforth inside emacs"

  • Byte Magazine Volume 05 Number 08 - The FORTH Language (August 1980)

    This is the famous FORTH issue of Byte Magazine.
    It has Charles Moore's article "THE EVOLUTION OF FORTH, AN UNUSUAL LANGUAGE".

  • "Masterminds of Programming: Conversations with the Creators of Major Programming Languages" ISBN-10: 0596515170

    Moore is interviewed in this book in which he discusses his unconventional views of programming.


my versions of FORTH

As an experiment, I ported 16-bit 8086 FIG-FORTH to 32-bit 80386 architecture from which I made three versions: PCDOS, PCDOS using DPMI within OS/2. For PCDOS version, I wrote my own 80386 protect-mode supervisor program.

To draw graphics using FORTH commands, I made bindings using EMX GCC to OS/2's Presentation Manager. The result was a unique program -- the only OS/2 PM program written in FORTH in existence.

screenshot of FORTH system  FORTH startup on OS/2 with a 64MB (megabyte) dictionary
screenshot of FORTH system  FORTH drawing a Moire pattern on OS/2
screenshot of FORTH system  FORTH drawing color spectrum on OS/2, editor showing src code


White Lightning FORTH by Oasis Software

full webpage: White Lightning FORTH by Oasis Software

Oasis Software's White Lightning was an amazing version of FORTH for developing games on Commodore 64 and ZX Spectrum.

White Lightning FORTH screenshot White Lightning FORTH screenshot
White Lightning FORTH screenshot White Lightning FORTH screenshot


HES VICFORTH

Ever try to write a (non-trivial) program in 1KB (1024 bytes) of memory? Certainly can't be done in C++. On a standard VIC-20 with 5KB, VICFORTH is left with only 1KB available for programs as FORTH dictionary. I bought HES VICFORTH, a cartridge, for a 13KB VIC-20 (5KB + 8KB expander) in ~1983. Compared to BASIC, FORTH was much faster, didn't exhaust memory, easy to crash, more difficult to program, yet was a far more powerful language.


commentary/opinion

positive:
FORTH code was small and fast, ideally suited to microcomputers.
Source code of FORTH compilers was tiny -- FORTH compilers generally had zero bugs.

negative:
FORTH was extremely difficult to program. Args had to be passed on stack ("stack juggling").