JForth Introduction


Introduction to JForth

JForth is a programming language that allows you to interact with your Amiga.
When you are programming in JForth, you are "inside" the language.
You can access any data structure, test any routine, or use any development tool, right from the keyboard.
This direct communication with the computer can improve your productivity, giving you additional time to improve the quality of your software products.

JForth is based on the 1983 standard Forth language. Forth was first conceived by Charles Moore when he wanted a new language for controlling telescopes.
He developed a language based on a dictionary of words.
This dictionary can be extended by writing new words based on the old ones.
Since Mr. Moore's original version, Forth has been translated to almost every type of computer from the biggest mainframes to the smallest microcomputers.

Since a minimal Forth can be implemented in just a few kilobytes of memory, it is often used in very small embedded computer systems for process control and robotics.
Forth, however, is equally appropriate for larger, more advanced, computers like the Amiga.
Forth is a very flexible language and can be adapted to larger computers without losing the flavor of the original language.

JForth is an implementation of Forth designed specifically for the Commodore Amiga. JForth uses a 32-bit stack and compiles directly to 68000 machine code.
This makes JForth faster than most Forth’s.
JForth also provides an extensive set of tools for accessing the special features of the Amiga.
You can call any Amiga Library routine by name and reference any Amiga structure using constructs similar to 'C'.
JForth also has some special toolboxes that support simple graphics, Intuition menus, IFF files, and other Amiga features.

These toolboxes can be used directly to simplify your Amiga programming.
Source code for all these toolboxes is provided so you can customize them if needed or study them as examples of Amiga programming.
JForth also provides over a dozen small sample programs for those, like me, who learn best by example.

JForth also allows you to do things that are unique in the Forth experience, the most dramatic being CLONE.
This exceptional utility allows you to create a totally independent, standalone version of your program of minimal size that is entirely royalty free !

Major Functional Systems

For a full list of the tools that JForth offers, you should read the next chapter about the various files on the disks.
The systems mentioned here are ones that we feel are major ones not to be missed.

Amiga Library Calls

JForth provides a system for easily calling any Amiga Library routine by name.
It will figure out what 68000 registers the parameters go into and build the appropriate code.
Thus you can simply pass parameters on the stack in the order described in the Amiga documentation.
A number of toolboxes have been written for supporting specific parts of the Amiga Library including EZMENUS, Graphics, the Serial Device, ANSI codes, and much more.

Amiga Structure Support

JForth provides the equivalent to all of the ".h" include files from 'C'. These ".j" files define all of the necessary structures and constants for passing information to the Amiga Library routines.
Structures can be dumped interactively with all members shown by name and value for debugging by using DST.

ARexx Support

ARexx is a language that helps various applications communicate with each other.
A spread sheet program, for example, could communicate with a data base program.
These tools help you write ARexx compatible programs.


JForth support two 68000 assemblers, one with Reverse Polish Notation (RPN) and one with Motorola like syntax.
The RPN assembler can be used to create macros but the Motorola assembler is easier to read. We also offer a Disassembler.

Block Support and SCRED

For those who prefer the old fashioned BLOCK or SCREEN environment, we provide LIST, LOAD and the standard line editor.
We also provide a WYSIWYG SCREEN editor called SCRED. (We recommend the use of normal text files with JForth).


Clone can be used to generate small, royalty free, executable images of your JForth programs.
Clone will take a compiled JForth program, extract out all of the code and data needed to run it, and reassemble a smaller version of it.
All of the JForth development tools, the name fields and link fields and any other unused words are left behind.
The final image size is comparable to images created using a 'C' compiler and linker.
Images can be saved with a symbol table for use with WACK or other debuggers (if needed).
The JForth Source Level Debugger can also be used with Cloned programs.
Most programs will Clone without modification if they follow a few simple rules regarding run time initialization of variables or arrays containing Forth addresses.


JForth provides a source level debugger that allows you to single step through your code.
At every step you can see what is on the stack.
You can also examine the return stack, dump memory, set breakpoints, control execution, or even enter Forth commands.

Floating Point

JForth support both the single precision Fast Floating Point and the IEEE double precision.
These words conform to the Forth Vendors Group Standard.

IFF Support

JForth provides general purpose tools for reading and writing IFF files.
It also provides a toolbox specifically for ILBM graphics files.
This allows you to use pictures, brushes, anims and animbrushes from a paint program, or other source, in your programs.
JForth also provides tools for animation and presentation such as, blit, wipe, fade in, fade out, etc.
Powerful graphics and animation programs can be created using these tools.

Local Variables

Local variables can simplify the definition of complex words by eliminating much of the stack manipulation.
Local variables are fast self fetching variables that allow reentrant recursive code to be written.
Using regular VARIABLEs can make a word non reentrant.


JForth's precompiled modules provide a method for rapidly accessing code that is used during compilation.
This includes the Assemblers and Disassembler, and the Amiga include files.
These modules are dynamically linked into the dictionary when needed.
This way, they do not take up space in your normal dictionary, yet are instantly available.


This system allows you to switch easily between JForth and the major standards - FIG , '79 , and '83.
This is handy for compiling code written using other Forth’s.


ODE is an Object Oriented Development Environment similar in concept to SmallTalk.
It allows you to define classes of intelligent data structures, then create as many copies of these data structures as needed.
This technique can simplify programming immensely by making it easier to write reusable code.


This optimization tool monitors the operation of a program to find out where it is spending its time.
Most programs spend most of their time in a small portion of the code by identifying this code, one can focus efforts at optimization where they are most needed.


Textra is a powerful, yet easy to use, multi-window text editor designed for programmers.
It uses the mouse to select text and allows Cut, Copy and Paste, operations between its windows.
It also incorporates ARexx hooks that allows you to use provided macros (.textra files) for text processing (or write your own).
Textra can communicate with JForth such that you can compile directly from the editor.
If an error is encountered while compiling, Textra will highlight the error so the you can fix it quickly.

 © 1998 Martin Randall