GRAFORTH
Paul Lutus's compiled, Forth-like graphics language for the Apple II, published by Insoft in 1982, with 3-D wireframe animation, character graphics, turtle graphics and a built-in music synthesizer.
Created by Paul Lutus (published by Insoft)
GraFORTH (the name was usually printed with a lower-case “ra”) is a graphics programming language for the Apple II written by Paul Lutus, the author of Apple Writer, and published by the Portland, Oregon software house Insoft in 1982. It looks like Forth: there is a data stack, arithmetic is written in Reverse Polish Notation and programs are built by defining new “words”. Underneath, though, Lutus wrote it from scratch for one purpose, which was getting fast colour graphics out of a 1 MHz 6502. Every definition was compiled straight to 6502 machine code. The language came with high-resolution plotting, turtle graphics, scalable character fonts, real-time 3-D wireframe animation and a software music synthesizer for the Apple’s one-bit speaker.
History & Origins
Paul Lutus and Insoft
By the early 1980s Paul Lutus was one of the best-known independent Apple II programmers. He wrote from a self-built cabin in rural Oregon, and his word processor had been published by Apple as Apple Writer from 1979. Alongside that work he wrote a group of languages and tools for Insoft, a small company in Portland. They included the TransFORTH languages, the ALD System assembler and the two-voice music program Electric Duet.
GraFORTH’s manual calls these products a “family of languages” with the same Forth ancestry. TransFORTH ][ came first. It was a floating-point language aimed at scientific and business work. Its editor carries a 1981 copyright. GraFORTH came next and went the other way. It dropped floating point and used integers only, so that graphics would be fast. In exchange it added much more graphics than TransFORTH had. The manual sums up the trade-off: “TransFORTH has much more calculating ability, but less graphics, while just the opposite is true of GraFORTH.”
Dating GraFORTH
There are two dates in play, and they explain why some lists give 1981 and others 1982:
| Evidence | Date |
|---|---|
Start-up banner shown in the manual: GraFORTH ][ (C) 1981 P. Lutus | 1981 |
| Manual title page: “© 1982 INSOFT” and “© 1981 P. Lutus” | 1982 / 1981 |
| COMPUTE! issue 25 New Products announcement | June 1982 |
| Hardcore Computing 3.1 advertisement | December 1982 |
The program was evidently written in 1981. The earliest evidence of it on sale is from 1982, the year of the manual’s copyright and the first press announcement. This page uses 1982 as the release year. No 1981 advertisement or review has turned up to show an earlier release.
Design Philosophy
A graphics language first, a Forth second
The GraFORTH manual is open about how far it departs from standard Forth. It says that GraFORTH is “only loosely related” to other Forths. The general structure was “retained (at least outwardly), but the implementation of that structure is vastly different”. The reason it gives is that “the intended usage of GraFORTH is very different from that for which FORTH was originally designed.”
Three decisions follow from that:
- Compile to native code. The manual points out that most Apple languages of the time interpreted their code. That included both BASICs, UCSD Apple Pascal, Apple FORTRAN and most other Forths. GraFORTH instead compiles every word “directly to 6502 machine language”. Words can still be typed at the
Readyprompt and run immediately, so you keep the interactive feel of an interpreter. - Give up portability. GraFORTH and TransFORTH were “designed for the computer you own, the Apple”, and “no attempt has been made to create transportable code.”
- Fit into the Apple’s world. Standard Forths of the period usually kept source code in their own screens of disk blocks. GraFORTH used ordinary Apple DOS 3.3 commands and standard DOS text files for source code. Any text editor could be used, and files could be shared with other programs.
Speed over safety
Call-A.P.P.L.E.’s 1984 review describes GraFORTH as “an integer-only language, written with high speed program execution as one of the primary objectives”. It notes that the language “has very few error checking routines or diagnostics”. The manual has a section on the same trade-off, called “Speed and Flexibility vs. Error Checking”. Integers run from -32768 to +32767. Larger values wrap around, and division truncates, so 7 3 / gives 2.
Insoft’s flyer gave one speed figure: “Counting to 30,000 in GraFORTH takes less than three seconds.” That is the vendor’s own claim. It names no comparison language and gives no test program, and the hardware is just the stock 48K Apple II the product required. It should be read as advertising rather than as a benchmark.
Key Features
The Forth-style core
Programs are built from words, as in Forth. A colon definition compiles a new word into the “word library” (GraFORTH’s name for the dictionary). This example is from the manual’s tutorial:
| |
In the manual’s session, typing 25 31 SUM prints THE SUM IS 56. The manual’s control structures are IF-THEN, IF-ELSE-THEN, BEGIN-UNTIL, BEGIN-WHILE-REPEAT, a CASE:-THEN form and counted DO-LOOP loops written <end> <start> DO ... LOOP, which the manual compares to Applesoft’s FOR-NEXT. I and J give the inner and outer loop counters. Words can call themselves recursively. The system also supports strings, number bases other than decimal, overlays, calls to machine-language routines, and saving a finished program as a stand-alone system disk.
The manual’s turtle-graphics chapter defines a word that draws a square:
| |
Three “kinds” of graphics
The manual divides GraFORTH’s graphics into three groups and gives them science-fiction names.
Two-dimensional graphics (“Graphics of the First Kind”). The words PLOT, LINE and FILL work on the high-resolution screen. The Apple’s screen is 280×192, but the manual says GraFORTH uses only 256 points across, “for the sake of operating speed”, and that this narrower screen is one reason its line drawing is fast. UNPLOT and UNLINE remove what was drawn, and ORMODE and EXMODE control how new drawing combines with what is already on screen. Insoft’s advertising stressed that GraFORTH lines are drawn “much faster than in Basic” and that “colored lines are never broken”. The second point presumably refers to the gaps that the Apple’s colour-artifact display could leave in coloured lines.
| |
Turtle graphics come in a source file, TURTLE, which is compiled in with READ " TURTLE ". It adds MOVE, TURN, TURNTO and MOVETO. Angles are given in degrees, with zero pointing up.
Character graphics (“Graphics of the Second Kind”). Text is drawn on the graphics screen in upper and lower case and in several sizes and colours. Insoft supplied several fonts and a CHAREDITOR for designing new ones. Characters can also be grouped into multi-character blocks and “block printed” anywhere on the screen with PUTBLK. The demo disk uses this to animate an Insoft logo and helicopters built from character tiles.
Three-dimensional graphics (“Graphics of the Third Kind”). This was GraFORTH’s headline feature. Objects are wireframe models whose coordinates run from -128 to +127 on each axis. They can be rotated about any axis, scaled, translated and positioned on screen, with or without perspective. Insoft’s flyer says up to sixteen objects can be handled at once. For smooth animation, GraFORTH draws on one of the Apple’s two high-resolution pages while showing the other, then swaps them. Rotation angles are given in units of 1/256 of a turn, not degrees. The manual notes that an entry of 64 rotates an object to 90 degrees, so a quarter turn about the X axis is:
| |
Two tools on the disk build these objects. The IMAGEDITOR is an interactive 3-D model editor. PROFILE acts as a graphics “lathe”: it spins a 2-D outline into a solid of revolution, such as the chalice image supplied as a sample.
Music
The language has a software synthesizer that plays through the Apple II’s built-in speaker. It has two words. VOICE picks one of several tone shapes, either fixed duty cycles or notes that swell or die away. NOTE takes a pitch and a duration, each in the range 2 to 255. Larger pitch numbers give lower notes. The manual’s example plays an A two octaves below middle A:
| |
For two-part music the manual points users to Lutus’s separate Electric Duet program, also sold by Insoft.
System requirements
According to Insoft’s flyer, GraFORTH needed a 48K Apple ][ with DOS 3.3 and one disk drive. A 16K language card was optional. The disk came with a slightly modified DOS 3.3 that would load into a language card if one was present, which left more memory for programs. Programs saved as stand-alone systems needed that modified DOS to be on the disk.
Evolution
GraFORTH did not go through a public series of numbered versions. The product name and the start-up banner use the “][” suffix: the banner says “GraFORTH ][”, and an Insoft demo disk is titled “GraFORTH ][ Demonstration”. This followed the same naming as “TransFORTH ][” and refers to the Apple ][ rather than marking a second major release. TransFORTH, by contrast, continued with later editions such as TransFORTH ][B (1982) and a TransFORTH III listed on Insoft’s order form.
GraFORTH seems to have stayed in Insoft’s catalogue for several years. Its list price was $75 on Insoft’s own order form and in a March 1983 Call-A.P.P.L.E. dealer advertisement, and it was still $75 when Call-A.P.P.L.E. reviewed it in August 1984. No source found for this page records when Insoft stopped selling it.
Current Relevance
GraFORTH is a historical language. It was never ported to modern systems, has no open-source reimplementation, and has no Docker image. Even so, the original is easy to try. Copies of the GraFORTH disk, including a bit-level copy in the Internet Archive’s woz-a-day collection, run in any Apple II emulator. The scanned manual, Insoft’s promotional flyers and the period reviews are also preserved there.
Why It Matters
GraFORTH is an early example of a domain-specific language for home-computer graphics. Its manual says plainly that, although many programs and utilities used the Apple’s high-resolution colour graphics, “until now, no computer languages have been specifically created for the purpose of fully exploiting these features.”
It also shows how far Forth’s ideas could be stretched. Lutus kept the parts of Forth that made it fast and extensible on small machines: the stack, user-defined words and incremental compilation. He changed or threw away nearly everything else, including the block-based source storage and the usual interpreted implementation. The result was a language for games, education and animation rather than instrument control. Reviewers in 1983 and 1984 still described it as remarkable for 3-D animation on an 8-bit machine.
Sources
- GraFORTH Language Manual (Insoft, © 1982; program © 1981 P. Lutus), scanned on the Internet Archive as
graforth1andgraforth2 - TransFORTH ][B Reference Manual (Insoft, © 1982), for the family history and the comparison with GraFORTH
- Insoft promotional flyers and order form (Internet Archive,
promotional-flyers-from-insoft) - “Insoft Announces GraFORTH: An Apple II Graphics Language”, COMPUTE! issue 25, June 1982, p. 185
- Insoft advertisement, Hardcore Computing 3.1, December 1982
- Tom Flynn, GraFORTH review, SoftSide #45, November 1983, pp. 79 ff.
- Jeff Harper, “GraFORTH” review, Call-A.P.P.L.E., August 1984, pp. 49 ff.
Timeline
Notable Uses & Legacy
Insoft arcade games
Insoft published Apple II arcade games written in GraFORTH; the description accompanying one archived disk of Grapple, a galactic-jailbreak shooter distributed by Insoft (dated 1983 in one Internet Archive entry and 1982 in another, which credits Tony Lewis), calls it "the third game written in GraFORTH"
GraFORTH demonstration programs
The GraFORTH disk shipped with animated demos written in the language, including a helicopter sequence built from character-graphics blocks and a 3-D bat that flies past the moon, which SoftSide singled out as one of its most spectacular demonstrations
Practical 3-D Graphics (LOGIC user group)
Jim Usalcas's joystick-driven 3-D object editor, distributed on a disk by the Toronto Apple user group LOGIC, produced images compatible with GraFORTH; GraFORTH owners could also get a flicker-free 3-D turtle program from him