Classic Computer Magazine Archive COMPUTE! ISSUE 41 / OCTOBER 1983 / PAGE 154

VICFORTH From Human Engineered Software

Peter Busby

VICFORTH is an excellent cassette-based implementation of the Forth language for the Commodore VIC-20. Included in the sturdy 8K cartridge are such features as standard 16-line, 64-character-wide editing screens, many new Forth words (commands) that take advantage of the VIC-20 capabilities, ingenious automatic compensation for memory expansion and, best of all, the power to redefine fundamental Forth words.

A minor objection to VIC-FORTH – it cannot directly access the 3K memory expansion module. (Neither can BASIC when simultaneously expanded upward.) But without resorting to machine language, Forth can easily be persuaded to use the lower 3K RAM module for tables or even, with care, for dictionary space. This language is so flexible that it often presents several solutions to a problem.

Special Commands

On power-up or reset, VIC-FORTH signs on with a cyan display and green border, indicating the normal operating environment in which programs are run, words executed and perhaps defined, and peripherals interfaced. Five special words control the tape cassette: WRITE/WRITES saves screens to tape, READ/READS loads screens from tape and LOADS loads and compiles screen 1 from consecutive blocks on tape, maximizing RAM usage with the cassette as virtual memory.

Entering 1 EDIT shifts the format to the EDITOR vocabulary, displaying screen 1 on the top 16 lines with a six-line workspace below, all with a white background. The editor includes many commands for finding, moving and eliminating blocks of material on the screens. Seven commands are programmed to the function keys, and the cursor controls are revectored to the 64-character-wide screen which scrolls horizontally.

Pressing INSERT changes the border to yellow and places the editor in direct screen function, in which the material is normally written to the screen. RETURN then leaves the INSERT mode, and STOP/RESTORE returns to the reset environment. This raises a second objection: the first key entered after reset is usually flagged an error. The habit quickly forms of pressing RETURN after reset, which causes the VICFORTH prompt to be displayed, "OK".

Limitations And Enhancements

Error codes conform to the Forth Interest Group's specifications. The 12 errors are indicated by an arrow and a number, cross-referenced to the instruction manual. Full error messages could be displayed at the cost of some memory, as shown in the manual, since MESSAGE is one of 13 vectored words provided. Vectoring allows the user to easily change VICFORTH's I/O port interfacing to recognize, for instance, a new printer configuration at the user port.

Other standard fig-Forth definitions missing here are 20 disk-handling words and a few redundant or virtually defunct words. An experienced programmer, with the fig-Forth installation manual in hand, could revector VICFORTH to handle disks. Also, the monitor is missing, but by dropping the memory limit variable EM appropriately and calling the VIC-20 Kernal machine language LOAD, a monitor such as Micromon may be installed. A new word DUMP displays the contents of a range of memory in four-byte lines.

Indeed, any machine language program, the Kernal (Commodore's set of subroutines called from a table), and even the BASIC subroutines in ROM are easily accessed with the word SYS, which has an enormous advantage over BASIC'S SYS: the parameters for the accumulator, X and Y registers, and the carry flag can be passed back and forth (so to speak) – invaluable, as Forth often becomes very primitive in its operations.

About 50 words are added to fig-Forth, and many others are defined in the manual to access the VIC-20's features, including words for color and sound control, several predefined Kernal routines, and printer and user-port commands.

A third objection to Tom Zimmer's VICFORTH is the loss of Commodore's screen editor from the operating environment. With the VIC's BASIC editor, normally when RETURN is pressed the interpreter accepts what is on the display – what you see is what you get. In VICFORTH the sequence of keys pressed is acted upon regardless of the display: it is not possible to cursor into a previous line, correct or add to it and press RETURN to reexecute that line. This is partially compensated for by using the editing screens for defining and running procedures, but it seems a shame to lose that powerful interactive editor.

What about that favorite VIC-20 feature, programmable characters? As it happens, the editing screens almost coincide with the internal RAM required for redefining display characters. With straightforward manipulation, for instance, by moving the dictionary pointer the requisite amount (e.g., $1800 DP!) and, after compilation from the screens is complete, using the Kernal to load directly into that space, Greek, Katakana, or whatever characters desired may be made to appear.


Finally, the manual: HES provides exceptional documentation. The 80-page instruction book – though not a beginner's handbook – has enough examples and detail in it to clarify much of VICFORTH. An example of the breadth of this concept is the eight pages devoted to adjustments to the recommended Starting Forth, from the Forth Interest Group, upgrading that tutorial manual to the VICFORTH version. A slight irritation is the use of £ for the symbol # throughout; otherwise the manual does seem to be error-free and complete.

Forth is a fast – very fast – compact, interactive, flexible language, though more arcane than BASIC, perhaps, and including less simple string manipulation. When for the sake of speed or complexity it is necessary to program closer to the level of machine language, Forth's power becomes decisive. This cartridge from Human Engineered Software is by far the most exciting "peripheral" for my computer. VICFORTH could become the center of programming action on your VIC-20.

by Tom Zimmer
Human Engineered Software
71 Park Lane
Brisbane, CA 94005