Dec 082017
FORTHCOM is the Forth language compiler for computers running MS-DOS.
File FORTHCOM.ZIP from The Programmer’s Corner in
Category Forth Source Code
FORTHCOM is the Forth language compiler for computers running MS-DOS.
File Name File Size Zip Size Zip Type
4C.COM 31440 16775 deflated
BYTEBNCH.4TH 543 262 deflated
COPIES.4TH 5754 2386 deflated
DEFINING.4TH 4064 1294 deflated
DEMO.4TH 4731 2145 deflated
DISPLAY1.4TH 1395 762 deflated
DISPLAY2.4TH 4028 1580 deflated
DOS1.4TH 1055 529 deflated
DOS2.4TH 4918 1653 deflated
DOSGO.SCR 3072 727 deflated
DRIVER.4TH 7447 2715 deflated
ENSCREEN.4TH 4882 1960 deflated
EXEC.4TH 1588 721 deflated
EXEGO.SCR 2048 635 deflated
FARMEM1.4TH 509 289 deflated
FARMEM2.4TH 1280 520 deflated
FFIND.4TH 5755 2184 deflated
FILTER.4TH 5291 2155 deflated
FIND.4TH 6010 2337 deflated
FORTHLIB.SCR 11264 2535 deflated
HANOI.4TH 4214 1359 deflated
HANOIMT.4TH 8125 2977 deflated
IAGEBNCH.4TH 738 373 deflated
INDEX.4TH 1541 841 deflated
INTERUPT.4TH 2951 1292 deflated
INTS.4TH 843 476 deflated
KBDR.4TH 2021 908 deflated
LIFE.4TH 3775 1626 deflated
LIST.4TH 1615 849 deflated
MULTI.4TH 11098 3857 deflated
MULTID.4TH 15069 4972 deflated
QUEENS.4TH 1541 683 deflated
READ.ME 11792 4378 deflated
ROMGO.4TH 3173 1447 deflated
SCRDIF.4TH 3523 1528 deflated
STRINGS1.4TH 1190 611 deflated
STRINGS2.4TH 3614 1244 deflated
TAIL.4TH 4704 1905 deflated
TR.4TH 12185 4587 deflated
UNIQ.4TH 4118 1645 deflated
UNLOAD.4TH 2773 1310 deflated
UNSCREEN.4TH 1357 751 deflated
VARS.4TH 208 155 deflated
WC.4TH 6034 2469 deflated
WC.COM 2816 1703 deflated

Download File FORTHCOM.ZIP Here

Contents of the READ.ME file


FORTHCOM is the Forth language compiler for computers running MS-DOS.
Features of FORTHCOM:

Compiles Forth into machine code -- not interpreted.

FORTHCOM is written in Forth so that Forth code can be executed
during compilation, as is customary in Forth applications.

Very fast -- FORTHCOM compiles Forth code into an executable file
in a single pass.

Generated code is extremely compact. Over 100 Forth "primitives"
are compiled in-line. FORTHCOM performs constant expression
folding, strength reduction, register optimization, DO...LOOP
optimization, tail recursion, and various "peephole"

Built-in assembler.

Libraries are in source format.

FORTHCOM supports many memory models, none big, but several not
often found in compilers:
Single segment COM file, fixed at 64k bytes
As above, but minimized segment size for TSRs
Separate code and data segment EXE file
Device driver SYS format
Romable program, uninitialized ram
Romable program, data ram initialized from rom image
Any of the above can have a separate stack segment for
return and parameter stacks

Functions exist for allocating memory in additional segments, or
allocating arrays on the stack, to handle programs with large
data memory requirements.

Library support:
The 83 Forth standard, except for functions that do not make
sense in a compiled environment.
Many additional words that are non-standard but widely
accepted, such as SKIP SCAN NIP and TUCK.
Direct Display Writing library for fast display of text in
color, and positioned on screen. For IBM-PC compatibles.
Multitasker with message passing facility and timed sleeps.
Library to support writing "Filter" programs.
MS-DOS file interface, compatible with LMI Forths.
String support, compatible with LMI Forths.
Forth Vendor standard software floating point (for customers
of LMI Forth).

The History of FORTHCOM

FORTHCOM started as a project to selectively compile colon definitions
as code words in figForth back in 1982. I bundled this Native Code
Compiler with a Z-80 (tm Zilog) fig Forth I sold for embedded system
use at that time. Ray Duncan of Laboratory Microsystems was interested
in this product, and I ported it to LMI's Z-80 Forth for sale with his
Forth environment.

The Native Code Compiler was translated to the 8088 processor, and
more recently to the 80386. It still comes bundled with LMI's Forth

In 1984 I became interested in the idea of a Forth compiler that would
compile entire applications into machine code rather than selected
colon definitions. Such a compiler would be capable of many additional
optimizations not available in a mixed system. Thus CFORTH, as it was
called, was born. The original version was for the Z-80, but a
Microsoft MS-DOS version was soon to follow. Laboratory Microsystems
sold CFORTH until roughly 1987 when it was removed from their catalog.
My feeling was that CFORTH simply wasn't understood, and that the wide
distribution of the reincarnated version, FORTHCOM will have greater

I renamed the compiler to avoid confusion with C-Forth (Forth in C)
that has been available for the past few years.

FORTHCOM does have a few changes from the CFORTH predecessor. Unlike
other compilers which seem to make application size grow with each new

release, FORTHCOM programs take less memory than they did when
compiled with CFORTH. The startup code has been enhanced, and I've
added new optimizations for several common situations. I also made
changes to make FORTHCOM run in Microsoft Windows, and under DOS 5.0.
I improved the way romable applications can be built, and added a new
memory model to allow creation of DOS device drivers (SYS files). In
total, I have devoted over 100 hours of effort into improving

When CFORTH was sold, it ran faster than C compilers, and created
executables that were far smaller and faster. C compiler technology is
catching up; for instance the most recent versions of Microsoft and
Borland Cs allow passing arguments in registers, something that CFORTH
did back in 1984. But the C compilers have gotten much bigger and
slower over the years. FORTHCOM still runs fine on a machine without a
hard disk. The compiler is only about 32k bytes long.

FORTHCOM is "Shareware"

Forth is one of very few programming languages whose adherents tend to
feel that their compilers should be free. Unfortunately this has
doomed the language to a second rate status because nobody can make a
living selling Forth tools. I have realized that myself, having only
made enough money to pay for my computer systems over the years with

There does seem to be quite a market for Forth books and manuals, as
all of this free software does seem to be rather poorly documented. I
am taking a novel approach in distributing FORTHCOM. This archive file
contains all FORTHCOM libraries (with one exception -- software
floating point) and all demo programs. But there is no documentation!
Also some files used for compatibility with LMI Forths have been

To evaluate FORTHCOM, place all the files in one directory and compile
some of the sample programs. The program DEMO.4TH is well enough
documented to give you a good start in writing your own FORTHCOM
programs. Use DEBUG to examine the generated code -- you will find it
is quite good, often combining sequences of Forth primitives into a
single machine instruction.

If you like what you see, you can register your copy of FORTHCOM and
obtain the users' manual (113 page, 28,500 word, laser printed) and a
disk with the latest version for $50.00. Send a personal check or
money order; I do not accept COD orders or credit cards, but I do ship
quickly without waiting for checks to clear. Customers outside the US
please remit in US funds $60.00 to cover the additional shipping
costs. Please specify floppy disk size and capacity.

I'm a hungry guy, so please register within 30 days. I won't be
pleased if you distribute an application using FORTHCOM without first
registering. (It's also a copyright violation).

If you own a copy of any Laboratory Microsystems (LMI) Forth with
software floating point, send a photocopy of the first page of the
software floating point section of the manual with your order and
receive a disk containing software floating point for FORTHCOM at no
additional charge.

Mail your order to:

Tom Almy
17830 SW Shasta Trail
Tualatin, OR 97062


I've had several ideas in the wings these past few years. If FORTHCOM
is a success this year (1992), I will probably produce a new version.
Most of these concepts are tried; it is just a matter of tying them

Change in underlying Forth, and better use of memory, will give a
20% or better speed improvement while increasing the compiler
A simple macro facility
Intrinsic dynamically allocated arrays
80x87 floating point support (this is a very fast and accurate
Improved optimization of return stack and registers

Distributed Files

Here is a brief description of the distribution files:

The heart of the matter:
4c.ico Icon for Microsoft Windows 3.x
4c.pif PIF file for Microsoft Windows 3.x
readme.doc This file The compiler executable

Library files:

display1.4th Fast direct display output
display2.4th Second part of above
dos1.4th File I/O
dos2.4th Second part of above
dosgo.scr Initialization code, COM format
exec.4th EXEC function (DOS shell)
exego.scr Initialization code, EXE format
farmem1.4th "Far" memory allocation
farmem2.4th Second part of above
filter.4th Used to write "filter" type programs
forthlib.scr Basic library
ints.4th Used for writing interrupt handlers
multi.4th Multitasker
multid.4th Multitasker with direct display output
romgo.4th Example initialization code, ROM format
strings1.4th String functions
strings2.4th Second part of above
vars.4th 83 Standard variables

Demo and utility programs:

bytebnch.4th The old Byte Magazine sieve benchmark
copies.4th Merges screen files
defining.4th Examples of defining word usage
demo.4th Generic Demo -- read this first
driver.4th Example device driver
enscreen.4th Convert ASCII to screen file
ffind.4th Search for string in screen files
find.4th Search for string in ASCII files
hanoi.4th Tower of Hanoi Puzzle
hanoimt.4th Multitasking Tower of Hanoi (read before
iagebnch.4th Interface Age Magazine benchmark
index.4th List first line of each screen in screen file
interupt.4th Example of interrupt handling
kbdr.4th Example TSR to exchange CapsLock and Ctrl keys
life.4th Conway's Life
list.4th List a screen file
queens.4th Solves Eight Queens puzzle
scrdif.4th Compares two screen files
tail.4th List first/last n lines/characters of a file
tr.4th Translate characters in a file

uniq.4th Find/delete duplicate lines in a file
unload.4th Convert COM to HEX format
unscreen.4th Convert screen file to ASCII file
wc.4th Count words/lines/pages in a file

Limited Warranty

When registered, Thomas Almy warrants the floppy disk and manual to be
free of defects in material and workmanship for 90 days from date of

Thomas Almy makes no warranty, either expressed or implied, with
respect to the use of FORTHCOM or any of the utility and demo programs
supplied. You, the user, are expected to evaluate the software for
appropriateness before registration. Thomas Almy is under no
circumstances liable for consequential damages or related expenses. In
any case liability is limited to the registration cost of FORTHCOM.

 December 8, 2017  Add comments

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>