Dec 072017
Martin Tracy's Zen Forth 1.15. Contains sample source code.
File ZEN15A.ZIP from The Programmer’s Corner in
Category Forth Source Code
Martin Tracy’s Zen Forth 1.15. Contains sample source code.
File Name File Size Zip Size Zip Type
CLOSURE.INC 1587 711 deflated
CLOSURE.SRC 1608 760 deflated
COMPILER.INC 16871 3890 deflated
COMPILER.SRC 9158 3005 deflated
CONSTANT.INC 2037 550 deflated
DEVICE.INC 10278 2541 deflated
DEVICE.SRC 7401 2343 deflated
FILES.INC 22720 5282 deflated
FILES.SRC 11935 4178 deflated
INPUTOUT.INC 11492 2897 deflated
INPUTOUT.SRC 7073 2389 deflated
OPTIONS.SRC 5654 1937 deflated
RUNTIME.INC 28025 5226 deflated
RUNTIME.SRC 20793 4610 deflated
USER.ASM 725 425 deflated
VARIABLE.INC 1156 295 deflated
XPRETER.INC 18699 4543 deflated
XPRETER.SRC 13133 4199 deflated
ZEN.ASM 2035 888 deflated
ZEN.DOC 7004 3123 deflated
ZEN.EXE 66384 8729 deflated
ZEN.SRC 2911 1002 deflated

Download File ZEN15A.ZIP Here

Contents of the ZEN.DOC file

ZEN-- a simple classical Forth

ZEN 1.15 is a model implementation of the ANS Forth Basis Document,
revision BASIS 15. This document is currently (April 2, 1991) under
a letter ballot to forward it to X3 as the draft proposal ANSI Forth.
Should the letter ballot pass, SPARC may review this document during
their May 7, 1991 meeting. If approved, it would then go out for a
six month public review.

To obtain a copy of BASIS 15, send a check for $15,
payable to Forth, Inc., to the

ANS ASC X3/X3J14 Technical Committee
c/o Forth, Inc.
111 N. Sepulveda Blvd., Suite 300
Manhattan Beach, CA 90266

ZEN 1.15 is not endorsed by the ANS X3J14 committee. It is a
working document. No guarantees are made to its accuracy or fitness.

ZEN 1.15 is an ANS Forth System with the following words sets:

CORE and all CORE extensions
BLOCK and all BLOCK extensions
DOUBLE and all DOUBLE extensions
FILE and all FILE extensions
SEARCH and all SEARCH extensions
STRING and all STRING extensions except LEX
The following TOOLKIT extensions:

Most of these words are included in the ZEN.EXE nucleus. A few are
separated into the file OPTIONS.SRC. To include these options, change
the appropriate 0 .IF statements to 1 .IF in OPTIONS.SRC. Execute
ZEN.EXE and type:


To save the amended nucleus, type:


This creates a new executable file called SAVE.EXE which can be renamed.

Extra features
In addition to the wordsets and extensions listed above, ZEN includes
many additional words which are documented as source code in the files

SAVE for saving an executable snapshot of the nucleus plus any
application words added with LOAD or INCLUDE

Conditional compilation support: .IF .ELSE and .THEN (nestable).
EXIST "name" is true if name is found in the current search order.

EMPTY and GUARD to save and restore the state of the dictionary.

PATCH to revector any old colon or code definition to any new one.
Any words based on the old definitions will use the new ones instead.

A rich string extension based on a 1 Kbyte rotating string buffer.

A generic BIOS or DOS interrupt call via INT86
See regAX ... regES and flags .

Words to fetch, store, or examine anywhere in the 1 Mbyte address space:
[email protected] LC! [email protected] L! LCMOVE LDUMP CSEG and DSEG
Fetch or store from the port address space:
[email protected] PC! [email protected] and P!

Documentation requirements
The address unit is 8 integer bits (one byte). A character occupies one
address unit, ie, one byte. There are two 8-bit address units (bytes)
per cell. No special alignment is used, ie, the nucleus is byte-aligned.
Counted strings may be as long as 255 characters (plus count).

ZEN.EXE is written for the IBM PC family of byte-aligned, twos-complement
machine. The ranges for n +n u d +d ud wd and sys are determined by the
requirement to fit into 16-bit twos-complement cells.

The parameter and return stack sizes are currently set to 300 hex bytes
each. The dictionary and data space are currently set to 64 Kbytes each.
See ZEN.INC. The number of bytes remaining in the separate dictionary and
data spaces is display when ZEN boots, and can be printed at any time with
the command FYI (for your information).

The default input device is the keyboard via DOS interrupt 21h service
6 and 7. The default output device is the CRT screen via DOS interrupt
21h service 40h. EMIT passes all 8-bit characters on to DOS. The
character set used is the IBM PC 8-bit character set.

BLOCKs are read from and written to the file BLOCK.SCR on coldstart. If
this file does not exist, it is created. To extend the file, simply write
a new block to it.

ENVIRONMENT? is barely supported. It returns false to all queries.

EXPECT and ACCEPT support and editing. The display is
not disturbed on .

File names are passed unaltered to DOS and may include paths.
File lines are terminated with a sequence and may be
up to 128 bytes long.

File errors are returned as DOS ior results by file functions. If an
error occurs while interpreting a file or block, the line in question is
displayed along with the file name, and all nested files are closed. The
file identifier points to an array element containing the DOS fileid, the
file name, and current line number.

No assembler is provided. Application assembler definitions may be added
to the nucleus when ZEN.EXE is generated by incorporating them into the
file USER.INC. Regenerating ZEN.EXE requires the Borland Turbo Assembler
and Linker.

The minimum search order is: ONLY FORTH DEFINITIONS ALSO
The system prompt is: Ok

No specials provisions are made for arithmetic overflow. Arithmetic with
flags and characters is permitted. Symmetric division is the default.
To enable floored division, include the definitions in the file OPTIONS.SRC

Loop parameters are stored in-line. No separate flow-of-control stack is

PAD can be up to UNUSED bytes long. S" places an interpreted string at
PAD. The pictured output numeric conversion string can be up to 33
bytes long.

The MS clock has a granularity of about 18 Hz.

ABORT is implemented with a -1 THROW.
ABORT" is implemented with a -2 THROW. No other values are THROWn by
the nucleus.

The structure of a word list and all other implementation details can be
determined by examining the many assembler *.INC source files provided.

General exception conditions
If insufficient number of stack entries: ABORT" Stack?"

If a word is not found or is not a number, or
if the input stream is inadvertantly exhausted: ABORT" ?"

The following conditions are neither checked nor prevented. The result
of such exceptions is undefined:

Insufficient parameter or return stack space.
Execution of compiler words while interpreting.
Insufficient space in the dictionary.
Inappropriate and out-of-range arguments.
Overflow of pictured numeric output string.
Quotient out of range.
Parsed string overflow.
Word name too long.
Contents of input stream modified by program.

Division by zero returns a quotient of zero and a remainder
equal to the dividend.

Specific exception conditions
' ['] FIND see word not found or not a number.
*/ / /MOD M*/ M/ M/MOD MOD see division by zero.
EXECUTE does not detect invalid execution tokens.
ABS CONVERT D>S do not detect result overflow.
ALSO does not detect too many word lists.
BLOCK BUFFER LOAD do not detect block number out of range.

 December 7, 2017  Add comments

Leave a Reply