07' FD V07N2

User Manual: 07'

Open the PDF directly: View PDF PDF.
Page Count: 44

Download07' FD-V07N2
Open PDF In BrowserView PDF
Dimensions
Menus
in Forth

The

~orthcard'"

STAND ALONE OPERATION

$299

Evaluation Unit
Part #STD65F11-05 includes:
ForthCard, Development
ROM, 8Kbyte RAM, Manuals

STD BUS INTERFACE
EPROMIEEPROM
PROGRAMMER
RS-232 1
1
0
PARALLEL 110

--

ROCKWELL FORTH CHIP

The Forthcard provides OEMs and end
users with the ability to develop Forth and
assembly language programs on a single
STD bus compatible card.
Just add a CRT terminal (or a computer
with RS-232 port), connect 5 volts and you
have a self contained Forth computer.
The STD bus interface makes it easy to
expand.
Download Forth source code using the
serial port on your PC. Use the onboard
EPROMIEEPROM programming capability
to save debugged Forth and assembly
language programs. Standard UV erasable
EPROMs may also be programmed with
an external Vpp supply.

OEM Version as low as
Part #STD65F11-00 $
does not include
memory or manuals

199

NEW! Options and Application Notes
Electrically Eraseable PROMS(EEPROMs)

FREEZE the dictionary in EEPROM (save in
non-volatile memory, to be restored on
power up)
Download Software for your IBM PC or CP/M
Non-Volatile CMOS RAM with battery 2K,
8K, optional Clocklcalendar
Fast 2MHz clock (4MHz crystal)
Disk Controller Card (5%")
Self Test Diagnostics
Parallel printer interface

Ask about our ForthBoxTM
A complete STD bus oriented system including
the ForthCard, Disk Controller, Disk Drive(s),
STD Card Cage, Cabinet and power supply.
CALL TODAY FOR COMPLETE INFORMATION!

H!TBG~Eqa!pm~mGGarparaQi@m
9560 Black Mountain Road
San Diego, CA 92126

(619) 566- 1892

FORTH Dimensions
Published by the
Forth Interest Group

Dimensions

July/August 1985
Volume VII, Number 2

FEATURES

Editor
Marlin Ouverson

15 Menus in Forth
by Frans Van Duinen

Production
Cynthia Lawson
Forth Dimensions solicits editorial
material, comments and letters. No
responsibility is assumed for accuracy
of material submitted. Unless noted
otherwise, material published by the
Forth Interest Group is in the public
domain. Such material may be reproduced with credit given to the author
and to the Forth Interest Group.
Subscription to Forth Dimensions is
free with membership in the Forth
Interest Group at $15.00 per year
($27.00 foreign air). For membership,
change of address and to submit
material for publication, the address is:
Forth Interest Group, P.O. Box 8231,
San Jose, California 95 155.

Symbol Table
Simple; introductory tutorials and simple applications of Forth.
Intermediate; articles
and code for more complex applications, and
tutorials on generally difficult topics.
Advanced; requiring study and a thorough understanding of Forth.
Code and examples conform to Forth-83 standard.
Code and examples conform to Forth-79 standard.
Code and examples conform to fig-FORTH.
Deals with new proposals and modifications
to standard Forth systems.
Volume VII, No. 2

Make life easier for users of application programs - this article includes definitions that make it simple for you to develop menus.

25

Another Subroutine Technique
by Donald Simard
Want to call code subroutines from either colon or other code definitions, but
can't afford the run-time penalty of earlier methods? This one may come closer to
the mark for you.

27

The Hacker's LOCKER
by Cecil McGregor
If a terminal supports line lock, one can use it from Forth to preserve useful data
on the screen. Here's a simple way to do it.

28

I

Mass Transit Forth
Bus passengers in this English city don't have to wonder when a late bus will
arrive or whether an approaching bus is the correct one to board. A Forth
application tells them, at the touch of a button.

30

P
38

Forth Spreadsheet, Part I1
by Craig A. Lindley
This source code accompanies the article and pseudo-code in the preceding issue,
giving Forth users a customizable application program. (For a machine-readable
version, turn to the end of the listing.)

Rochester Forth Conference 1985
Forth programmers, project managers and visionaries from several countries
convened recently to discuss software engineering, management and productivity.
The result was an exciting display of Forth and its adherents at their best.

40

Probabilistic Dictionaries
by John S. James
Have you wondered how a 60,000-word spelling dictionary can be compressed
into RAM? Ultra-fast text searches can be performed using techniques pertinent
to a variety of applications.

DEPARTMENTS
5
9
12
42

Letters
Editorial: "Journey to the East"
Ask the Doctor: "Forth on the Front" by William F. Ragsdale
FIG Chapters

3

FORTH Dimensions

MOVE UP TO 76bit FORTH COMPUTING

ENTER THE POWERFUL WORLD OF
68008 PROCESSING TODAY
d-

FOR ONLY

,

+

$399

HC120 8MHz
- 68008 CPU

HlGH SPEED
CMOS LOGIC FOR
HlGH NOISE IMMUNITY
LOW POWER CONSUMPTION
1 MEGABYTE LINEAR ADDRESSING
2 SERIAL PORTS - RS23214221423
20 PROGRAMMABLE 110 LINES
REAL TIME CLOCK
HARDWARE WATCHDOG
ON BOARD BATTERY BACK-UP

INCLUDES

*+ COMPREHENSIVE
POWERFUL 16K ROM BASED L A X E N & PERRY'S F83
16K DEBUG PACKAGE
+ BATTERY BACKED 24K RAM & CLOCK
** COMPLETE
80 PAGE MANUAL WlTH CIRCUITS
FULL MULTI-TASKING F83 FORTH SOURCE LISTING
* ACAN
RUN TOTALLY "STAND ALONE"
L L THIS FOR JUST $399

AND WIN A PRIZE

DlSC BASED FORTH SYSTEMS ALSO AVAILABLE FROM THE HC RANGE.
EXAMPLE:
$99
HC100 - 8 SLOT BACKPLANE
$199
HC11O - POWER SUPPLY 110/220/240v (please indicate)
HC130 - DMA DlSC CONTROLLER WlTH 8K BYTES
$299
CACHE FOR SUPERFAST COMPI LATIONS
$29
F83
FULL SOURCE CODE ON 5'/4/3K DlSC (please indicate)
AND MORE! - WRITE FOR DETAILS ADD $10 FOR SHIPPING
80 PAGE SYSTEMS MANUAL

$25

S E N D M O N E Y O R D E R I C H E Q U E W l T H O R D E R , A L L M A I N CURRENCIES ACCEPTED. D E L I V E R Y 2-4 WEEKS.

3 9 HlGH STREET, COWBRIDGE, S O U T H G L A M O R G A N , U.K.
T E L . ( 0 4 4 6 3 ) 2 4 0 9 & 4661
TELEX498215
CF7 7 A E

Standard Bearers
Dear Mr. Ouverson:
The Financial Services Division of
Computone Systems has developed an
applications language specific to insurance using the Forth-83 Standard.
We think the remarkable thing about
our language is that it runs on
8086/8088,6502 and Z80-based machines. There is a lot of talk about languages being transportable, but we
found that most of it really is nothing
but talk. Without the new standard, it
is not likely that we could have accomplished the level of transportability
that we have.
Computone has been developing
software in Forth for the past two and
one-half years. Initially, Forth was dictated by the machine we chose to market. We began our support of additional machines by purchasing Forth packages from outside vendors.
One fact became clear early in our
development phase: there was no generally accepted standard and little continuity in vocabularies and functions
among the Forth versions we were
working with. These differences between versions prevented our applications code from being as transportable
as we needed. Eventually, we had to
decide whether or not to continue our
development exclusively in Forth.
When evaluating other languages as
possible substitutes for Forth, we
found that several of them offered
more complete development systems
and more liberal licensing agreements.
Many of the packages offered better
speed and more thorough floatingpoint tools. On the other hand, there
was still no language available that we
could alter so that the applications
code would be identical on all the
machines we were supporting. We
found that the better-supported systems were expensive and had their own
drawbacks: link/compile time, nonstandard extensions, speed or size
limitations and highly variable support
for machine-specific devices, I/O, etc.
Forth was one language that could
be altered at the machine level. If the

Volume VII, No. 2

right version could be found for each
processor we were supporting, adjustments could be made to the kernel via
the metacompiler to develop the multimachine applications language we
needed.
After some investigation, we found
that several individuals had produced
public-domain versions based on the
new Forth-83 Standard. These versions
were similar in philosophy and came
complete with the source for their
compilers, and had most of what we
needed for development.
Using the public-domain versions,
we were able to extend the machinespecific code and duplicate the current
language that our applications team
was using. We found that by simply
transferring the high-level code from
one machine to another and recompiling, our applications would run on
virtually all our machines. We eliminated the eventual need for retraining
our staff and extended the useful life of
the tools and applications we had
developed.
Ultimately, our decision to develop
exclusively in Forth allowed us to cut
our programming costs and development time drastically. We were able to
simplify software development by reducing the number of systems we had
to learn and use. We increased productivity by reducing the number of application variations that had to be
developed and supported. We were
able to deliver the software faster and
with far fewer problems. The final
result was an increase in our bottom
line, and after all, the real value of a
language is in how it impacts profits.
We are convinced that without the 83
standard, our integration of language
and systems could not have been
achieved. The standard proved to be a
rallying point from which individuals
were willing to work to produce systems which were compatible over a
wide range of machines and available
to the Forth community at low cost.
The presence of a standard for highlevel code only serves to make the
language more transportable and useful to developers who work with an

5

ever-increasing number of machines.
The presence of standards within the
community need not curtail the adaptability of the language, but rather
serves as a bridge to new solutions,
tools and ideas. The new standard and
its wide acceptance will help Forth gain
the industry-wide credibility it deserves.
Sincerely,
Michael D. Pollard
Donald S. Schrader
Computone Systems
Atlanta, Georgia
Hore Today, EXITed Tomorrow
Dear FIG:
Hore (Forth Dimensions VI/6)
provides a solution to the so-called
"double-loop-exit" problem, as it has
been referred to in other quarters. His
solution entails the derivation of an
alternative DO LOOP structure.
Screen 1 shows yet another alternative. In this solution, the systemdependent word DROP.LOOP is created
which, when executed, allows a normal
EXIT (given as ;S in the example, as it is
in a fig-FORTH dialect).
DROP.WOP does what the sequence
R> R > PDROP would do if it were
included at the equivalent point in the
definition of LOOK.UP.
For those unfamiliar with the use of
EXIT, it forces the end of the word,
from anywhere in the word - with the
notable exception of within a DO LOOP.
DO LOOPS typically leave two or more
values on the return stack. Since EXIT
makes use of the value which sits below
those two or more values, we have to
dispose of them before we can exit. A
little brute force (trial and error) experimentation will show you how your
system works. The only other element
you may need to take care of would be
a Forth-83 implementation of DO
LOOP, which sets a flag to indicate
being in a loop. Your system probably
doesn't do this, but the flag should be
indicated in your user variables if it
does.
The objection raised to the kind of
maneuver presented here typically

FORTH D~rnens~ons

comes from the Wirth school of programming - the solution used does
not have a "common end." And, so
the argument goes, without a common
end, another person reading a long
program will get lost and be unable to
follow the flow of the program. Arguing from first principles, a la Dijkstra,
it sounds sound.
Evidence, however, has a way of
modifying principle. WOK.UP is, in
fact, totally unambiguous. A stranger
to the code (but not to Forth, of
course) would understand immediately
the action of the word. The difference
which matters here is the size of the
word: when the program is trivially
small and program elements are selfdescriptive, it is demonstrably good
programming for a word with two
distinct outcomes to have two distinct
ends.
A key distinction is whether the
program is trivially small and is made
of self-descriptive program elements,
whose own elements have the same
characteristics. Which, as I think about
it, isn't a bad description of what a
Forth program should - and can be.
I have included screen 2 to show
some more uses of those interesting
words COMPILE, [COMPILE] a n d
IMMEDIATE. It was my fifth time
through Starting Forth before I began
to grasp them. Useable examples sometimes teach better than either words or
pictures.
The word DO+ saves a little typing
and eliminates the clutter of all those
WER + SWP sequences we use with a
range of addresses. LOOP.EXIT performs
the functions of DROP.WOP and EXIT,
as the F83 word does. I typically keep
them separate in my programs, as I
have found times when program flow
is clearer if I do.
Regards,
Henry J. Fay
Cazenovia, New York
Missing Mathquiz
Dear Marlin,
I'd like to look at the Mathquiz
program on pages 13-14 of Forth

FORTH Dimensions

5CH 11 1
HES 64FORTH
HJF OlMAY85
0 \ DROP-LOOP EXAMPLE
1
2 : DROP.LOOP
3
COMPILE R> COMPILE R> \ BRING LOOP INDICES BACK HOME
4
COMPILE ZDROP \ GET RID OF THEM
: IMMEDIATE \ NATURALLY
5
6

7 1 VARIABLE TABLE 2

8

. .
3

4

,

.

5

( VALUE/TABLE-ADDR/#ENTRIES
OVER + SWAP
DO
DUP I E! =
IF DROP I DROP. LOOP :S ENDIF
LOOP
FALSE :

9 : LOOK-UP

10
11
12

13
14
15
SCH
V

#

ADDR' OR 0

)

2

IMMEDlATE FUN

\

---

HES 64FORTH

HJF 01MAY85

1
2 : LOOP-EXIT
3
[COMPILE> DROP-LOOP

C0MPILE:S
: IMMEDIATE
4
5 : DO+ ( START-ADDH/#ENTRIES
)
6
COMPILE OVER COMPILE + COMPILE SWAP
7
CCOMPILEI DO : IHMEDIATE

---

E)

9

Mathquiz
SCR
0
1
2
3
4

X72
LDH 08/84 )
( PROGRAM VARIABLES
VARIAELE CHOICE
1 CHOICE ! ( Get and store players choice # 1
VARIABLE RESULT
0 RESULT ! ( Store result for *, +, & - 1
VARIABLE SCORE
0 SCORE ! ( Maintain players # of correct ans )
VARIABLE LEVEL
0 LEVEL ! ( Store difficulty level )

5

6

7
8

(

Delay routznes

V : DELAY
10
11 : 2DELAY
12
SCR
0
I
2
3
4

5
6
7

8
V
10
II
12
13
14
15

LDM 08/84

15000 0 DO LOOP ;

Null loop t ~ m edelay

(

25000 0 DO LOOP ;

(

Longer time delay

)

)

X73
( TITLE PAGE--HATH-QUIZ )
: STAR
42 EMIT ;
: STARLINE
4 0 0 DO STAR LOOP ;
: ELANKLINE
STAR 38 SPACES STAR ;
: INFO-L1
STAR 1 4 SPACES
HATH QUIZ "
14 SPACES STAR ;
: INFO-LZ
STAR 13 SPACES " VERSION 1.3 "
13 SPACES STAR ;
: INFO-L3
STAR 18 SPACES
BY"
18 SPACES STAR ;
: INFO-L4
STAR 12 SPACES
LYLE D. NORTON"
1 2 SPACES STAR ;
: HATHTITLE
PAGE STARLINE ELANKLINE
BLANKLINE INFO-LI BLANKLINE INFO-LZ
BLANKLINE BLANKLINE INFO-L3 BLANKLINE
INFO-L4 ELANKLINE BLANKLINE STARLINE CR CR ;

."
.
."
."

SCR #74
0 ( INSTRUCTIONS FOR MATH-QUIZ )
1 : INSTRUCT
3 SPACES
HELLO. YOU "
2
ARE ENTERING THE WORLD " CR
3
" OF MATH-QUIZ. PLEASE ENJOY "
4
" YOURSELF' " CR " BE ADVISED "
5
INVERSE " THE UPPER LEVELS MAY REQUIRE"
6
CR " A PENCIL AND PAPER. "
NORMAL " GOOD LUCK! " ;
8

."

."
.
.

.

7

)

.

.

.

Continued

9

6

Volume VII.No. 2

Dimensions (VI/6) but some of the
screens seem to be missing. Words like
GETNAME and ANSWER in the text, and
many of the words shown in screen 83
are not defined. Could I get a copy of
the full set of screens? I'd like to set up
the program for my wife's school kids
and I'd like to study it to learn something about keyboard input.
Klaus Schleisiek has picked a wonderful place as site of the euroFORML
conference. I've been in Heilbronn and
through the Neckar valley a couple of
times. 1'11 be at the European FORML
conference for sure.
Best!
Nathaniel Grossman
Los Angeles, California
Editor's note: Sincere apologies go to
our readers and to author Lyle D.
Morton who wrote "Mathquiz." In
our issue VI/6 we unintentionally
printed only four screens (numbered
71, 79, 80 and 83). The accompanying
screens 72- 78, 81 and 82 are published
here to complete the program.
You Screen, I Scream
Dear Marlin,
The Forthodoxy commands that we
Forth our programs into screens, the
"natural unit of thought." As a confirmed heterodox, I think it is time to
examine what screens offer and do not
offer, in contrast to their alternative.
Right off, let's admit that screens are
not a natural unit of anything except
computer memory or CRT display.
The mind doesn't inherently work with
1024-byte units - certainly not when
any number of those bytes can be
blank. To the extent that screens keep
us 1K-bound, they make it difficult to
deal with our code at flexible levels of
detail and generality.
To appreciate how disfunctional
screens are, note their perfect analogy
to the numbered lines of BASIC. Like
line numbers, screen numbers are inherently meaningless, presenting
housekeeping chores and working
against self-documentation. The process of copying, moving and inserting
screens is tedious (even hazardous),

VolumeVII, No. 2

SCR # 7 5
o ( M A T H a u ~ z- - - A D D I T I O N M O D U L E
1
2 VARIABLE ADD1
0 ADD1 ! ( addend X 1 )
3 VARIABLE ADD2
O ADD2 ' ( addend # 2 )
4 : A N S W E R Q U E R Y B L WORD NUMBER D R O P ; ( g e t s p l a y e r s a n s w e r )
5 : ADDITION
( MAKE P R O E & G E T A N S )
6
L E V E L @ C H O O S E A D D 1 ' ( g e t difficulty l e v e l a n d
7
L E V E L @ CHOOSE ADD2 I ( use CHOOSE t o s e l e c t addends j
+ "
8
CR ADD1 @
9
ADD2 @
"
= " ( 8 & 9 format problem )
10
ANSWER
11
A D D 1 @ A D D 2 @ + DUP R E S U L T ' ( add t h e addends & s t o r e lt !
12
= IF . ' CORRECT " 1 SCORE + !
13
E L S E CR
" WRONG, T H E C O R R E C T "
14
ANSWER IS " R E S U L T @
THEN ;
15

. .

. ."

.

."

.

S C R X76
O ( S U B T R A C T I O N MODULE !
1
2 VARIABLE SUBl
O S U B l ! ( minuend !
3 VARIAELE SUEZ
0 SUEZ ! ( subtrahend )
4 : SUBTRACTION
( MAKE P R O B - G E T
ANS)
5
L E V E L @ D U P C H O O S E + ( a d d random number t o L E V E L
h
SUE1 !
(
t o make a m i n u e n d 1' s u b t r a h e n d )
L E V E L @ C H O O S E SUB; ! ( choose s u b t r a h e n d )
@
CR SUB1
Y
SUB2 @
= " ( 8 & '? f o r m a t p r o b l e m )
10
ANSWER
11
S U B 1 @ S U E 2 @ - DUP R E S U L T ' ( g e t d i f f e r e n c e and s t o r e
12
= IF
CORRECT " 1 SCORE + I
13
E L S E CR
" WRONG, T H E C O R R E C T "
14
ANSWER I S ' R E S U L T @
15
THEN ;

'

i

. .

. ."

."

)

.

."

.

SCR t77
0 ( M U L T I P L I C A T I O N MODULE )
1
2 VARIABLE MULTl
O MULTl ' ( multiplicand )
3 VARIAELE MULT2
0 M U L T ? ! ( multiplier !
4 : MULTIPLICATION
( g e t problem and p l a y e r s answer )
5
L E V E L @ CHOOSE M U L T l ! ( randomly c h o o s e m u l t i p l i c a n d )
6
L E V E L @ CHOOSE MULT2 ! ( randomly c h o o s e m u l t i p l i e r )
CR MULTl @
* "
8
MULTZ @
= " ( 7 g 8 format t h e problem )
9
ANSWER
10
M U L T l @ MULT2 @ * DUP RESULT
( y e t p r o d u c t and s t o r e
11
= IF
CORRECT' " 1 SCORE + '
12
E L S E CR
WRONG, T H E C O R R E C T "
13
"
ANSWER I S " R E S U L T @
14
THEN ;
15

. ."
. ."

7

."

.

."

)

.

S C R 878
0 ( D I V I S I O N MODULE
1
2 VARIABLE D I V I l
0 DIVIl ' ( dlvisor )
3 VARIABLE D I V I 2
O DIVI2 ' ( quotient )
4 : DIVISION
( G E T P R O B & ANSW )
5
L E V E L @ C H O O S E 1 + DUP D I V I l ' ( g e t 3 0 d i v i s o r )
h
L E V E L @ C H O O S E 1+ D U P D I V I Z ' ( g e t 7 O q u o t r e i n t )
* RESULT ' CR ! develop dividend )
8
RESULT @
i "
,?
DIVIl @
= " ( 8 F 9 format t h e prohlem 1
10
ANSWER D I V I 2 @ ( compare q u o t l e n t w i t h p l a y e r ' s a n s )
11
= IF
" CORRECT " 1 SCORE + '
1 2
E L S E CR
WRONG, T H E C O R R E C T "
13
" ANSWER I S " D I V I Z @
I 4
THEN ;
15
Continued

-

. ."
. ."

.

."

.

7

.

FORTH Dimensions

SCR
0
1
2
3
4
5

X81
( G R E E T I N G MODULE 1
CREATE
: GREET
:

b

-,
:
9 :
8

10
11
1 2 :
13
1 4
15

NAME 4 0 A L L O T
PAGE
" WELCOME T O "
" MATHQUIZ VERSION 1 . 3 I " ;
GETNANE
CR
E N T E R YOUR F I R S T "
NAME. " CR OUERY 1 T E X T ( g e t p l a y e r s name I
P A D NAME 40 CMOVE ; ( move s t r l n g from P A D t o NAME
PLAYER
NAME 4 0 - T R A I L I N G T Y P E ;
REGREET
PAGE PLAYER
YOU "
MAY C H O O S E FROM T H E " CR
" F O L L O W I N G MENU : " CR ;
COMMENCE
G R E E T GETNAME
;

.
."

.
."

)

." ,

."
.

SCR # 8 2
0
L O O P & S C O R E MODULE )
1 : DISPLAY
CR PLAYER
, YOU "
2
WERE C O R R E C T " S C O R E B DUP
3
"UP
T I M E S " CR . " O U T O F 1 0 . "
4
I N V E R S E 8 :, I F
VERY G O O D ' " Z D R O P E L S E
5
b >
IF
N O T B A D ' " DROP E L S E
b
B E T T E R WORK H A R D E R ' " T H E N
T H E N NORMAL ;
8 : 10-ADD
0 S C O R E ' 1 0 0 DO ( t h e s e s e t up b l o c k s o f 1 0 )
9
A D D I T I O N LOOP DISPLAY
;
10 : 1 0 - S U B
0 S C O R E ' 1 0 O DO
11
SUBTRACTION LOOP D I S P L A Y
; ( and zero t h e score a t the
12 : 10-MULT
O S C O R E ' 1 0 0 DO
13
M U L T I P L I C A T I O N LOOP D I S P L A Y ; ( beglnnlng of each block
14 : 1 0 - D I V
0 S C O R E ' 1 0 0 DO
15
D I V I S I O N LOOP DISPLAY
;

."

."

."

. ."
."

."

7

FEATURES
-FORTH-79 Standard Sub-Set
-Access to 8031 features
-Supports FORTH and machine
code interrupt handlers
-System timekeeping malntalns
time and date w ~ t hleap
year correction
-Supports ROM-based selfstarting applications

COST
130 page manual
-S 30.00
8K EPROM with manual-$100.00
Postage pald In North Arnertca
lnqurre for llcense or quantlty prlclng

Bryte Computers, Inc.
P.O. Box 46, Augusta, ME 04330
(207) 547-32 18

$
.-.-.-.-...-.-.-.-.-.-.
-.....-.-.-.-.-.-........,..
_..._
......-.............
.........-.-...-.-.........
2...... ..-......................
.... .......-.......*.*.
.....+:::

.

hence we create "spaghetti loads" that
make source code harder to follow.
Indeed, the LOAD command is BASIC's
GOT0 expressed at a different level.
In addition to spaghetti loads, screen
boundaries encourage "meatball
code." Long, horizontally formatted,
uncommented definitions are a natural
result of a screen boundary that takes
effort to cross - and the fact that
blank areas get wasted. By the way,
index lines - manually added redundance - are another space waster.
So far, I've said that screens work
against flexibility, space economy and
self-documentation. Readability suffers from spaghetti and meatballs, plus
excess baggage (screen number in
decimal and hex, initials, date, index
line and line numbers). Screen editors
themselves are horribly weak, so even
interactivity can suffer. There is hardly
a virtue claimed by Forth that screens
do not work against.
When resources are limited, screens
offer an easily implemented, interactive way to write programs in an incremental fashion. Fortunately, resources are no longer that limited, and
file systems with powerful editors have
8

)

already been implemented. The most
natural, least restrictive way to produce code is with good text editors or
word processors. I won't dwell on their
advantages over Forth editors. To
anyone who has tried them, the difference is obvious (in New York, "FIG
edit" means "forget it"!).
Besides offering greater power, ease
and flexibility, a real editor conserves
disk space (I know - big deal) while
encouraging commenting and high
readability. With a good file system, it
offers self-documenting file names for
code modules of whatever size the
programmer chooses.
Any problems? One is indexing;
without it, well-organized code in wellnamed files is important (a good idea
in any case). Another problem is navigation between Forth and the editor; to
which fast operating systems, multitasking, desktop utilities or non-screen
editors within Forth are all solutions.
Lastly, compilation speed may suffer,
depending on how politely Forth relates to its host; the trend is toward
politeness, which eliminates the problem.
Volume VII, NO.
2

Journey to the East
We recently returned from the annual Rochester Forth Conference. The
lively event was sponsored by the Institute for Applied Forth Research in
cooperation with the Laboratory for
Laser Energetics and the IEEE Cornputer Society. That says something
interesting about the times if anything
does. The directors and staff of the
Forth Institute assembled a stimulating
program that is reviewed elsewhere in
this issue in necessarily brief terms there were about sixty presentors.
In this issue we make good on
promises past. Due to a last-minute
error, our last cover promised "Menus
in Forth" but it was nowhere to be
found inside - the article had been rescheduled. This time you'll find it,

honest! Also included herein are
screens to accompany Morton's
"Mathquiz." Thanks to the readers
who wrote to request them. As a side
note, columnists John Hall and Henry
Laxen are absent, at least for the time
being.
Add to the list of FIG membership
benefits a new one: major medical
insurance. In the U.S. only, FIG members, their families and possibly their
employees are now eligible for group
rates. Current members will be receiving notice in the mail with specifics
about the health-care plan. hose of
you who work independently or who
run a small business may be particularly interested.
And, finally, we would like to wel-

come five new chapters of the Forth
Interest Group. Members are now
holding official meetings and other
Forth-related activities at MAD Apple
FIG Chapter, Madison, Wisconsin;
Cache Forth FIG Chapter, Oak Park,
Illinois; Permian Basin FIG Chapter,
Odessa, Texas; Japan FIG Chapter,
Tokyo and Kyoto, Japan; and Rockland County FIG Chapter, Pearl River,
New York. Welcome to each group,
may your meetings prosper. For a
complete listing of all international
FIG Chapters, turn to the back pages
of this magazine.

I've used a file-and-editor system for
three years, and in spite of dire warnings, the only lightning I've been struck
by is my own programming speed. I
think it is vital that we move toward
elimination of the restrictions represented by screens. Unless it can adapt
to the progress around it, the Forth
may not always be with us.
Sincerely,
Laughing Water
Helena, Montana

period#. This simple math is all that is
required for any number of periods.
The word daylnterval adjusts the date
for a change of n days. It is dependent
on the calendar module used and serves
no purpose in this discussion.
The periods used are: 0 = dawn, 1
= morning, 2 = afternoon, 3 =
evening and 4 = night. If one begins
with morning (setting period# to I),

then - 7 perlodaway resets period# to -6
and -6 5 /MOD returns 4 -2. This
adjusts the date two back and resets the
period# to 4 (night), as it should be.
What could be simpler?
I raise my hat to the standards team
on this one.
Zaffar Essak, M.D.
v
~ British Columbia
~
~
canada

Division Floors Him

Dear Marlin,
I have never been one to pride myself
on an understanding of divisional
mathematics, and the debates between
floored-to-zero versus floored-tonegative-infinity have escaped me.
Well, you can imagine my delight when
I recently had occasion to use division
in a situation that illustrates the usefulness of the latter method.
In an appointment scheduler, the
day has been divided into five periods.
It is necessary to access prior and later
periods. A single word perlodaway can
handle the necessary calculations.
sdjustperlod# uses /MOD to calculate the
number of days crossed and resets

Volume VII, No. 2

-Marlin Ouverson
Editor

Block:: # 1
(

',

periodaway
dayinterval

Appointments
(

n--)

SF(:!? 12~ j

Qdjusts date b y n days.

O VALUE period#
: ad justperiod# ( - - )
period# 5 ,'MOD dayinterval

TO period# ;

\
,.

floored t n negative
infinity ideal ! !

( n--) AT period# + !
period# (1) 4 WITHIN (:I=
IF adjustperiod# THEN ;

: periodaway

EX IT

9

FORTH Dimensions

~

*
................................
A Case of Brackets

Editor,
Henry Laxen's article in your
March/April issue (VI/6) was very interesting for his discussion of using ] as
a callable compiler. Looking into just
how this works in the Perry/Laxen F83
system, described in C.H. Ting's book
Inside F83, I find a difficulty. When
reading from the terminal, the ] in F83
compiles only one line of text. Colon
definitions in F83 can have multiple
lines because compilation is continued
by repeated ] calls in QUIT. No return
into the definition of colon is made,
but none is necessary. Yet, such a
return into the defining word is just
what is wanted from ] as it is used in
Henry's CASE, for example.
This restriction seems inherent in
trying to use ] as a callable compiler
instead of some other word. The ] is
used not just to begin compilation, but
is used with [ to enclose an interpreted
expression embedded in the source text
of a compiled definition. Such embedded expressions really require a single
interpreter vectored back and forth
from compiling to interpreting by brackets, rather than calling and returning.
This interpreter, actually the word
INTERPRET, already does everything
Henry's ] does, if called with state set
to compile.
Like Henry's 1, though, INTERPRET
only compiles one line from the terminal. Rather than change I, therefore,
I would want to change INTERPRET.
The repeated loop over QUERY ...
INTERPRET in QUIT should be moved
into INTERPRET so that a single call will
process all the lines. The loop must
repeat only when input comes from the
terminal instead of disk. The null word
executed at the end of a line should
return into this loop, while exiting
from INTERPRET is done by ; at the end
of a definition.

of a line. Semicolon can be defined
simply as an exit one more level, to the
caller of INTERPRET, which will be a
defining word. The other work now
done by semicolon - compiling EXIT,
etc. to finish a colon definition - can
actually be done in colon. Semicolon
then can be used to terminate any
compiler construct, not just those
using colon. Henry's version of semicolon lacks this generality.

PRODUCTS BY DR.

INSIDE F83
New e d i t i o n ( p e r f e c t b i n d i n g 1.
E v e r y t h i n g you want t o
know
a b o u t t h e Perry-Laxen F83 s y s t e m
b u t a f r a i d t o a s k . 288 packed
pages d i v i d e d i n t o f o u r p a r t s :
t u t o r i a l on F83 s y s t e m , F o r t h
kernel,
u t i l i t i e s , and
8086
specific tools.
I t i s b a s e d on
F83 V e r s i o n 2.1 f o r t h e IBM-PC,
b u t u s e f u l a s a r e f e r e n c e manual
f o r a l l o t h e r F83 Systems.
$25.00
FORTH NOTEBOOK
New e d i t i o n ( p e r f e c t b i n d i n g ).
L a r g e c o l l e c t i o n o f examples of
Forth
progranmxng
style
in
s o l v i n g moderate t o c o m p l i c a t e d
problems.
Topics
include:
games, i n s t r u m e n t c o n t r o l , image
processing
and
analysis,
m i c r o a s s e m b l e r , e n d many more.
$25.00

Henry described the compiling ] as
an outgrowth of Forth-83, which
eliminates state-smart words. (I still
like state-smart words, but they really
are irrelevent here. Besides, Forth-83
does not define 1 as processing text; like
Forth-79, it defines both brackets
vaguely, as setting state so that text is
"subsequently compiled" or "subsequently interpreted." Code using
Henry's ] therefore may not work on
some quite standard systems.

SYSTEMS GUIDE TO fig-FORTH
The most a u t h o r i t a t i v e t r e a t i s e
on
how's
and why's o f t h e
f i g - F o r t h Model d e v e l o p e d
by
Bill
Ragsdale.
The i n t e r n a l
s t r u c t u r e of F o r t h system.
$25 .OO
fig-FORTH FOR NOVZ COfiPUTER
8" d i s k
$50.00
Source l i s t i n g
$15.00

On another subject, credit should be
given to D. Val Schorre for his paper
on "Adding Modules to Forth" in the
proceedings of the 1980 FORML Conference. He presented the same technique described by Carol Pruitt in your
March/April issue under the title
"Local Definitions."

FORTH-79 ROM CARD FOR APPLE I [
ROM c a r d
$50.00
Source l i s t i n g
$15.00
******************.***r*********

PERRY-LAXEN F83 SYYTSk DISKS
F83 (V.2.1) a s d i s t luted by No
V i s i b l e S u p p o r t , I:la.
Please
c a r e f u l l y s p e c i f y yuu- CPU, O/S,
a n d d e s i r e d d i s k fo-mat.
$25.30 p e r d i s k .
PC-DOS DD Format:
1 . F83/8086 f o r IBM-PC
CP/M 8" SSDD Format:
2. F87/8080 f o r CP/M
3. F83/8086 f o r CP/M-&
4. F83/68000 f o r CP!M-68K
IBM-PC CP/M46 DD F > r m a t :
5. F83/8080 f o r C P / M
6 . F83/8086 f o r CP/M-86
7 . F83/68000 f o r CP/M-68K
L i s t i n g f o r IBM-PC F83
$10.00

Sincerely yours,
George Lyons
Jersey City, New Jersey

WIL BADEN'S F83X FOR APPLE I [
F83 a d a p t e d t o Apple I [ computer
5.25" d i s k w i t h d o c u m e n t a t i o n
$25.00

................................
Send check o r money o r d e r t o :
O f f e t e E n t e r p r i s e s , Inc.
1306 S. B S t . ,
San Mateo, Ca. 94402
Mailing & Handling,
10% o f
order.
C a l i f o r n i a n s p l e a s e add
6.5% s a l e s t a x .

One way to do this is by having
INTERPRET call a component word
(INTERPRET) to process each line. Null

can then be simply EXIT,as in figFORTH; it exits (INTERPRET) at the end

FORTH Dimensions

C. H. TINC

................................

10

.

VolumeVII. No. 2

NEW BOOKS

-

+

"FORTH GUIDE" by Haydon. An e x p l o r a t i o n o f t h e i n t r i c a c i e s of MVP-FORTH
"FORTH A p p l i c a t i o n s " by Weber $13.00

k-

THE FORTH
MVP-FORTH
Stable - Transportable - Public Domain - Tools

$20.00
7

SOURCE^^

FORTH MSKS

You need two primary features in a software development package
a
stable operating system and the ability to move programs easily and quickly
to a variety of computers. MVP-FORTH gives you both these features and
many extras. This public domain product includes an editor, FORTH assembler, tools, utilities and the vocabulary for the best selling book "Starting
FORTH". The Programmer's Kit provides a complete FORTH for a variety of
computers. Other MVP-FORTH products will simplify the development of
your applications.

MVP Books - A Series

FORTH with editor, assembler, and manual.
$100
q APPLE by MM, 83
q 8086188 by LM. 83
$100
25
I3 68000 by L", 83
$250
*& q Mac'nt0sh by MM983
q ATARIm valFORTH
q VIC FORTH by HES.
$60
$100
VIC20 cartridge
520
q CP/M by MM, 83
q C64 by HES Commodore
q HP-85 by L~~~~
$90
rn HP-75 by Cassady
50
64 cartridge
$40

q IBM-PC by LM, 83
IBM-PC by MM. 83
q 280 by LM, 83

*O

Voi. 1, All about FORTH by Haydon. MVP-FORTH glossary with cross
references to fig-FORTH, Starting FORTH, and FORTH-79 Standmi
2"4 ~ d .
q Voi. 2, MVP-FORTH Assembly Source Code. lncludes IBM-PC"
CPlMm , and APPLEm listing for kernel
$20
0 Vol. 3, Floating Point Glossary by Springer
$10
q Vol. 4, Expert System with source code by Park
$1 5
Voi. 5, File ManagementSystem with interrupt security by Moreton $25
Vol. 6, Expert Tutorial for Volume 4 by M & L Derick

.

MVP-FORTH Software - A Transportable FORTH
O MVP-FORTH Programmer's Kit including disk, documentation,

$100
5125
51 00

q

by HW,
q TIS 10001ZX-81
q 2068

$25
$30

~ ~ h FORTH
~ ~with:
~ ~ - e~ l o d
a t i npoint,
g
~ - ~ r a p h i c T-~utorial,
s,
S-Stand Alone, M-Math Chip Support, MT-Multi-Tasking, X-Other
Extras, 79-FORTH-79, 83-FORTH-83.
Ci APPLE by MM,
q C64 with EXPERT-2 by
F.G. & 8 3
$180
PS
$99
q ATARi by PNS, F,G, & X. $90
q Extensions for LM Specify
q CP/M by MM, F & 83
$1 40
IBM. Z80. or 8086
q Software Floating
q TRS-8011 or ill by MMS
F, X, & 79
$1 30
Point
$1 00
q c64 by PS MVP. F, G & x $96
$1 00
q(IBM-PC
8087 or 8086)
I3 9511 Support
Key tor.ndors:
HW Hawg W I I Software
~
(Z8O or 8086)
$1 00
LM Laboralory Mlcrosystems
I3 Color Graphics
MM MlcroMotlon
$1 00
(IBM-PC)
MMS Miller Microcomputer Serv~ces
PNS Plnk Nolse studto
I3 Data Base
PS Parsec
Management
$200

Volumes 1 & 2 of MVP-FORTH Series (All About FORTH, 2nd Ed. & Assembly Source Code), and Startfng FORTH. q CPIM, CP/M 86, 21 00,
APPLE. q STM PC, q IBM PCIXTIAT, I3 PCIMS-DOS, O Osborne,
q Kaypro, q MicroDecisions.
DEC Rainbow. q TI-PC,
O NEC 8 2 0 1 . 0 TRS-801100
$1 50
MVP-FORTH Enhancement Package for IBM-PCIXTIAT ProgramFORTH MANUALS, GUIDES DOCUMENTS
mer's Kit. lncludes full screen editor, MSDOS file interface, disk
Starting FORTH by Brod~e.
display and assembler operators.
$1 16 d0 Thlnking FORTH b y Leo
Best instructional manual
Brodie' author Of best selling
q MVP-FORTH Floatlng Point & Matrix Math for IBM PCIXTIAT with
available. (soft cover)
$20
"Starting FORTH
$16
8087 or Apple with Applesoft
$85
ALL ABOUT FORTH by
q 68000 fig-Forth with
q MVP-FORTH Graphlcs Extension for IBM PCIXTIAT or Apple $65
Haydon. MVP Glossary $25
assembler
$25
q MVP-FORTH Programming Aids for CPIM, IBM or APPLE Programq FORML Proceedings
q FORTH Encyclopedia by
mer's Kit. Extremely useful tool for decompiling, cailfinding, translatDerick & Baker
$25
q 1980
1981 Vol 1
ing. and debugging.
0 1981 Vol 2 0 1982
q FYS FORTH from the
+@
0
1983
q
1984
each $25
q MVPFMrm Cross Compller for CP/M Programmer's Kit.
:::G
:
*OL Netherlands
ates headerless code for ROM or target CPU
$300
q User Manual
$25
q 1981 Rochester Proceedings
q MVP-FORTH Meta Compiler for CPIM Programmer's kit. Use for
q Source Listing
$25
01981 01982 01983
each $25
IgB4
applications on CPIM based computer. Includes public domain 40 FORTH Tools and Applic. by
source
$1 50
Feierbach
$1 9
q Bibliography of FORTH $1 7
I3 The Journal of FORTH
q The Complete FORTH
MVP-FORTH PADS (Professional Application Development System)
$16
Application & Research
by Winfield
for IBM PCIXTIAT or PCjr or Apple II. 11+ or Ile. An integrated system for
0Vol.111 OV01.112
customizing your FORTH programs and applications. The editor in- 8 0 Learning FORTH by
0 Vol. 211 q vo1. 212
cludes a bidirectional string search and is a word processor specially
Armstrong
understanding FORTH
0 Vol. 213
each 51 7
designed for fast development. PADS has almost triple the compile
I3 METAFORTH by Cassady $30
speed of most FORTH's and provides fast debugging techniques.
by Reymann
$3
Minimum size target systems are easy with or without heads. Virtual
13Threaded interpretive
overlays can be compiled in object code. PADS is a true professional
$25
q ~ O ~ ~ I ~ ~ ~ ~ , Languagss
" ~ ~ i s l
development system. Specify Computer.
$500
Vol. II Glossary
$14
q Systems Guide to fig-FORTH
MVP-FORTH MSDOS file interface for IBM PC PADS
40 Mastering FORTH by
by Ting
$25
$85
Anderson & Tracy
$18
0 inside F83 Manual by
q MVP-FORTH Floating Point &Matrix Math see above
q Beginning FORTH by
+&Ting
525
$65
q MVP-FORTH Graphics Extension see above
FORTH Notebook by Ting 525
$1 7
MVP-FORTH EXPERT-2 System for learning and developing
invitation to FORTH
$20
q FORTH Encyci. Pocket
knowledge based programs. Both IF-THEN procedures and analytical
*& subroutines are available. Source code is provided. Specify q Apple,
Guide
$7
PDP-11 User Man.
$20
O IBM, or CPIM. Includes MVP Books, Vol. 4 & 6
$1 00
And So FORTH by Huang. A
q 6502 U a r ' s Manual by
FORTKWriter, A Word Processor for the IBM PClXTlAT with 256K.
college level text.
$25
Rockwell Intl.
$1 0
FORTH Programming by
e\\MVP-FORTH compatible kernel with Files. Edit and Print systems.
q FORTH-83 Standard
$1 5
Scanlon
Includes Disk and Calculator systems and ability to compile additional
q FORTH-79 Standard
51 5
FORTH words.
$1 50
C] MVP-FORTH R a t Floating Pdnt lncludes 951 1 math chip on board
q instaliatlon Manual for flg-FORTH
$1 5
with disks, documentation and enhanced virtual MVP-FORTH for Apple
$450
C
I
Source Listings of fig-FORTH, Specify CPU
515
II, 11+ , and lie.
Ordering Iniormatlon: Check. Money Order (payable to MOUNTAIN VIEW PRESS,
by Air. $5 for each item under $25. $10 for each item between $25 and $99 and $20 for
INC.). VISA. Mastercard. American Express. COD'S$5 extra. Minimum order $1 5. NO each item over $1 00. All prices and products subject to change or withdrawal without
billing or unpaid W's. California residents add sales tax. Shipping costs in US included notice. Single system and/or single user license agreement required on some
in price. Foreign orders, pay in US funds on US bank, include for handling and shipping products.

a

*'

*'

*'

*

'

*

*

*

MOUNTAIN VIEW PRESS, INC.
PO BOX 4656

I
4'

MOUNTAIN VIEW, CA 94040

(415) 961-4103

William F: Ragsdale
Hayward, California
"Ask the Doctor" is Forth Dimensions' health maintenance organization
devoted to helping you understand and
use Forth. Questions of a problemsolving nature, on locating references,
or just regarding contemporary techniques are most appropriate. When
needed, your good doctor will call in
specialists. Published letters will receive a preprint of the column as a
direct reply.
This month your faithful practitioner deviates from his usual format. In
the last three issues, we examined aids
to learning Forth. Interest shifts this
month to news and commentary on the
latest events impacting the Forth community. The first stop on our morning
rounds occurs at the Forth nursery,
otherwise known as the Chip Hatching
Department.
Novix NC4000 Processor

The hottest topic of interest in
the Forth world must be the Novix
NC4000P Processor, Charles Moore's
embodiment of Forth in silicon. This
sizzler of a processor gives about
10,000,000 Forth instructions per second (10 mips). Up to four Forth
instructions (like DUP I +) can execute
at each 125 ns clock cycle. A call takes
one clock cycle and a return takes
none! This rewrites the book on software, obviating interest in linear code
and macros.
To bring this topic into focus, we
peek behind the scenes to witness a bit
of the genesis of the Forth processor.
The courtship began in October of
1980. The moment of conception was
on January 19, 1981.
First things first. Forth, Inc. had
decided to expand its Board of Directors. Bill and Anne Ragsdale entertained Mr. John Peers at dinner in Palo
Alto in October 1980, with the ultimate
result of Mr. Peers being invited to join
the Board. John Peers was the founder
of Logical Machines, which had an
innovative, extensible language called
Adam. He was involved in robotics
FORTH Dimensions

and in the quest for aware machines.
The spark that set the Forth processor development into motion came just
two months later. We owe a debt of
gratitude to Christine Colburn (president of Creative Solutions), who gave
a $1000 birthday present to husband
Don. Don had been examining computer architectures and had developed
a passion to see the advantages of
Forth directly applied in silicon.
Don thus funded a one-day, projectorganizing session with Charles
Moore, Bill Ragsdale and a chip design
consultant. This was the spark needed
for Chuck to confirm that others were
seriously in support of his idea for a
Forth processor.
John Peers saw the beauty of approaching Forth from several levels.
He founded Technology Industries in
March 1981, with the encouragement
of Chuck Moore and Elizabeth Rather
of Forth, Inc. As the story unfolds,
Forth Inc. merged into Technology
Industries in August 1981. The charter
of Technology Industries was to be an
umbrella for three divisions of Forth:
hardware, software and applications.
Unfortunately, the full scope of this
plan was not reached and the merger
was rescinded in October 1982.
The chip development still continued, funded with the limited resources of Technology Industries. Charles
Moore demonstrated a color simulation of the processor in March 1983. A
funding partner, Sysorex International, became interested in July, and by
March of 1984 the Novix partnership
commenced operation. John Golden
transferred from Technology Industries as general manager, and continues
in the capacity today.
Silicon generation was almost anticlimatic. It took four years and a million dollars to get to the detail design
stage. It took just seven months and
seven hundred thousand dollars to
realize the dream of an operational
Forth processor in silicon.
EDN magazine had the privilege of
introducing the NS4000 in their March
1985 cover article. John Golden, guiding light of Novix, says, "The EDN
article put us on the map. Three hun12

dred inquiries were developed. We
found that Forth has friends throughout industry just waiting to show their
management the opportunities."
The first production run of development boards is nearly sold out. Mr.
Golden says shipments will commence
in the latter part of July with full documentation and developmental software
(by Gregg Bailey). Production units
were demonstrated at the Silicon Valley
FIG Chapter meeting and at the
Rochester Forth Conference. Purchasers' names read like a who's who
of technology. There are automobile
manufacturers, a computer media firm
and a computer company that is into
fruit. The processor is even being considered as a controller co-processor for
a recent thirty-two-bit family. When
queried on their motive, a spokesman
replied, "We see this as a way to get a
leg up on the rest of the world."
Forth and Voice Mail
FIG'S own John Cassady is getting
no end of attention in the technical and
popular press. He was recently "discovered" by Infoworld columnist John
Dvorak. Mr. Dvorak, you will recall, is
fondly remembered for his quote that
he has never seen a credible application
done in Forth.
He has met his match, as John
Cassady recently introduced the DynaCom Voice Mailbox System. It is programmed in Forth and is a honey of a
product. Dvorak devoted an entire
column in the San Francisco Chronicle
to Cassady's product and then gave it
another hit in his Infoworld column.
You may try the system and leave
remarks for John Dvorak at his voice
mailbox by calling (415) 763-2002.
When the system answers, tone in 454.
The system supports twenty-five
users, each with his own addressable
"box." Callers leave messages which
may be interactively reviewed by the
boxholder. But each boxholder may
grant up to thirty of his friends their
own guest mail boxes for replies! Imagine 750 people with selective use of
digitally controlled voice communica-

Volume VII. No. 2

tions. The box is an IBM P C look-alike
processor board with a hard disk,
speech digitizer and Touch-Tone signalling. From the outside, it looks like
just another industrial box. But on the
inside, the VMS has a heart of pure
Forth. John Cassady was previously
best known as the implementor of figFORTH on the 8080. He published the
8080 assembler in widest use and is the
author of the book Metaforrh.
The DynaCom system is to be demonstrated at the Silicon Valley FIG
Chapter meeting on July 28. Too bad
our publication date means you will
receive this issue of Forth Dimensions
the following week! FIG even has its
own voice mail box. For information
on the next Silicon Valley Chapter
meeting call (415) 763-2002 and tone
in 44414. For a demonstration, key
in 564.
The Rochester Conference

The Fifth Rochester Forth Conference continues to recieve rave reviews
from attendees. During early June,
over 180 people were hosted by Thea
Martin and Larry Forsley. Participants
traveled from all over the U.S., Canada, the Netherlands, Germany and the
U.K. The program featured ten papers
on Forth computers, with three from
Novix. Novix' Bob Murphy packed the
house with the best rundown yet on the
internals of the NC4000.
Major firms are using Forth and
appear to be making a significant
commitment in their project work.
High-visibility attendees at Rochester
included Standard Oil, Bell Canada
and the GM Delco Division.
The working group on standards,
presided over by Mahlon Kelly (no
relation to Guy Kelly, Forth Standards
Team chairman), got into the topic of
transitions from Forth-79 to Forth-83.
A significant attitude was expressed
about the burden and value of shifting
to Forth-83 from an earlier dialect.
Some opinion was offered that system
and application changes weren't justified by the small perceived benefit.
Switch or Fight?

Forth-79's five-year lead has finally produced a comfortable user

base. Working group members asked 1
"Why update to Forth-83? Is the effort worth the improvement? What
will be the common model of a full
implemention?"
fig-FORTH was the common model
prior to Forth-79. MVP-Forth carried
the FIG model forward, and has become the de facto model for Forth-79.
real-time applications involving
F83, the Laxen-Perry model, is only
ROBOTICS, INSTRUMENTATION,
now coming into its own as the leading
PROCESS CONTROL, GRAPHICS
contender for the Forth-83 Model
and
more, is now available for..
sweepstakes. Your faithful servant offers a few opinions. (Who said, "Anybody can have the facts, but it takes
real character to have opinions"?)
PolyFORTH II offers IBM PC
First, it takes four years for a language standard to become accepted
Unlimited control tasks
and popular. Do you remember the
Multi-user capability
hue and cry about Forth-79? It was
8087 mathematics cosupposed to be the worst disease since
processor support
the plague. Refer to your back issues of
Reduced application
Forth Dimensions to check it out. We
development
time
a r e t w o - a n d - a - h a l f years i n t o
Forth-83. It will catch full swing in
another eighteen months. Just wait!
Now included at no extra cost:
Second, the Forth Interest Group
Extensive interactive GRAPHICS
must abandon fig-FORTH. The system
SOFTWARE
PACKAGE! Reputed
design and listings are four years beto he the fastest graphic package
hind the times, unsupported, imposand the only one to run in a true
sible for the novice to self-install, and
multi-tasking environment , it
at cross purposes to the learning prooffers point and line plotting,
cess. (The only viable replacement for
graphics shape primitives and
the revenue that would be lost is a diskinteractive cursor control.
based applications library, but this has
PolyFORTH II is fully supported
its own set of complications.)
by FORTH, Inc.'s:
Third, some complaining occurred
Extensive on-line
at Rochester that the shift to Forth-83
documentation
was being pressured upon those comComplete set of manuals
plaining. This is a touchy topic. Some
Programming courses
standards are required. Building code
The FORTH, Inc. hot line
standards, for example, are enforced
Expert contract programming
by local governments. But Forth usage
and consulting services
remains voluntary. The Forth StanFrom FORTH, Inc., the inventors
dards Team went to special lengths to
of FORTH, serving professional
make this clear. Read the copyright
programmers for over a decade.
notice on Forth-83, to wit:
Also available for other popular
"The existence of a Forth Standard
mini and micro computers.
does not in any respect preclude anyFor more information contact:
one . . . from implementing, marketing, purchasing or using products,
processes, or procedures not conform2309 Pacific Coast Hwy.
ing to the Standard."
Herrnosa Beach,
The complainers probably are reacting to their perception of the transition
FICA TELEX: 275182
around them, and divert attention to
Eastern Sales Office
the ogre of enforced change when try1300 N. 17th St.
ing to cling to the past. My understandArlington, VA 22209

.

7031525-7778
Volume VII, No 2

7

F

NGS FORTH
FORTH,
OPTIMIZED FOR W E I B M
PERSONAL COMPUTER AND

A FAST

M-DOS COMPATIBLES.

STANDARD FEATURES
INCLUDE :
e79 STANDARD

.DIRECT 1/0 ACCESS

.FUIL ACCESS TO MS-DOS
FILES AND FUNCTIONS
mENVIRONME3IT SAVE

&m

OMULTI-SEGMENTED FOR
LARGE APPIJCATIONS
.EXTENDED ADDRESSING
.MEMORY ALLOCATION
CONFIGURABLE ON-LINE
.AUTO

LOAD SCREEN BOOT

.LINE

& SCREEN EDITORS

.DECOMPILER AND
DEBUGGING AIDS
08088 ASSEMBLER

.GRAPHICS & SOUND
eNGS ENHANCEMENTS
.DETAILED MANUAL
.INEXPENSIVE UPGRADES
eNGS USER NEWSA COMPLGTE m
mH
Dh'VEI;OPMEZV!P SYSTEM.

FOR TRS-80 MODELS 1,3,4,4P
IBM PCIXT, AT&T 6300, ETC.

\

THE COMPLETE FORTH
GETS A

MAJOR UPDATE:
MMSFORTH V2.4
A totat software envtronment: custom
drtvers for prtnter, video and keyboard
Improve speed and flexrblltty. (New TRS80 M.4 verston, toot)
Common SYS format gives you a big
395K (195K s~nglastded)per disk, plus a
boot track!
Common wordset (79-Standard plus
MMSFORTH extensfons) on all supported computers.
Common and powerful applications programs available (most wtth MMSFORTH
source code) so you can use them compatibly (with the Same data disks) across
all supported computers.
Very fast comptle speeds and advanced
program development environment.
A fantastic full-screen Forth Editor
Auto-Find (or -Replare) any word (forward or back). compare or Palrs-Edit
any two ranges of blocks, much more.
l Temporary dtctionary areas.
QUANs, VECTs, vectored I/O, and many
more of the latest high-performance
Forth constructs.
Manual and demo programs are bigger
and better than ever!
* Same thorough support: Users Newsletter, User Groups worldwide, telephone
tips. Full consulting services.
Personal Licensing (One person on one
computer) IS standard. Corporate Site
Licensing and Bulk Dtstrlbution Licenstng available to professional users.

NEW-IIP-150

& IIP-110

VERSIONS AVAILRBLE

IT'S BETTER THAN EVER.

The total software environment for
IBM PC/XT, TRS-80 Model 1 , 3 , 4
and close friends.
*Personal License (required).
MMSFORTHV2.4 Splem Dbk
$178.85
ITRS-W Modd 1 raqurss louercse, DDEN 1 4Utrack dnn, )

. . .

*Personal License (addit~onalmodules):
FORTHCOM commun~cat~ons
module . . . . $ 49.95
UTILITIES
............... a
9
5
GAMES . . . . . . . . . .
38.95
EXPERT-2expert system
69.95
DATAHANDLER . . . . . . . . . . . 59.95
DATAHANDLER-PLUS(PC only, 1 a K req )
99.95
FORnrWRtTE word p r w s w r . . . . . . 99.95
*Corporate Site License
Extensions
......
rmm$~,ooa
*Bulk Distribution
trorn $Soo/sounnr.

. .

*Some recommended Forth books;
19.95
STARTINGFORTH (programmmng)
THlNKfNGFORTH ItechnIqueJ
15.95
BEGINNINGFORTH (re MMSFORTH] . . . 16.95
Shlpp~ngfhandlmg& taxextra No returns onsoftware
Ask your dealer to show you the world of

....

.......

MMSFORTH, or request our free brochure.

NEXT GENERATION SYSTEM
PoOoBOX 2987
SANTA CLARA, CA. 95055
(408) 241-5909

For More Information
For information on the NC4000P
processor, contact John Golden at
Novix, 10590 N. Tantau Ave., Cupertino, California 95014; (408) 996-9363.
For data on the DynaCom VMS
Voicestar, contact John Cassady at
339-15th Street, Oakland, California
94612; (415) 763-6636.
MVP-Forth is distributed by Mountain View Press, Post Office Box 4656,
Mountain View, California 94040;
(415) 961-4103.
F83, the Laxen & Perry Model, is
available on diskette at $25 for IBM
PC, CP/M 8080 and 68000, from No
Visible Support Software, P.O. Box
1344, 2000 Center Street, Berkeley,
California 94704.
The Rochester Forth Conference is
held in June, organized by the Institute
for Applied Forth Research, Inc., 70
Elmwood Avenue, Rochester, New
York, 14611; (716) 235-0168.

~WJFORTH
.........

PRICES BTART AT $70

ing of the standards team's expression
is: if your application is done in a prior
standard, let it run. If you are considering new effort, and want it to have
the longest life, use the latest standard
available. As a professional, you have
a choice.
Next Issue
The clinic will resume addressing
reader inquires in the next issue. Machine-specific problems such as how to
install fig-FORTH on a VAX under
UNIX aren't of general interest. Questions should revolve around Forth, in
the manner of, "When 
0 @ 3 .RDEC .Iq - "
R> Q)W2DUP + >R
TYPE CR
;
: .#ON
(S ->
CaMPILE ( . # l a ) , I 4

.\ Menu U t i l i t y words

: (.M")

R>

(S ->
2DUP

+

)

>R

\Shwmuentry#O
\ Shaw item no zero
\ Step p a s t text f o l l w i n g
\ & display
) \ Canpile mnu item zero
; IMMEDIATE

2

-

Version 1

FVD28Apr84

\ Shcu un-numbered m u e n t r y
\ Step past text following
\ & display
\ Canpiling?

TYPE CR
;
: .Me' SrATE @ IF
COMPILE ( .MI' ) ,I'
ELSE
ASCII ,, WXD a c w p TYPE CR \ Show item text
ENDIF ; m I A T E
: M?
(S mix min -> no ) \ Get mnu selection (0-9 max)
ASCII 0 + S W ASCII 0 + \ S e t max & min a s d i g i t s
BEGIN KGi >R
\ Get selection & save
\ Infuture Check f o r ? o r Esc
2DUP R@ -ROT BFlWEEN O= \ Validate selection
WHILE R> MiOP REPERT
\ W i l e not v a l i d
\ Return number
2DROP R> ASCII 0 - ;

Figure One
First Version of Menu Word

-

-

.\ &US
Version 1 example
: .MIX DARK .MI1 MXSET Program" ;
: .MN4EN
(S ->
\ M i n Menu

FVD28Apr84

OM# M
. Hm
.M" -Main Menu-" CR
printer"
CR
#" Double density"
CR
.#Ogl Exit program" CR
m# @ 0 M?
\ G e t mnu s e l e c t i o n

.In Set

.

Building Menus

Three things are involved in menus:
(1) Display the text of the menu,
(2) accept the menu option selected
and (3) execute the code corresponding
to that selection.
Those are must-haves. For good
measure, we'll also throw in (4) a Help
facility and (5) the ability to back out
of a menu without selecting any of its
items.

- version

vAluA&E M#
\Noofmuitem&rnax
: . R D x BASE @ DECIMAL .R BASE ! ; \ Display d e c h l no
: OM# M# W F ;
\ Reset menu no t o zero
: (.#")
(S ->
\Definenunberedmuentry
1 M # +! M# @ 3 .RDK:
\ Show item no
R> 030NT 2DUP + >R \ Step Return addr p a s t text f o l l w i n g
TYPE CR
;
\ & display
: .#It
(S -> ) \ Canpile n u n b e r e d m u item
a3lL'ILE (.#"I ,"
; I.mEDIATE

r

\ Must be cunpleted w i t h CASE
Figure Two
Version One Example

15

FORTH Dimensions

I've included three versions of menu
words. Each successive version is more
elaborate and somewhat more difficult
to understand. This progression from
simple to reasonably complete is how I
developed the various ideas. (This code
is available on various RCP/M bulletin
boards. The file MXSET.BLK is a program written in F83 to configure the

Epson printer. Note that it is not a
complete program, but rather a "Study
in Menus." There is also EDITOR.BLK, a
Wordstar-compatible screen editor
that I adapted to F83 from the original
version published by Laxen in Dr.
Dobb's Journal, September 1981.)
Figure one shows the first approach.
It is concerned primarily with display-

.\ Menu support m r d s - Version 2: .A" !ANS
FVD28Apr84
!ANS
(S char -> 1 \ Save allowed response
PAD DUP C@ 1+ 2DUP SWAP C! + C! ; \ Update response list

:

: (.A")

(S

->

+

\ Display =nu item
\ Step p a s t text
EMIT \ Display l e a d char
\ & save a s a l h m e d response
lYPE CR ; \ Display rest
)

CDWT 2DUP
>R
1- StW DUP C@ DUP
!ANS

R>

DASH, FIND
6; ASSOCIATES

." - "

a

1t

(S

: .A"

COMPILE

->

( .A" )

\ Canpile m u item

)

,"

IMMEDIATE

;

O u r company, DASH. F I N D & ASSOCIATES.
is in the business of placing FORTH Programmers in positions su~tedto t h e ~ rcapabllitles.
We deal only with FORTH Programmers
and compan~esusing FORTH. I f you would
like to have your resum& included in our
data base, or i f you are looking for a
FORTH Programmer. contact us or
send your resumt to:

.\ Menu response mrds - (HELP), UKEY
DEFER (HELP)
\ Help word f o r ? response
(S -> A 1
KEY CUP ASCII a ASCII z FEZWEEN
IF ODF AIQ ENDIF
; \ Get upper case key

: UKEY

\ Reference no f o r Help

V?UUABLE HELP#

DASH. FIND di ASSOCIATES

8013 Dalworth. S u ~ t eB
Grand Prairle TX 75050
( 2 1 4 ) 642-5495

AW

Committed t o Excellence

FVD28Apr84

- Version 2: NEW-MENU
FVD28Apr84
(M-STK) OE MJDl' \ Stack of Menu RP@ & SP@
\ The kknu Stack (&SIX) m i n t a i n s exit RP@ & SP@ ad& f o r 6
\ l e v e l s of rnenus. This is used by M-EXIT to a b o r t c u r r e n t m u )
: SIX-MENU
( S -> 1
R> RP@ SP@ (M-SIX) WP @ 2+ + 21 \ RP@ f o r c a l l i n g w3
4 (M-STK) +! >R ;
: USTK-MrmU
( S -> RP@ SP@ )
-4 (M-STK) +! (M-STK) DW @ 2+ + 2@ ;
: NEW-Sm
( S help# -> )
0 PAD !
\ S e t new s e l e c t i o n , not r e t u r n addr
HELP# ! ;
\ S e t help reference
.\ Menu support mrds

VARIABLE

(S help#

: NEW-mu

NEW-SEL
STK-MENU

.\ Menu

->

;

- M-WT - Version

: Em-MENU

USTK-MENU

1

\ Clear screen & v a l i d responses
\ Where to r e t u r n to on Esc

2DROP

;

\

2

E d of m u

FVD29Apr84

- clear

s t a c k item

(S -> )
USTK-MENU Wm RP@ 1 ABORT" Wlg in unstacking menus"
U< ABORT" Menu unstack e r r o r "
SP! RP! ;
(S exit c u r r e n t =nu & r e t u r n to c a l l i n g l e v e l m u )

: M-EXIT

\ Note - Should work but does not.

FORTH Dimensions

16

Continued

Volume VII. No. 2

ing the menu. The word .#*I compiles
the text following it, and the run-time
word (.#"). The word (.#") displays that
text. It also displays the menu selection
number for that item.
M# is the variable for the menu item
number. .w3' and (.wH) are used for
menu item zero, if at all. M? accepts a
single digit, zero up to the maximum in
M#. The word .MII is used to display
an item without a number. It's like .I*
but with a built-in CR. The .#" word
is actually more complex than necessary. It does not have to be state dependent. That was done for some other
experiments.
This version does nothing to execute
the code for the selected option. You
have to define a CASE construct with
words for each option. Version one
works, but it did not satisfy me. I did
not like the numeric selection (difficult
to remember), and I wanted more
features.
A Better Version

Enter version two (see figure three).
Instead of using a counter, I used .AI*
and (.A9') - the successors to .#" and
- to build a list of valid response
codes in PAD. By convention, the first
character of the item text would be
displayed separately as the selection
character and would be added to the
list in PAD. The first byte in PAD counts
the number of entries.
In this version, I also added a Help
exit and an escape mechanism. MENUSEL accepts the input and validates it.
Valid responses are those in PAD, A C
(break) to abort, ? for help and Esc to
exit to the calling menu.
We still have the word@) to display
the menu, MENU-SEL to get a valid
response, and then a CASE to execute
the selection, based on the index returned by MENUSEL.
Have a look at figure four. This
is the main menu for the Epson set-up
program. How many items are displayed depends on the variable GTRAX.
(There are more options on the
printer with Graftrax than on the one
without.)
The problem is that now we have a
variable length list of codes and a fixed
(.#II)

Volume VII. No. 2

.\ Define m u s - Version 2
MENU-SEL ." ?
( 3 -> index

:

"

FVD28Apr84
)

BEGIN UKEY 0
\ Get key & set index
PAD O
D
W OiER t SWAP
\ Scan allowed responses
Do OVER I C@ =
\ -> char index flag
?LEaVE 1t LOOP
\ -> char index
PAD C@ 1- OWR <
\ Index past end? - yes
WHILE DROP
\ Drcp index, check specials
DUP 3 = ABORT" Break"
\ TerIni~teon ^C
DUP ASCII ? = IF' (HELP) ELSE
15 = IF M-I-MIT ENOIF
\ exit calling menu
BEEP ENDIF
\ No BEEP after Help
REPEAT SWAP EMIT CR ;
\ -> index
(P Accept input key, & mtch against acceptable list, returns in
dex. If not matched, abort on ^C, HELP on ?, exit on ESC. Exit
only on valid response.)
Figure Three
Enhanced Menu Words
:

.TITLE DARK

.

"

MXSET

-

Printer Setup" CR CR

;

(S -> )
(GTR) @ IF
\ Is this graftrax
.A" KReset printer to defaults"
.An LSet uni-directional print on/offN
.A" S e t bit 8 handling"
.Au S e t graphics &"
.A" OHprint head"
ELSE
.A" KSelect character set"
ASCII K DUP 2DUP !ANS !ANS !ANS !ANS \ Allign psn

: .MKm

ENDIF

;

\ Graftrax dependent features

.\ Define menus

E'VD29Apr84

(S -> 1
.TITLE
" Main Menu" CR CR
.A" ASet printer type"
.A" =elect dmracter font"
.A" CSet line spacing"
.A" S e t page size"
.A" S e t to top of form"
.A" FSet perforation skip"
.A" GSet out af paper signal"
.A" HPrint test"
.A" IKeyboard to printer"

: .MAIN

.

.MwlR
.A" zTo return to CP/M" ;

.\Menus - M N
10 CASE: :MAIN
MX80/100
InNT
KEYBOARD
BYE
8BIT
GRAPHIC

\ Options specific to GIBAX/not
\ Position dependent
EVD28Apr84
SPACING

PAGE

WET/OHAR

UNL

ONE-my-1

BYE

;

: MAIN

0 NFW-MENU BEGIN 0 NEVI-SEL
.MAIN 15 !ANS
\ Intercept Esc
MENU-S5 :MAIN
AGAIN ;
Figure Four
Examples Using Version Two Menu Words

17

FORTH D~mens~ons

(positional) CASE statement. Every
item in the menu had better always be
in the same spot. The ELSE clause in
.MNGTR enters dummy responses in PAD
to ensure its length does not change. If
Exit is the fifteenth word in the CASE,
then MENU-SEL had better always
return a 15 when Exit is selected!
The escape mechanism, too, was
troublesome. As a general facility, it
should clean up the stack as well as
exit. Since we are talking about returning t o a calling routine/menu, a simple
solution is to keep track of the position
on the stack before calling the lowerlevel routine. Should that lower-level
routine abort (error exit, etc.), simply
restore the stack pointer to that known
value.
I generalized this to cover both
stacks, and set up a little menu stack.
On this is kept the value for the two
regular stack pointers. This is to allow
nesting of menus and returning one
level at a time. I never did get it to
work. It should - the concept is sound
- but it is fragile code. Messing with
the return stack must be done just
right, or it will crash the system.

The Ultimate Version
Fortunately, by this time I had solved the problem. Version three is a
little more complicated, but much
more readable. It actually works.
In version three, the menu items and
the corresponding execution word are
combined. There is no CASE statement.
Have a look at the sample in figure six
first. .A" is now called .AX'' and is followed by the name of a Forth word
first and then by the text. (.AX") now
not only puts the response code in PAD
but also the address of the word that is
to be executed should that code be
selected. The first byte in PAD still
counts the entries, which are now three
bytes long.
We have removed the positional
dependence of the CASE statement.
MENUSEUC gets the answer, validates it
and executes the word whose address is
stored immediately following. We have
also done away with the menu stack. If
the option is Esc, do nothing; don't

FORTH D~mensions

should be cleaned up and the menu
restored. I've done this by passing the
address of the word that displays the
menu to MENU-SELX, which will reexecute it after Help has been invoked.
There it is. I hope it is of use to
others as well. Feel free to use this code
for any purpose that is legal and moral.

execute any word, merely return to the
calling word/menu.
The Help concept is shown here in its
more rudimentary form, a word called
from MENU-SEL when ? is pressed. It
uses the variable HELP# as set in each
menu by NEW-MENU or NEW-SEL. The
number in HELP# would indicate what
help information is relevant for that
specific menu.
The one limitation I am aware of
(and have fixed since) is that after a
Help message is displayed, the screen

Acknowledgments

The Forth dialect used is Forth-83 as
implemented by Henry Laxen and

.\ Menu s u p p o r t w r d s - Version 3: .AX" !AN=

FVD28Apr84
( S ad& c h a r -> )
\ Save allowed response
PAD COUNT 2DUP 3 + SWAP 1- C!
\ Update count byte
+ DUP 1+ -mr ! ! ;
(P !AN= stores m n u char & rtn addr in pad, updates o f f s e t )
: (.AX")
(S ->
)
\ Display m n u i t e m
R> DUP @ S A P 2+
\ -> mrd, text a d d r
COUNT 2DUP + >R
\ Step r e t u r n addr p a s t text
SNAP DUP C@
\ Get lead char
DUP EMIT -ROT
- " \ -> addr char a u n t addr
1+ SW 1- TYPE CR
\ Display rest -> w r d a&,
char
!AN=
;
\ & s a v e as allowed response
(P D i s p l menu item & store its select. char & rtn addr i n PAD)
: .AXt1
(S -> )
\ C a n p i l e m u mrd & text i t e m
EMPILE (.AXw)
\ l w v e s ( . A X w ) , w r d , text
[CDPILEI ' , ,I'
;
IMMEDIATE

: !ANSX

."

.\ Define -us
: MENU-SELX

3

Version

." ?

(S

"

->

FVD28Apr84
)

BEGIN UKEY 0
\
PAD C O W OVER +
\
Do OVER I C@ =
\
?L!ZAVE 3 + 3 +IIXIP
\
PAD C@ 1- OVER <
\
WHILE IXOP
\
DUP 3 = ABORT" Break"
\
DUP ASCII ? = W(HELP)
1B = IF EXIT ENDIF
\
REPmT M A P ENIT
PAD + 2+ @ M E W E

'

CR

HELP I S

c h a r index f l a g
c h a r index
Index p a s t end? - y e s
Drcp index, check s p e c i a l s
Terminate on -C
ELSE

HELP# @

\ -> index

CR

- HELP

.\ Define =us

->
->

exit MENU-SEJX
\ No BEEP after Help

BEEP ENDIF

: HELP

Get key & set index
Scan allowed responses

;

\ Get selected wrd addr

." See h e l p no:

"

. CR

FVD28Apr84
;

(HELP)

Figure Five
Execution Version of Menu Words

18

Volume VII, NO. 2

Multiuser/Multitasking

for 8080,280,808.6

Michael Perry. It is readily adaptable
to fig-FORTH, etc., though I don't
know why anyone with an 8080/Z80
system would use anything other than
Laxen and Perry's F83.
For those who are not aware, these
two gentlemen implemented a metacompiled version of Forth per the
83-Standard and put it in the public

.\ Menus

- using

domain. It includes all kinds of bells
and whistles, is one of the best Forth
systems around, and the price is hard
to beat. Most RCP/M computer bulletin boards around North America
carry it as library SIGM 154A.LBR and
SIGM154B.LBR. Thanks Henry!
Thanks, Michael!

: MX80/100

E'VD28Apr84

version 3

: MX8GX MX80 GWFTRAx ; : MXlOGX MXlOO GRAFTRAX
: MX8m MX80 NXTRAX ; : M
X
O
lm MXlOO NXXRAX

;
;

."

2 NEW-SEL .TITLE
S e t P r i n t e r Type" CR CR
.AX" MX8W ASet MX80"
.AX" MX8GX S e t MX80 w i t h Graftrax"
.AX" MXlONCX C s e t MX100"
.AX" MXlOGX DSet MXlOO with Graftrax"
m-SELX ;
\ Note t h a t , I 8 used w i l l n o t skip leading blanks, hence m l y
\ one blank before menu text (applies to .A" ard .AXw)

TaskFORTH,.
The First
Professional Quality
Full Feature FORTH
System at a micro price*

LOADS OF TIME SAVING
PROFESSIONAL FEATURES:

a Unlimited number of tasks
Q Multiple thread dictionary,

superfast compilation

.\ Mus

- Line

spacing, Page s i z e

FVD28Apr84

: SPACING
3 NEW-SEL .TITLE
S e t Line Spacing" CR CR
.AX" LS-6 A S e t 6 lines per inch"
.AXw LS-8 W e t 8 l i n e s per inch"
.AX" LS-72 C S e t l i n e spacing in 1/72 inch increments"
(GTR) @ I F
.AX"
LS-10 BSet 10.3 lines per inch"
.AX"
LS-216 DSet l i n e spacing i n 1/216 inch increments"
.AX" LS-216-1 S e t 1 l i n e spacing in 1/216 inch increments"
mIF' MENU-SELX ;
: PAGE
Set Page Size" CR CR
4 NEW-SEL .TITLE
FG-LN ASet page l e n g t h i n l i n e s "
.AX"
FG-IN Set page length in inches"
.AXn
.AX" FG-WLYl'H S e t page width in &aractersto MENU-SELX
;

.

.

Figure Six
Sample of Execution Version of Menu Words

.

a Novice Programmer
Protection package^^

a Diagnostic tools, quick and
simple debugging
Q Startlng FORTH, FCRTH-79,

FORTH-83 compatible
Q Screen and serial editor,

easy program generation

a

Hierarchical file system w ~ t h
data base management

' Stafler package 5250 FUN package $395 Slngle
user and commercal llcaoses ava~laSle

If you are an experienced
FORTH programmer, this is the
one you have been waiting for!
If you are a beginning FORTH
programmer, this will get you
started r~ght,and quickly tool
Available on 8 inch disk
under CP/M 2.2 or greater
also
various 51h" formats
and other operating systems
FULLY WARRANTIED,
DOCUMENTED AND
SUPPORTED
DEALER
lNOUlRES
IhilITED

=

Shaw Laboratories, Ltd.
24301 Southland Drive, #216
Hayward, California 94545
(415) 276-5953
Volume VII, No. 2

October 23, 1985 - November 3, 1985

FORML
Forth Modification Laboratory
presents

EuroFORML Conference
Stettenfels Castle
Heilbronn, Federal Republic of Germany
Followed by

SYSTEMS Trade Fair, Munich
Computers and Communications 9th International
Trade Fair and International User's Congress
and
Selected sightseeing tours and entertainment in Germany
International technical conference October 25-27, 1985 Stettenfels Castle
Software Metrics - Programs and methods to measure program performance, complexity,
structure, programmer productivity, development methods, models, tools, program verification
aids, and procedures. Individual participation is encouraged and attendees are requested to submit
a conference paper. Conference proceedings will be published.
SYSTEMS 'Ikade Fair October 28 - November 1, 1985 Munich Fair Grounds
Computers and Communications - This is a major international event covering computers and
communications. The trade fair is scheduled October 28 through November 1, 1985.
Guest and Tour Program - A complete program will be available for guests not attending the
technical conference sessions. Sightseeing escorted tours are planned for the group.
Reservations, authors instructions, itinerary, special group rate - Write to EuroFORML, Forth
Interest Group, Post Office Box 8231, San Jose, CA 95155 or telephone the FIG Hotline (408)
277-0668. East and West Coast departures are planned. Advance reservations are required.

West Coast Departure
$1995.00

East Coast Departure
$1795.00

FORTH INTEREST
GROUP MAIL ORDER FORM
P.O. Box 8231 San Jose, CA 95155 (408)277-0668

I

IN THE FORTH INTEREST GROUP
107 - MEMBERSHIP in the FORTH INTEREST GROUP & Volume 7
of FORTH DIMENSIONS. No sales tax, handling fee or
discount on membership. See the back page of this order
form.

The annual membership dues are based on the membership year, which
runs from May 1 to April 30.

I

When you join , you will receive issues that have already been circulated
for the current volume of Forth Dimensions and subsequent issues will be
mailed to you as they are published.

The Forth Interest Group is a worldwide non-profit member-supported
organization with over 5,000members and 80chapters. FIGmembership
includes a subscription to the bi-monthly publication, FORTH Dimensions.
FIG also offers its members publication discounts, group health and life
insurance, an on-line data base, a job registry, a large selection of Forth
literature. and many other services. Cost is $20.00 per year for USA.
Canada & Mexico; all other countries may select surface ($27.00) or air
($33.00) delivery.

You will also receive a membership card and numberwhichentitles you to
a 10% discount on publications from FIG. Your member number will be
required to receive the discount, so keep it handy.

HOW TO USE THIS FORM
1. E a c h i t e m y o u w i s h t o o r d e r l i s t s t h r e e d i f f e r e n t Price categories:

C o l u m n 1 - U S A , Canada, M e x i c o
C o l u m n 2 - Foreign Surface Mail
C o l u m n 3 - Foreign Air Mail

2. Select t h e i t e m a n d n o t e y o u r p r i c e i n t h e s p a c e provided.
3. A f t e r c o m p l e t i n g y o u r s e l e c t i o n s e n t e r y o u r o r d e r o n t h e f o u r t h p a g e o f t h i s f o r m .
4. D e t a c h t h e f o r m a n d r e t u r n it w i t h y o u r p a y m e n t t o The Forth Interest Group.

An excellent source of references to articles about
Forth throughout microcomputer literature. Over 1300
references.

FORTH DIMENSIONS BACK VOLUMES
The six issues of the volume year (May -April) bound in a single text.

101 - Volume 1 FORTH Dimensions (1979180) $15116118 102 - Volume 2 FORTH Dimensions (1980181) $15116118 -

ASSEMBLY LANGUAGE SOURCE CODE LISTINGS

103 - Volume 3 FORTH Dimensions (1981182) $15116118 104 - Volume 4 FORTH Dimensions (1982183) $15116118 -

Assembly Language Source Listings of fig-Forth for specific CPUs and
machines with compiler security and variable length names.

105 - Volume 5 FORTH Dimensions (1983184) $15116118 -

513 - 1802lMARCH 81 . . . . . . . . . . . . . . . . . . . . $15116118 -

106 - Volume 6 FORTH Dimensions (1984185) $15116118 -

514 - 6502lSEPT 80 . . . . . . . . . . . . . . . . . . . . . .$15116118 515 - 6800lMAY 79.. . . . . . . . . . . . . . . . . . . . . .$15116118 -

REFERENCE

516 - 6809lJUNE 80 . . . . . . . . . . . . . . . . . . . . . . $15116118 -

305 - FORTH 83 STANDARD . . . . . . . . . . . . . . .$15116118 The authoritative description of 83-Standard Forth. For
reference, not instruction.

518 - 80861001MARCH 81 . . . . . . . . . . . . . . . . .$15116118 519 - 9900lMARCH 81 . . . . . . . . . . . . . . . . . . . .$15116118 520 - ALPHA MlCROlSEPT 80.. . . . . . . . . . . . .$15116118 521 - APPLE IllAUG 81.. ..................$15116118 522 - ECLIPSEIOCT 82.. ..................$15116118 523 - IBM-PCIMARCH 84. . . . . . . . . . . . . . . . . . $15116118 -

517 - 8080lSEPT 79 . . . . . . . . . . . . . . . . . . . . . . $15116118 -

300 - FORTH 79 STANDARD . . . . . . . . . . . . . . . $15116118 The authoritative description of 79Standard Forth. Of
historical interest.
316 - BIBLIOGRAPHY OF FORTH REFERENCES
2nd edition, Sept. 1984 . . . . . . . . . . . . . . $15116118 Volume VII, No. 2

21

FORTH Dimensions

524 - NOVAIMAY 81 . . . . . . . . . . . . . . . . . . . . . . $15116118 -

FORML CONFERENCE PROCEEDINGS

525 - PACEIMAY 79 . . . . . . . . . . . . . . . . . . . . . . $15116118 -

FORML PROCEEDINGS- FORML (the Forth Modification Laboratory) is an
informal forum for sharing and discussing new or unproven proposals
intended to benefit Forth. Proceedings are a compilation of papers and
abstracts presented at the annual conference. FORML i s part of the Forth
Interest Group

310 - FORML PROCEEDINGS 1980 . . . . . . . . . . $25128135 Technical papers on the Forth language and extensions.

BOOKS ABOUT FORTH

31 1 - FORML PROCEEDINGS 1981 (2V) . . . . . . $40143145 Nucleus layer, interactive layer, extensible layer,
metacompilation, system development, file systems,
other languages, other operating systems, applications
and abstracts without papers.

200 - ALL ABOUT FORTH . . . . . . . . . . . . . . . . . $25126135
Glen B. Haydon
An annotated glossary for MVP Forth; a 79-Standard
Forth.

312 - FORML PROCEEDINGS 1982 . . . . . . . . . . $25128135 Forth machine topics, implementation topics, vectored
execution, system development, file systems and
languages, applications.

205 - BEGINNING FORTH . . . . . . . . . . . . . . . . . . $17118121 Paul Chirlian
Introductory text for 7SStandard.
215 - COMPLETE FORTH . . . . . . . . . . . . . . . . . . $16117120 Alan Winfield
A comprehensive introduction including problems with
answers. (Forth 79)

313 - FORML PROCEEDINGS 1983 . . . . . . . . . . $25128135 Forth in hardware, Forth implementations, future
strategy, programming techniques, arithmetic & floating
point, file systems, coding conventions, functional
programming, applications.

220 - FORTH ENCYCLOPEDIA . . . . . . . . . . . . . . $25126135 Mitch Derick & Linda Baker
A detailed look at each FIG-Forth instruction.

314 - FORML PROCEEDINGS 1984 . . . . . . . . . . $25128135 Expert systems in Forth, using Forth, philosophy,
implementing Forth systems, new directions for Forth,
interfacing Forth to operating systems, Forth systems
techniques, adding local variables to Forth.

225 - FORTH FUNDAMENTALS, V. 1 . . . . . . . . $16117120 Kevin McCabe
A textbook approach to 79 Standard Forth.
230 - FORTH FUNDAMENTALS, V. 2 . . . . . . . . $13114116 Kevin McCabe
A glossary.
233

--

ROCHESTER PROCEEDINGS

- FORTH TOOLS . . . . . . . . . . . . . . . . . . . . . . $19121123 -

The Institute for Applied Forth Research. lnc. is a non-profit organization
which supports and promotes the application of Forth. It sponsors the
annual Rochester Forth Conference.

Gary Feierbach & Paul Thomas
The standard tools required to create and debug Forthbased applications.

321 - ROCHESTER 1981 (Standards Conference) $25128135 7SStandard, implementing Forth, data structures,
vocabularies, applications and working group reports.

237 - LEARNING FORTH. . . . . . . . . . . . . . . . . . . $17118121 Margaret A. Armstrong
Interactive text, introduction to the basic concepts of
Forth. Includes section on how to teach children Forth.

322 - ROCHESTER 1982
(Data bases & Process Control). ...... $25128135 Machine independence, project management, data
structures, mathematics and working group reports.

240 - MASTERING FORTH ................. $18119122 Anita Anderson & Martin Tracy (MicroMotion)
A step-by-step tutorial including each of the commands
of the Forth-83 International Standard; with utilities,
extensions and numerous examples.

323 - ROCHESTER 1983 (Forth Applications) . $25128135 Forth in robotics, graphics, high-speed data acquisition,
real-time problems, file management, Forth-like
languages, new techniques for implementing Forth and
working group reports.

245 - STARTING FORTH (soft cover). . . . . . . . $20121122 Leo Brodie (FORTH, Inc.)
A lively and highly readable introduction with
exercises.

324 - ROCHESTER 1984 (Forth Applications) . $25128135 Forth in image analysis, operating systems, Forth chips,
functional programming, real-time applications, crosscompilation, multi-tasking, new techniques and working
group reports.

255 - THINKING FORTH (soft cover) . . . . . . . . $16117120 280 THINKING FORTH (hard cover) . . . . . . .$23125128 -

-

-

Leo Brodie
The sequel to "Starting Forth". An intermediate text on
style and form.

-

265 THREADED INTERPRETIVE LANGUAGES$23125128 R.G. Loeliger
Step-by-step development of a non-standard 2-80 Forth.
270 - UNDERSTANDING FORTH ............ $3.501516 Joseph Reymann
A brief introduction to Forth and overview of its
structure.
FORTH Dimensions

22

Volume VII, No. 2

SELECTED PUBLICATIONS

THE JOURNAL OF FORTH APPLICATION & RESEARCH
A refereed technical journal published by the Institute for Applied Forth
Research, Inc.

The following publications are recent additions to the Forth lnterest
Group Order Form as selected by the FIG Publications Committee.

401 - JOURNAL OF FORTH RESEARCH V.l #1$15116118 Robotics.

LEARNING FORTH. A Self-Teaching Guide by Margaret A. Armstrong.
Learning FORTH takes you step-by-step through the various
stages of programming, using a payroll program as an example.

402 - JOURNAL OF FORTH RESEARCH V.2 #1$15116118 Data Structures.

In addition to developing a basic working knowledge of the
language, Learning FORTHteaches good programming style and
easy debugging techniques. There's also a section on how to
teach children to use Forth.

403 - JOURNAL OF FORTH RESEARCH V.2 #1 $15116118 Forth Machines.
404 - JOURNAL OF FORTH RESEARCH V.2 #2 $15116118 Real-Time Systems.

1 1 4 FORML CONFERENCE PROCEEDINGS
The sixth annual FORML Conference was held November 23-25,
1984 at the Asilomar Conference Center i n Monterey. California,
USA. Excellent articles in this volume include two papers on
Expert Systems which won the acclaim of theparticipants. Many
papers contain code you can use immediately, and some are
philosophical papers which present challenges for the future of
Forth.

405 - JOURNAL OF FORTH RESEARCH V.2 #3 $15116118 Enhancing Forth.
406 - JOURNAL OF FORTH RESEARCH V.2 #4 $15116118 Extended Addressing.

REPRINTS

FORTH-83 REFERENCE CARD
The Forth-83 Handy Reference Card is now available free of
charge with any order. If you are not placing an order and wish to
receive a card, please send aself-addressed, stamped envelope
and we will be happy to send you one. Many thanks to Robert
Berkey and Dave Kilbridge for compiling, designing and producing the card.

420 - BYTE REPRINTS . . . . . . . . . . . . . . . . . . . . . . . $51617 Eleven Forth articles and letters to the editor that have
appeared in Byte magazine.
421 - POPULAR COMPUTING 9183.. ...........$51617 Special issue on various computer languages, with an
in-depth article on Forth's history and evolution.

DR. DOBB'S
PUBLICATIONS SURVEY

This magazine produces an annual special Forth issue which includes
source-code listings for various Forth applications.

423 - DR. DOBB'S 9183.. . . . . . . . . . . . . . . . . . . . . .$51617 -

If you would like to suggest any other publication for review by
the FIG Publications committee for inclusion in the Forth Interest
Group Order Form, please complete the information below and
return to FIG.

424 - DR. DOBB'S 9184.. . . . . . . . . . . . . . . . . . . . . .$51617 -

Title:

422 - DR. DOBB'S 9182. . . . . . . . . . . . . . . . . . . . . . .$51617 -

Author:

HISTORICAL DOCUMENTS

Publisher:

501 - KlTT PEAK PRIMER.. . . . . . . . . . . . . . . . .$25127135 One of the first institutional books on Forth. Of historical interest.

Comments:

502 - FIG-FORTH INSTALLATION MANUAL . . $15116118 Glossary model editor - We recommend you purchase
this manual when purchasing the source-code listings.

Your comments on any of the publications we currentlycarry are
most welcome, please complete information below.
Title:

MISCELLANEOUS
601 - T-SHIRT SIZE
(small, medium, large, extra large)

Comments:

$10111112 -

. . . . . . . . . . . . . . .$15116118 616 - HANDY REFERENCE CARD . . . . . . . . . . . . . . . FREE 683 - FORTH-83 HANDY REFERENCE CARD . . . . . . FREE -

602 - POSTER (BYTE Cover)

Volume VII, No. 2

23

FORTH Dimensions

Another Subroutine Technique
Donald Simard
Severn, Maryland
David Held's article and subsequent
letter (Forth Dimensions V/3 and V/5)
concerning code definitions callable by
colon and code definitions, provided a
very u s e f u l t e c h n i q u e . A f t e r
understanding his ideas, I came up
with a variation which avoids some of
the inherent execution-time overhead
when his method is used from a colan
definition.

I

1

Name
Fleld

L l n k Code machlne
f ~ e l d F i e l d code

1

Using Mr. Held's technique from a
colon definition required storing the
address of the subroutine that he wanted to call into the calling routine each
time that word is executed. This overhead can be eliminated. Figure one
illustrates what a subroutine definition
will look like after being compiled
using the defining words presented
here.
One can see that the code field points
to a JSR to the parameter field address.
The code that is then to be executed
must be a machine language subroutine
and must return accordingly. When the
word is called from a colon definition,
the inner interpreter will be directed
through the code field to the JSR PFA.
When the machine language subroutine in the parameter field returns a
JMP then NEXr is executed, which is
the normal exit for CODE definitions.
If the subroutine is to be used from a
code definition, first it is necessary to
use ' to find the PFA, then JSR to this
address.
The execution overhead associated
with this technique is just an extra JSR
and RTS from a normal colon definition; there is no overhead from code
definitions. The extra memory required is the four bytes for the JSR and JMP
in the definition.

Volume VII, No. 2

RTS

2

Figure One

: SUB

,

C CUMPI L E I ASSEMBLER
CREATE SMUDGE
LATEST PFA CFA

: END-SUB
ASSEMBLER
HERE OVER !
CCOMPILEI ASSEMBLER
2+ J S R , NEXT JMP,
END-CODE
3

EXAMPLE :
SUB TEST
4 1 # LDA,
P R I N T JSR,
RTS

EI.ID-SIJB

,

CALLED FROM COLON:
: PRINT. 1
TEST

CALLED FROM C:ODE :
CODE P R I N T . l
.''
TEST JSR,
t.IE'!<';T ,jp.;P
END-CODE

,

25

FORTH Dimensions

PORTIIII UNTEWE8.TGROUP PRESENTS,
Forth National Convention
September 20

-

21, 1985

Complete conference program, educational seminars,
and commercial exhibits.

Hyatt Rickeys in Palo Alto, California USA

euroFORML Conference
October 23, 1985

- November

3, 1985

International Technical conference at Stettenfels Castle
SYSTEMS Trade Fair in Munich
Guest and Tour Program in Germany
Complete group travel arrangements from USA to Germany
and return.

Forth Modification Laboratory
November 29, 1985

- December

1, 1985

A technical conference for advanced Forth practitioners.

Asilomar Conference Center
Monterey Peninsula overlooking the Pacific Ocean
Pacific Grove, California USA
Complete information available from the Forth Interest Group.

I

The Mirth Dimension
: PROJECTDIRECTOR

EXPECT UPDATE VERSION , WARNING IF SILENT
TOGGLE WRITE-CHECK AND EXPECT COLD HANDSHAKE
ELSE COMPILE AGAIN AND B SILENT ;

: FORTH-PROGRAMMER

TRAVERSE COLD SILENT OUTER SPACE AND CREATE
RANDOM DEFINITIONS ;

: FORTH-SOURCECODE

EMIT RANDOM WORD AND REPLACE ERROR UNTIL
SPACE = MAX LIMIT OR TIME OVER ;

- Scott Heiner &
Steve Gledhill
FORTH Dimensions

26

Volume VII, No. 2

I

Hacker's LOCKER
Cecil McGregor
Santa Clara, California
Many times, when debugging Forth
code, it is convenient to use small
"throw away" parts that will not be
used in the later, bug-free version. This
could include a few lines of output that
would be handy to keep on the display,
or portions of a dump to compare with
something else. It is not always desirable to edit this onto a screen and
reload from that for changes, nor is it
always convenient to print it as hard
copy. These small gems then scroll off
the top of the screen. Or perhaps you
are looking at the stack and would like
to keep it around while you scrounge
about analyzing a bug. A few lines of

typing and it, too, goes off the top of
the screen.
If you have a terminal that permits
line lock (such as a TeleVideo 950 and
many others) you can simulate a window that will lock the contents of the
line until you release it. Scrolling will
then ignore these locked lines. While
the appearance is rather odd at first,
the usefulness is great.
To implement this, you must look in
your terminal manual for the codes
that will lock a line, unlock a line or
screen, move up and down a line. As
can be seen in the accompanying code,
the word LINE-LOCK locks; and the
word SCR-UNLOCK unlocks the entire
screen. The constants UP-ARROW and
DN-ARROW move the cursor up and

down a line, respectively. Each of these
is terminal dependent and must be
tailored to your terminal.
The word LOCKER gets a keystroke,
and moves up or down a line if the up
and down arrows are input. UP-ARROW
and DN-ARROW allow positioning of the
cursor onto the line to be locked. Striking an "L" will cause the current line
to be locked; a "U" will unlock the
entire screen; and any other key will
exit LOCKER.
This screen will compile under figFORTH and Laboratory Microsystems' 83-Forth, and it should be easily
transportable to almost any standard
Forth. If your terminal has line-lock
capabilities, you will like this utility.

11. 0
(3 \ LJ3C:t::ER -- lock/ur111:11:k: 1 i r 1 e 5 ctrl p a g e
1-:kiM3 1.-ll.lt-5:4.
1
HEX
2 : 1. 1NE-LlIlC:K
( --.)
( TV95(3 r n r ~ t r r ~
t ol 1ol:I:.
a lirle )
:3
1B EMIT
21 E M I T
:31 E M I T ;
4 : SIZR-LINL..OT;K ( ----- ) ( TV95O ~:ctrttr.~:,l tl:~1.1r11clcI:.e r 1 t i r . p c;~:r.i-en )
5
1B EMIT
2 1 EMIT
3% E M I T ;
15 (3E CIIINSTANT I-IP-ARRIIIW
J b rIrINSl-fiNT rIN-fiRFrnW
7 : LOCKER ( --- ) ( s e l e c t i v e l . . , > loci:: l j . r ~ e slrlrl 1:r.t )
8
H E G I N KEY
~7
n!F I-IF'-ARROW = J F
EMIT
El.:;F
( rnsvc. I.IP
10
DI.IF DN-ARROW = I F
EMIT
EL.:5F
( rntr~ve ~j
i010r1 )
3. 1.
13l-IF 4 C ( L ) = 1 F TI~?IX' 1 I NE-L.OC:l:::
El.F;E(
lock
)
12
nlJP 55 ( IJ ) = T F Df?I:SP SCR -I.!Nl OI~P:
El..-SF: ( 5 r r I.J rl 1 i t c k )
3: :1
ISRClP 131-1J T
( a rl ;i. n t he r. 1::e .Y. e ::.: i. f s
)
14
THEN THEN THEN THEN
15
A G A I N ; DEC:IMAL-

'7 c r e e rl #

.

VolumeVII, No. 2

27

FORTH Dimens~ons

Mass Transit Forth
From June onwards, some bus stops up with the user as he keys in a long
in the resort and retirement town of numeric string.
Weston-super-Mare, Somerset, U.K.,
The terminal can be used both for
will never be at a loss for words.
Waiting passengers will hear a quiet entering data and instructions and for
beeping and, if they then press a button receiving prompts from the laboratory
at the source of the sound, a computer. For example, it could give
personable female voice will announce the operator a cue about what reading
the time of day, what buses are using to make next or indicate that a reading
is out of range. The terminal
that stop and when they are due.
communicates with the laboratory
When a bus is running off schedule, computer systems through a n
inductive loop sensors buried in the RS-232-C interface at 9,600 bits per
road interrogate circuitry in the bus second or through an IEEE-488 port.
cab to identify it. The microprocessor
Triangle has now acquired rights to
controller in the speech synthesizer
scans the sensor, detects the oncoming the terminal from NPL and is also
bus and a voice will announce negotiating with the Department of
something like, "The bus now Transport for the rights to the passengapproaching is a No. 10." Meanwhile, er advisory service, which clearly has
the controller figures out when the next potential applications in road, rail and
airplane terminals, just for starters.
one is due.
For those companies with Sufficient
London-based Triangle Digital Services Ltd., a one-man outfit set up by expertise to assemble their Own SysPeter Rush, developed the prototype tems, Triangle also Sells its various
hardware for the system. Formerly a board products directly. One is a
product manager with General Instru- speech-synthesizer board that can be
ment Microelectronics Ltd., Rush set operated directly from relay contacts,
up shop to provide a systems service to asynchronous links over twisted pairs
or parallel binary-coded decimal
potential users of voice systems.
inputs.
He has developed a custom speech
chip using a digital logic array. This is
mounted on a self-contained Eurocardsized board. To go with it, there is a Forth Talk
Forth-language microcomputer board.
Triangle has also developed a Forth
Rush says he chose Forth because its
development
board based on a Hitachi
high-level-language capability speeds
6303
a
complementary-MOS
variant
development work.
of a Motorola part - and running
Using the speech-synthesizer board Triangle's own Forth system. The
and the microcomputer board (which board is a useful tool for real-time
serves as its own development system), applications, since multi-tasking
Rush can quickly meet a customer's programs can be written in a high-level
requirements, even tailoring the voice language.
to the applications. For Britain's
National Physical Laboratory, for
Moreover, users can extend the
example, Triangle has developed a language as they go along, building
handheld keypad with sixteen-digit their own expertise into their systems.
alphanumeric display. It is used to Rush has used this feature to develop
check readings as they are entered into progressively more sophisticated
the laboratory computer. With the speech-control algorithms. The result
synthesizer speaking in a brisk manner has been speech with very acceptable
with truncated enunciation, it can keep quality.

FORTH Dimensions

28

The Department of Transport system
shows off the microcomputer's multitasking capability. First, it keeps a
calendar that tracks the minute, hour,
day and month. It responds to changes
in summer and winter schedules and
switches to the appropriate timetable.
Second, it scans the inductive loop
sensors and decodes the detected signal. Next, it controls the speechsynthesizer chip's vocabulary and
adjusts the volume to compensate for
ambient noise levels. "The lady shouts
when a lorry goes by," says Rush.
There is also a switched-capacitor-filter
board with a twelve-decibel-per-octave
cut-off.
-Kevin Smith

Reprinted from Electronics, May 31,
1984. Copyright @ 1985, McGrawHill, Inca A& rights reserved.

Volume VII, No. 2

Now You Can Add

ARTIFICIAL
INTELLIGENCE
To Your Programs Using a Powerful Combination

- - -

By Elliot Schneider & Jack Park

Heres Your Chance t o Profit by being on
the Forefront, Write 5th Generation Software
Easy Graphics & Sound Words

Learn How To:
Create Intelligent
Programs
Build Expert Systems
Write Stand Alone License
Free Programs

Construct
Rule Bases
Do Knowledge
Engineering
Use Inference Engines

Write Intelligent Programs For:
Home Use
Robotics
Medical Diagnosis
Education
Intelligent CAI
Scientific Analysis
Data Acquisition

Easy Control of all I/O.. .

Data Analysis
Business
Real Time
Process Control
Fast Games
Graphics
Financial Decisions

RS232 Functions
Access all C-64 Peripherals
Interactive Interpreter
Forth Virtual Memory
Full Cursor Screen Editor
Full String Handling
Trace & Decompiler
Conditional Macro
Assembler

Double Precision 2E+38 with Auto. Sci Not.
nxexLogx Loge Sin Cos Tan SQR 1/X. ..
Matrix and Multidimensional Lattice Math
Algebraic Expression Evaluator

Interactive Compiler
Romable Code Generator
40K User Memory
All Commodore File Types
Conversational User
Defined Commands

Great Documentation

SUPERFORTH 64+AI
LISP

-

Easy to Read 350 pg.
Manual with Tutorials
Source Screen Provided
Meets all MVP Forth-79
Industrial Standards
Personal User Support

LOGO
C

PASCAL

B&C
FORTRAN
ASSEMBLER

-

.-. .

I

A Total
Integrated Package
for the Commodore 64

SuperForth 64 Saves You
Time and Money

Ordering Information: Check Money
Order (payable to MOUNTAIN VlEW
PRESS INC ) VISA Mastercard.
Amer~canExpress COD s $5 00 extra
No b ~ l l ~ norg u n p a ~ dPO'S C a l ~ f o r n ~ a
res~dentsadd sales tax S h ~ p p ~ ncosts
g
In US Included In prlce Fore~gnorders
pay In US funds on US bank Include
for handl~ngand s h ~ p p ~ n$10
g

"Parsec Research
Commodore 64 TM of Commodore

Interrupt Routines

Utilities

Extended Math Functions
Fast ML Floating Point & Integer Math

SuperForth 64 is more
powerful than most other
computer languages

Turtle Graphics
Koala Pad Graphics
Integrator
Hires Circle, Line, Arc
Music Editor
Sound Control

Hires Plotting
Windows
Split Screen
Printer/Plotter Ctrl
Sprite & Animation
Editor

Call:
SPECIAL
INTRODUCTORY OFFER
only

$990°

20330Value

Limited Time Offer

(415) 961-4103
MOUNTAIN VlEW PRESS INC
PO. Box 4656
Mt. View, CA 94040
Dealer for

PARSEC RESEARCH
Drawer 1776, Fremont, CA 94538

Part Two

Forth Spreadsheet
Craig A . Lindley
Manitou Springs, Colorado
!

4
c1 09/2!184 \ spreadsheet

0 \ spreadsheet - loader block
1
2 dark ( Spreadsheet Compiling)
3
4 ! 45 +thru

.

warning o f f

variable
variable
variable
variable
variable
variable

C

J

b ;is
7 load the spreadsheet i n t o the f o r t h
8 i f you wish t o save the spreadsheet,
9
0
' spreadsheet i s boot
1
save-system f ilename.com

dictionary
do so as follows:

-

constant & v a r i a b l e declarations

lode-41 ag
order-f lag
format-flag
cur-col
cur-row
col-disp

\ auto c a l c u l a t e f l a g
\ c a l c u l a t i o n order f l a g
i number output f o r n a t f l a g
\ top l e i t display colunn I
'i top l e f t display row

! cur-col on d i s p l a y
\ rou
displaceaent from
\ cur-row on d i s p l a y
\ beginning o f formula area
\ operator stack f o r algebraic
\ equation c o r p i l a t i o n

v a r i a b l e dict-mark
variable op-stack 44 a l l o t

1

3 t h i s w i l l save the e n t i r e f o r t h system aiofig w i t h the spread4 sheet as an executable f i l e named filename. When the f i l e
5 i s executed, your spreadsheet w i l l execute automatically.
2
0 \ spreadsheet - case statement
1
2 : lcomp s t a t e @ not a b o r t " C o r p i 1 a t i o n only' ;
7 .
,
I
?pairs 0
aborte Bad CASE statementn ;
4
5 : case
?coop csp @ !csp 4 ; i n r e d i a t e
4 : of
4 ?pairs
7
compile over compile = compile ?branch
8
here 0 compile drop 5 ; imrediate
9 : endof 5 ?pairs coapile branch here 0
0
swap >resolve 4 ; irmediate
1 : endcase 4 ?pairs compile drop
2
begin sp@ csp @ 0
3
while >resolve repeat
4
csp ! ; i r r e d i a t e
5

5
c1 06128184 \ spreadsheet

-

constant & variable declarations

constant
constant
constant
constant
constant
constant
constant

row-max
col-nax
col-nare-len
row-name-len
col-org
row-org
byteslcell

\ create
: tarray

1D s t r i n g array depth characters deep

--

\ ( #rows depth
1
\ ( row#
s t r i n g addr )
dug here swap blank a l l o t
create dup c,
does> dup c@ r o t + + 1+ ;

*

6,
c l 06/24/84 \ spreadsheet

I of spreadsheet rows
I of spreadsheet columns
flax length of column name
rax length of row
nare
coluon o r i g i n of data on display
'\ row
o r i g i n of data on display
\ # of bytes per c e l l

\
\
\
\
\

ct 06131i84

*

2
3 26
4 26
5 12
b 17
7 21
0 3
? b
0
1
2
3
4

array d e f i n i t i o n s

**

,

3
D \ spreadsheet
1

- high level

\ create 20 array depth bytes deep
: array
\ I #rows Xcols depth -- )
compiie time
\ ( row# c o l t -- element addr 1 run
time
create 2dup swap c, c,
dup here
swap erase a l l o t
does) dup c@ X r o l l 2 r o l l + over
1+ c@ + + 2+ ;

.

,

I

\ coiuan displacerent f r o n

v a r i a b l e row-disp
(cri
(cr)

c l 07104184

\
\
\
\

--

coapile t i r e
run
t i ~ e

- array d e f i n i t i o n s

c! 06\28/84

define a 2D array f o r spreadsheet data s t r u c t u r e
each c e l l contains b bytes
2 f o r f o r a u l a execution address ( i f any)
4 f o r double nurber value storage

row-rax col_aax b y t e s i c e l l array c e l l 5
\ define a s t r i n g array f o r holding the row naaes
row-mar row-name-fen $array row-names
\ define a s t r i n g array f o r holding the column names
col-flax col-nane-len (array col-names

C

1

\

FORTH Dlmenslons

30

Volume VII, No. 2

7

10
cl 07/04/84 \ spreadsheet - mist word definitions
cl 07/04/84
\ input special iPH keys
: Ifd.) tuck dabs
\ dollarlcents forrating word
\(--cJ
(# # f a s c i i hold #s r o t
\ formats double f on TOS
'\ p r i n t s leading t
sign a s c i i $ hold #> ;

O \ spreadsheet - aisc word definitions
1 : Ifin-key
2 key ?dup O=
3 i f key 128 + then ;
4
5 : dtin
b pad l + ?O 2dup blank expect
7 span @ pad c! pad nuaber ;
8
9 : t i n dtin drop ;

0
1

.

: 4d.r )r (fd.1 r )

\ input double f from keyboard
\ -- dl

over

- spaces type

;

\ f o r r a t df i n d o l l a r s l c e n t s i n
\ r i g h t j u s t i f i e d f i e l d width w
'\

: formatt
\ input single nufiber
\ (
n)

\
\
\
\

forrat-flaq @
if 10 fd.r
e l s e 10 d.r
then ;

--

7
L

(d n -- 1
format double number in one of
two formats
as dollars/cents
,noraal nurber

3
4
5
E
11
3 \ spreadsheet - r i s c word definitions
cl 07/04i84
cl 07/02/84 \ spreadsheet - display word definitions
! : posl 0 21 2dup a t 0 blot a t ; \ position cursor on cad l i n e
2 : pos2 0 22 Zdop a t O blot a t i \ position cursor on cmd l i n e
: dis-data
\ display a l l cell data
3
cur-col @ dup 4 + swap
\ for 4 screen columns
4 : yin
\ ( -- T if yes F i f no I
do i col-nax = ?leave
\ if past l a s t possible coluas
5 posl
Are You Sure ?: "
\ display msq
cur-row @ dup 15 + swap
\ for 15 screen rows
6 key upc ascii Y = ;
\ return i l a g
do i row-max = ?leave
\ if past l a s t possible rwi
I
j cur-col @ - 13 * 2: +
\ calcc,iate display col position
8 : mark-cell
\ nark cell on display
i cur-row B 3 + a t \ calculate display row position
9 Zdup a t ascii ( emit swap 11 \ (row# c o l t -- )
i j c e l l s 2+ 2@ format#
\ get data and display i t
0 + swap a t ascii ) emit ;
\ mark ceil l i k e "(
)"
1oop
! loop for a l l data displayed
1
loop ;
2 : uneark-cell
\ unmark c e l l of display
3 2dup a t space swap 11 t snap \ (row# col# -- I
4 a t space ;
\ rerove ( ) marks from display

."

C

12

9

O \ spreadsheet - nisc word definitions
cl 07/01/81
! : cell-ptr
\ r e t u r ~address of c e l l pointed
?
3
4
5
O

7
E

cur-rou @ row-disp @ +
cur-col 8 col-disp & +
cells ;

\ a t by I
> display marker
\ ( -- c e l l addr )

\ spreadsheet

- display ~ o r d6eflnitions

\ display spreadsheet h a r d e r 5 on the sireen

: dis-hoarder

! dispfap spreadsheet boarders
\ i - - )

18 3

: ca!-:ell-disp-l~c
co!-disp@13*iol-orgt
row-disp @
rou-org + ;

\ calcolate location on display

\oicelldisplaymarkers
\ ( -- col rgw )

?

0 : place_cell-marker
t place r e i l marker around i e i l
1 cai-cell-disp-lac nark-cell ;
2
3 : erase-eel!-marker
\ erase c e l l aarker around ce! 1
4 iai-cell-disp-loc unmark-cell ;
5

Volume VII, No. 2

cl 07/02/84

31

do 20 i a t 4 O
do a s c i i I e a i t 12 spaces
loop a s c l i I emit
1oop

80 O
do i 2 a t ascii
0': 5

- enrt loup

do i !S a t ascil - em: t loop :

FORTH Dimensions

13
16
0 \ spreadsheet display word d e f i n i t i o n s
c l 07/04/84 \ spreadsheet - display word d e f i n t i o n s
c l 06/31/84
1
2 \ display spreadsheet renu o f options on r i g h t side of display : dis-status
i display spread sheet status
3
48 19 a t
Row: '
display current rowlcol
4 : dis-renu
cur-row @ row-disp @ +
5 74 3 a t
Nenu:'
60 19 a t ."Colurn: *
6 74 4 a t .' C l o l m 74 5 a t
A)gaine
cur-col @ col-disp @ + a s c i i A t e u i t
Dlata'
74 7 a t ."EE)qu.'
47 20 a t
Node: ' mode-flag e
\ display calc, rode
7 74 6 a t
8 74 e a t . ' F ) o r m . " 7 4 9
a t ."G)otoU
i f . " A u t o * else
Norralm then
P 74 10 at
N)ode'
74 11 a t
Nlew'
61 ?O a t .* Order: " order-f lag @
\ display calc, order
0 74 12 at
0)rder' 74 13 a t
P)refm
i f . " C / R ' e l s e ."KC' then
R l u i t m 74 15 a t
R)ow"
pas2
1 74 14 a t
2
posl
Conrand: '
\ output corrand p r o r p t
\ place c e l l rarker on display
3
p l ace-cell-marker ;
4
5

-

."

.'
.'
.'
.'

.'

.

.'

."

.'

."
.'

.'

'

.'

14
17
0 \ spreadsheet display word d e f i n i t i o n s
c l 07/04/84 \ spreadsheet display word d e f i n i t i o n s
1
2 : dis-row-labels
\ label the rows on display
: dis-row-change
\ display i n f o that
3 cur-row e dup 15 swap
\ l a b e l from cur-row
dis-row-nares
\ a row change
\ f o r 15 l i n e s or u n t i l row-rax
dis-row-labels
\ row nares, l a b e l s
4 do i row-rax = ?leave
5
18 i cur-row e 3 + at
\ forrat i n deciral I s
dis-data ;
6
i2.r
: dis-col-change
\ display i n f o t h a t
7 loop ;
\ a col change
8
d i s-col -nares
9 : dis-row_names
\ display row nares f r o & array
\ col nares, l a b e l s
dis-col-labels
0 cur-row @ dup 15 swap
\ only show nares that f i t on
dis-data ;
1 do i row-rax = ?leave
\ display
2
0 i cur-row 8 3 t a t
\ place cursor a t location
3
i row-nares row-name-len \ type required chars
type
4
5 loop ;

-

-

*

-

*

c l 06/31/84
changes with
and data

changes with
and data

-

15
18
0 \ spreadsheet - display word d e f i n i t i o n s
c l 07/03/84 \ spreadsheet display word d e f i n i t i o n s
c l 07/04/84
\ label the colurns on display : dis-screen
\ display spreadsheet screen
1 : dis-col-labels
2 cur-col @ dup 4 + swap
\ l a b e l from cur-col
dark 31 0 a t
\ f o r 4 cols. or u n t i l col-rax
Forth Spreadsheet"
\ display t i t l e
3 do i col-max = ?leave
i cur-col @ - 13 t 27 t
\ f o r r a t i n alphabetic chars
dis-boarder
\ draw boarders
4
5
2 at i ascii I + e r i t
\ A thru 1
dis-renu
\ display operation menu
6 loop;
dis-col-labels
\ label columns ik-1)
7
d i s-col-nares
i display column nares
8 : dis-col-nares
\ display colurn nares
dis-row-labels
\ label rows
(0-25)
? 7 1 at
Title'
\ only show names that f i t on
dis-row-nares
i display row
naaes
0 cur-col @ dup 4 * swap
\ display
dis-data
\ display appropriate data
1 do i col-rax = ?leave
\ f o r data window being
i cur-col @ 13 t 21 t
2
\ place cursor a t location
\ displayed
3
1 a t i col-nares col-nare-len
0 row-disp ! 0 col-disp !
\ set rark at o r i g i n
4
type
\ type required Iof chars
dis-status ;
\ display status
5 loop ;

-

."

.'

-

~p

FORTH Dimensions

32

volume VII, No. 2

0 \ spreadsheet

19

- cell

calculation words

22
cl 06/31/84 \ spreadsheet

20
0 \ spreadsheet

- cell

calculation words

23
cl 07/04/84 \ spreadsheet

- cell rarker positioning words
cl 07/02/84
1
\ talc forrula of cell if i t has : right-arrow
\ rove cell marker right 1 cell
2 : calculate
3 @ ldup if execute then ;
\ one ( cell addr -- 1
col-disp P 3 =
\ marker in right rost cell ?
4
if cur-col @ 4 + col-rax 0 \ if so i s i t the l a s t cell (2)
5 : talc-c/r
\ talc colurns then rows
\ rove display column right one
if 1 cur-co1 +!
6 r~w-rax 0
di s-col-change
\ scroll right
7 do col-rax 0
then
\ if nark a t colurn I ignar
8
do j i c e l l s calculate loop \ get forrula and execute i t
else
\ if rark not a t right most
9 loop ;
erase-cell-rarker
\ colurn of display rove it
0
1 col-disp +!
\ right one cell without
1 : talc-r/c
\ cal rows then colurns
then
\ scroll
2 col-nxO
place-cel 1 -rarker ;
\ draw new cell narker
3 do row-rax 0
4
do i j c e l l s calculate loop \ get forrula and execute i t
5 loopi
1
2 : talc-cells

3
4
5
6
7
8:
9
0
1
2
3
4

order-f lag @
if talc-clr
else talc-rlc
then ;

\
\
\
\

- cell

rarker positioning words

deternine which to talc f i r s t : up-arrow
by state of order-flag
row-disp e 0=
if 1 talc cols then rows
if cur-row @ 0 0
if 0 talc rows then cols
if -1 cur-row +!
di s-row-change
then
else
erase-cel 1-barker
-1 row-disp +!
then
place-cell-marker ;

order
\ prompt user for talc order
posl
Specify calculation order'
pos2
Row/Coi(O) or Col / R a i i ( l ) : '
key ascii 1 =
\ get response and set flag
if true
\ accordingly
else false
then order-flag ! ;

.'

.'

\
\
\
\
\
\
\
\
\
\

c l 07/02/84

rove cell rarker up 1 cell
i s cell at top display pos. ?
if so are we a t the top of
the spreadsheet ?
if not rove up a
cell and scroll upward
if already a t top ignor
if mark not a t top of display
erase nark
move up one cell

\ draw new cell rarker

r

21
24
6 \ spreadsheet - cell narker positioning words
cl 07/02/84
cl 07/02/84 \ spreadsheet - cell narker positioning words
1
2 : left-arrow
\ rove cell marker l e f t 1 cell
: down-arrow
'\ rove cell marker down 1 cell
3 col-disp @ 0=
\ cell rark at l e f t of display ? row-disp @ 14 =
\ are we a t bottor of display ?
4 if cur-col @ 0 0
! i f so i s at a t f i r s t colurn 1 if cur-row e 15 + row-nax 0 \ if so are we on last row
?
5
if -1 cur-col +!
\ move display colunn l e f t once
if 1 cur-row +!
\ if not rove down one cell
4
dis-col-change
\ scroll display l e f t
\ scroll downward
di s-row-change
7
then
if a t f i r s t column ignor
then
\ if at last row ignor
8 else
\ cell rark not at l e f t colurn
else
\ if not at bottor oi display
9
erase-cel 1-aarker
\ erase current mark
erase-cel i-marker
\ erase cell rark
0
-1 col-disp + I
\ rove l e f t without scroll
1 row-disp + !
\ rove down one cell
1 then
\ of display
then
2 place-cell-rarker ;
\ draw new cell marker
place-re1 1-marker ;
\ draw new cell earker
3
4
5

VolumeVII, No. 2

33

FORTH Dimensions

25
0 \ spreadsheet

-

c e l l marker p o s i t i o n i n g words

1
2 : f i r s t - c o l 0 cur-col !
3 dis-col-change ;
4
5 : last-col
6 col-lax 4 - cur-col !
7 dis-col-change ;

28
c l 07/04/84 \ spreadsheet

\ go t o column A immediately
\ cur-col t o 0 and s c r o l l

: assign-id col-maz 0

\ go t o column W inmedlately
\ cur-col t o Y and s c r o l l

assign-id

a
9

0
1
2
3
4
5

- algebraic functions

do i c o l - i d loop ;

c l 07/04/84

\ loop used t o assign values t o
! the alphabetic columns

A 5 C D E F 5H I J K L 4 N0P
Q R S T U V Y X Y Z

is

: top-row
Ocur_row!
dis-row-change ;

\ go t o row 0 immediately
\ cur-row t o O and s c r o l l

f o r example: 1 A r e t u r n s the double i n t value of

ce!i 1 A

Column i d s A-Z r e t u r n values of 0-25 respectively

: bottom-row
row-pax 15 - cur-row !
dis-row-change i

\ go t o column 11 iamediately
\ cur-row t o 11 and s c r ~ l l

26
29
0 \ spreadsheet - c e l l marker p o s i t i o n i n g words
c l 07/04/84 \ spreadsheet - algebraic functions
c l 0bi3ll84
1
: opp@
! r e t u r n oprand stack p o s i t i o n
2 : left-4-cols
\ love marker l e f t 4 columns
op-stack dup @ + ;
\ 1st l o c a t i o n i s stack p t r
3 40doleft-arrow loop;
\atatice
\ (
addr i
4
: >op 4 op-stack + ! oppe 2! ; \ s t o r e c f a and precedence
5 : right-4-cols
\ move marker r i g h t 4 columns
\ top of oprand stack
4 4 0 do right-arrow loop ;
\ at a t i r e
\ !cfa prec -- 1
7
: op> oppE 2@ -4 op-stack + !
i pop c f a and prec o f f oprand
8
drop ;
\ stack and compile i n t o d i c t .
9
\ r e t u r n precedence from top
: prec? oppe E ;
\ top of oprand stack
0
1
\ (
prec)
2
: l a begin prec?
\ end algebraic compilatios
3
while op) repeat
\ pop remaining oprands o f f s t k
4
f o r t h ; immediate
\ and compile then select f o r t h
5
i vocabulary again

--

,

--

27

30
c l 07/04/84
c l 07/04/84 \ spreadsheet algebraic functions
\ create high l e v e l d e f i n i t i o n t h a t performs algebraic
1 vocabulary algebra
algebra also d e f i n i t i o n s
2
\ compilation. See t e x t f o r d e t a i l s of operation
3 \ c o l - i d f u n c t i o n assigns n t o i d a t compile time (n -- 1
: infix '
\ create new algebraic operator
4 \ expects row I on TO5 a t run t i r e
5 \ subsequent usage of i d fetches double value of c e l l t o stack
create swap
innediate
\ compile c f a of f o r t h operator
6
does> 2e
\ and assigned precedence
\ column-id high l e v e l d e f i n i n g
begin dup prec? i not
\ a t coapile time execute i f
7 : col-id
8 create
\ word. Creates c o l i d s A-Z
while >r )r op> r ) r.)
\ prec i s l o ~ e rthen oprand on
9 does) e c e l l s 2+
\ expect a t on the TO5 and
repeat >op ;
! top of oprand stack
0 2@ ;
\ pushes the c e l l value onto
1
\ the parameter stack
2
: d t dup r o t r o t r o t u a t r o t t ; \ double m u l t i p l i c a t i o n
3
: d l swap over /rod i i swap
\ doubie d i v i s i o n
4
unlnod swap drop r ) ;
5
: dmod d l drop 0 ;
\ double rodulus

-

0 \ spreadsheet - algebraic functions

,,

,

*

FORTH Dimensions

34

Volume VII, No. 2

31

0
1
2
3
4

\ spreadsheet

7 infix df

34
c l 07/03/84
cl 07/04/84 \ spreadsheet - input words
: input-col-nares
! input column nares
\ create new algebraic operators posl
Input Col Nares'
\ display corrand prorpt
\ with assigned precedence
pos2 . " S t a r t i n g with Col: "
key upc a s c i i R - cur-col ! \ get s t a r t i n g col t s t o r e
col-rax cur-col @
\ in cur-col. From there t i l l
\ missing 1 message
do p052
\ l a s t col input nares
! if r i s s i n g then abort
Col Y ascii A + emit . V " \ d i s p l a y cot I
i col-naoes col-name-len
\ get address in col-name array
\ l e f t paren
2dup blank expect
\ clear it and then input
\ prec=l cf a=)missinq message
span @ O= ?leave
\ i f just (CR) then e x i t loop
\ push on oprand stack
i 4 nod 0=
\ every 4 nares s c r o l l display
if i cur-col !
\ new cur-col change display
dis-col -change
\ e l s e only change the
e l s e dis-col-nares then
\ display col nares
loop ;

- algebraic functions

t

b infix d+ +

7 infix d/ 1
6 infix d- -

5 infix drod rod

5
b : jrissing
7 1 a h o r t V i s s i n g 1"

.'

."

8
9: (
O [ ' I )oissing 1 jop ;
1 irmediate
2
T

4
5

32
35
3 \ spreadsheet - algebraic functions
cl 06131184 \ spreadsheet - input words
1
2 : I [ forth I
? r i g h t paren
: get#
j
begin ! prec? <
\ causes a l l items on oprand
dtin
4
while op) repeat
! stack t o be corpiied until
format-flag !I
5
1 prec? =
i l e f t paren found
if dpl @ S r i n
6
if -4 op-stack +!
\ l e f t paren should have prec.
case
7
else 1 abort" Rissing I" \ of 1 e l s e error msg output
-1 of 100 d* endof
8
then ; immediate
0 of 100 d* endof
9
1 of 10 d* endof
0 forth definitions
2 of noop endof
1
3 of 10 d l endof
2 : a[ 0 op-stack ! algebra ;
i s t a r t algebraic corpiiation
endcase
5 imaediate
\ reset oprand stack and
then ;
4
\ select algebra vocabulary
5

,"a
O \ spreadsheet - inpat words
1 : input-rau_naaes
2
3
4
5
5
7

8
9
0
i

Z
5
4
5

."

cl 0?i03/94
\ input row nares
\ display cormand prompt

!,

pos!
Input ROW Hares'
:
posZ , " S t a r t i n g with Row: '
t i n cur-row f
i get starting row Y s t c r e
row-aax cur-row @
\ i n cur-row. Fros there t i l l
dc p ~ s 2
\ l a s t row input names
Row " i 2 .r
: "
\ display raw #
i row-napes rcu-name-lee
' get address i n run-nafir a r ~ a y
ldupblankexpect
\ clear i t rnd thec input
span @ O= ?leave
i lf I & ICR) then exit Ioop
i 5 mod 0=
every 5 nanes scro!I display
if i iur-row !
! new cur-row change d ~ s p f a y
dis-row-change
i e l s e oniy change the
e l s e dis-rou-names then
1% d ~ s p i a yrow names
lctj~i i

.'

."

36
spreadsheet

-

."

\ get double I scale i f needed
\ get double i n t f r o r operator

:dollarslcents f o r r a t 7
\ if so scale according1 y
\ no DP value t 100
\ 0 DF value
106
i 1 DP value
10
\ 2 DFs oo sraling

*

*

i 3 DPs value 1 10
\ if normal format

; no scaling perfarred

inpat words

input-cell-data
posl
!npbt Ce!! Daat"\
po52 . " M a : " get#
:ell-ptr 2+ 2i
rtcde-flag @
ii posZ
Caicuiating"
talc-cells
then
dis-data ;

."

cl 07/04/84

c: 07/04/94
\ in@

data t o c e l l
promgt f c r data e n t r y
'\ yet d a t a
\ arid s t c r e lt
get mode f l r g
\ i r a ~ t ocalc,>!ate A J ~ E
', selected !he? calculate
! a l l :r:l data
\ ii,,,PW tbe new l a t a

k

Volume VII, NO. 2

35

FORTH Dimensions

37
40
0 \ spreadsheet - input words
c l 07/04/84
c l 09/2!/84 \ spreadsheet - high l e v e l coseands
1 : input-equ
i input equation i n t o d i c t
2 posl
lnput Celi Equation"
\ prompt f o r equation
: format
\ select # f oraat
3 pos2
Equation: "
p ~ S i Select input number formate
4 t i b 127 b!ank
clear t i b
pos2 ' Normal=O o r DollarslCents=l: '
5 ? formula a[ '
\ prearble t o aove t o t i b
key a s c i i i =
! get operator response
b t i b swap cmore
't aove i t t o t i b
i f true
\ i f ( then t r u e t o f o r r a t - f l a g
7 t i b 13 + dup 127 expect
\ get equation t o t i b
else f a l s e
\ otherwise f a l s e t o format-flag
i p t at end of input
then
8 span @ +
9 " l a [ c e l l - p t r 2 t 1 l i t e r a l 2 ! ; l a s t @ name) c e l l - p t r !"format-flag
!
0 -rot swap r o t came
\ r o v e t o t i b also
dis-data ;
\ show data i n new format
1 span @ 70 + t t i b !
\ make f o r t h t h i n k i t a l l
2 blk off > i n o f f
\ came f r o a the keys
3 algebra
\ select algebra vocabulary
4 interpret
\ compile equation i n t o d i c t
5 forth ;
i back t o f o r t h vocabulary

.'

."

.'
.

41
38
c l 07/04/84
0 \ spreadsheet - high l e v e l coarands
c l 07/04/84 \ spreadsheet high level commands
\ e x i t spread sheet
1 : quit-talc
\ ask again i f YES then q u i t
: again-rep1
\, r e p l i c a t e column data
2 y l n abort' BYEn ;
f
c e l l - p t r 2+ 21
\ b r i n g c e l l data t o TOS
\ clear e x i s t i n g spreadsheet
post . Y o l u m n r e p l i c a t e c e l l data'
4 : new y l n
5 i f 0 0 cells
posZ ."Number o f colurns: '
\ ask again i f yes clear i t
b
row-aax col-max b y t e s f c e l l
# i n ?dup
\ get I of columns
7
t
erase
\ erase c e l l s array
if 0
\ i f answer 0 0
8
0 row-names
do right-arrow
\ move r i g h t
\ and store data
9
row-oau row-nare-len t erase \ erase row-name array
Zdup c e l l - p t r 2+ 2!
0 0 col-names
1oop
col-nax col-name-len t erase \ erase col-name array
?drop
\ clean up the stack
1
2
dict-rark p e r f o r r
\ erase a11 f o r r u l a s
dis-data
\ and display the new data
3
0 row-disp ! 0 col-disp !
\ set rarker t o o r i g i n
then ;
\ else ignor i f col=O
4
dis-screen
\ d ~ s p l a ycleared screen
5 then ;

-

*

39
0 \ spreadsheet

42
c l 07/04/84
l e v e l corpands
c l 07/03/84 \ spreadsheet high l e v e l commandr
\ set auto calculation mode
1 : rode
: go-to
\ goto specified row/co!
2 posl
3
Set auto calculation nodee
posl .* Row(0-25): "
\ pronpt f o r row t
4 pos2
# i n dup 0 r~w-nax within
\ check f o r proper range
5
Norral=O or Auto=l: '
\ prompt operator
i f cur-row !
\ i f ok store i t
b key a s c i i 1 =
\ get response
pas2
Colurn(A-W): *
\ prorpt f o r coI l e t t e r A-W
7 i f true
\ set mode-f 1ag
key upc a s c i i d dup
\ get i t and check i t s range
R elsefalse
\ accordingly
0 col-max 3
within
\ i f ok goto data window
9 then
i f cur-col !
! store col I
0 rode-+ lag ! ;
0 col-disp ! 0 r o ~ - d i ~ p \ piace c e l l marker a t o r i g i n
dis-screen
\ show new screen
1
2 : perfora-calc
\ force calculations
else drop
\ drop #s i f out of range
\ execute formulas
then
3 calc_cells
4 dis-data ;
\ show r e s u l t
else drop
5
then ;

- high

-

.'
.'

.'

-

FORTH Dimensions

36

-

Volume VII, No. 2

Availability of spreadsheet Source
Code and F83
To save some rather tough typing,
the source code for this program is
available postage paid from the author
for $25 (6 Sutherland Place, Manitou
Springs, Colorado 80829). It is,
however, only available on 5.25" disk
format for MS-DOS or PC-DOS. The
public-domain F83 program should be
available from No Visible Support
Software, Mike Perry, 1125 Bancroft
Way, Berkeley, California 94702.
This is an incredible implementation
of Forth-83. Everyone even remotely
interested in Forth should buy a copy
of it. The entire Forth community
should give thanks to Laxen and Perry
for donating such an excellent piece of
software to the public domain.

4;
c l 07/04/04
0 \ spread sheet - operator i n p u t processing
i : coaaand-in case
2
a s c i i A of again-rep1
endof \ r e p l i c a t e c e l l data
3
a s c i i C ot input-col-names endof \ i n p u t column names
4
a s c i i 0 of input-cell-data endof \ i n p u t c e l l data
5
a s c i i E of input-equ
endof i input c e l l equation
endof \ i n p u t # display for mat
b
a s c i i F of f o r a a t
7
a s c i i G c f go-to
endof \ qoto eel1
B a s c i i il o i mode
endof \ set t a l c mode
9
a s c i i N of new
endof \ clear spreadsheet
asci i D of order
endof \ set calc order
1
a s c i i f of perfora-talc
endof \ force c a l c u l a t i o n s
?
a s c i i P of quit-calc
endof \ qu! t spreadsheet
3
a s c i i R of input-row-names endof \ input row naaes
4
beep
\ ifnone c f the above
5 endcase ;

44

G i spread sheet
1 : control-in
2
3
4
5
b
7
6
f
G
1

2
3
4
5

case
199 o i top-row
200 of up-arrow
201 of l e f t - 4 - c o l s
203 of left-arrow
205 of right-arrow
207 of hottor-row
208 of down-arrow
203 of right_4_co!s
243 of f i r s t - c o l
244 of l a s t - c o l
beep
endcase ;

endaf
endof
endof
endof
endof
endof
endof
endof
endof
endoi

45
0 ;' spreadsheet - r a i n program
1
2 : spreadsheet
3 dis-screen
4 begin
5
1B#-key b p i
h
dup 198 )
7
it
control-in
B
else caanand-in
9
then
O
dis-status
1 igain ;

i goto top
row of
i up
one c e l l
'i go i e f t 4 colurns
\ ! e f t one c e l l
': r i g h t one c e l l
\ yoto bottom row o i
\ down one c e l l
\ go r i g h t 4 co!umns
\ goto f i r s t column of
\ goto l a s t coluan of
\ i f cone of above

sheet

The Mirth Dimension
2SWAP DROPY
With apologies to Lewis Carroll.

sheet
'Twas SYSOUT and the SFlLL toves
Did SRW in the wabe;
All FOUTPUT were the borogoves,
And the BOOT COLD outgrabe.

sheet
sheet

"Beware the 2SWAP DROP my son!
The ROLLS that bite, the DOs that catch!
Beware the DLlT LOOP and shun
The NORETCOND Bandersnatch!"
He took his OUTER PlCK in hand!
Long time the PCOND PORT he sought.
S o rested he by the IF ELSE tree,
And FLUSH PMODE in thought.

! main program nord
i show screen

And as in PIXBLT thought he stood.
The 2SWAP DROP, with ROTS of flame.
Came TONED through the /MOD wood
And  as it came!

i get key E O ~ ! V Et ~c ~2C

\ i a n t r c l cr command kei
! contr51 key input
! camaand key i n p u i

?

One, two! One, two! And through and through
The OUTER PlCK went snicker-snack!
He left it WARNING and with its head
He went CPATH back.

i she* oek s t a t u s
\ 63 fofever

"And hast thou slain the 2SWAP DROP?
Come Dl + my QUSER boy!
A TYPED day! Callooh callay!"
He RANDOM in his joy.

L

3 lark no-for~ulas
4 ' no-formulas ditt-mark
5 na:-ning on

\ d i r t - a a r k has c f a o i
!

'i word
'\

t o delete fcrnu!as
warn~ngas95 back on

I

I

'Twas SYSOUT and the SFlLL toves
Did SRW in the wabe;
All FOUTPUT were the borogoves,
And the BOOT COLD outgrabe.

-Wayne Cox

Volume VII, No. 2

37

FORTH Dimensions

Rochester Forth Conference 1985
Forth programmers, project managers, vendors and evaluators gathered
in Rochester, New York in June at the
annual Forth conference held there.
The directors and staff of the Institute
for Applied Forth Research assembled
a broad spectrum of presentors who
gave us a clear profile of the expertise
being brought to bear in today's Forth
community. From applications on the
space shuttle and automation of an
entire airport, to object-oriented programming, to putting Forth in hardware, the papers were intelligent,
sometimes witty, and occasionally
mind boggling.

to strict standards and conventions;
and responsibility. She believes all of
these points to be crucial, and that the
importance of each increases with the
overall size of the task.

It would appear that those same ingredients contributed to the success of
the Forth programmers and scientists
who worked on experiments performed
aboard space shuttle missions in
November 1981 and October 1984. Dr.
Henry Harris of Pasadena's Jet
Propulsion Laboratory described his
work with JPL and the Johnson Space
Center. The three-year project focused
on instrument control and, in the end,
Elizabeth Rather of Forth Inc. spoke was beset by in-orbit hardware probon the subject of developing and im- lems that would have been insurmounplementing a large-scale application. table if it were not for Forth's
Titled "Fifteen Programmers, 400 interactiveness.
Computers, 36,000 Sensors and
JPL chose to use Forth for this proForth," the talk described work done
ject
because of its adaptability to a
to automate and fully integrate an inwide
range of needs and conditions.
ternational airport in the Middle East.
They
employed intense numberMajor applications such as safety,
security, climate control, personnel, crunching, graphics and sophisticated
power distribution, runway lighting, arrays of geometrical attitudes, cometc., all reside in one large system, with prising something like a megabyte of
largely common subsystems providing compiled code. The team implemented
facilities to each. Forth lends itself well elements of LISP and Prolog in their
to this method of using modular com- LMI Forth system, which was then
used to develop a context-sensitive
mon factors to serve in diverse areas.
editor and critical constraint checking
Rather described the months of t o define permissible instrument
strategy, planning and testing required movements.
by the project. Much of the work was
Dr. Harris asserted that, because of
done in Alabama, where the team
its
modularity, Forth excels in large
worked in two-weeks-on, one-week-off
programs.
It is good for jqbs with critishifts. A huge hangar-like room was
cal
deadlines
(such as a launch date)
used to house a crowded maze of
and
where
interactive
control can help
cables and interconnected machines meet
changing
conditions
(as when it
each programmable from any of the
was
used
to
save
the
shuttle
experiment
others - that represented only about a
during
hardware
failures).
Harris
then
third of the actual site equipment.
presented three myths that have been
After describing the size and com- dispelled by recent accomplishments:
plexity of this task, the speaker went that Forth is only good for small proon to offer her observations about the grams; that no good software has ever
requirements for success with large been written in Forth; and that if a
projects: knowledgeable management, program is larger than 64K, it isn't
and direction; professional skill in all right. By way of one example, JPL's
parts of the working team; good com- Forth on an IBM-XT more accurately
munication between the team and man- predicted the space shuttle's position
agement, and between management than did the mainframe at Johnson
and the client; the discipline to adhere Space Center.

FORTH Dimensions

38

All told, the Rochester Forth Conference provided a platform for about
sixty speakers to address an audience
of nearly two hundred. Several described their experiences with creating
significant extensions to Forth for purposes of education, artificial intelligence and adding object orientation, for
example. It became apparent that
Forth is a natural seedbed for the best
features of contemporary computer
languages, which can be easily implemented in Forth without the possible
restrictions of the environment in
which they originate. Charles Duff discussed NEON, an object-oriented language making waves in the greater
Macintosh community; Pierre
Moreton presented HFORTH, an
"English-like business application
language"; and Arnold Epstein intrigued listeners with his MAGIC/L,
which incorporates a Pascal-like syntax
for ease of maintainence.
For an afternoon session, the conference divided into about a dozen
working groups, special-interest gatherings ranging in size from six to twenty members. Topics included education, Forth under Unix, robotics,
image processing and artificial intelligence, state machines, Forth in hardware, standards and others. Brief
reports from the groups indicated a
variety of progress, with at least one
working group determining to continue
research and to report back at next
year's conference.
One evening was devoted to a tour of
the University of Rochester's Laboratory for Laser Energetics, with whose
cooperation the conference was held.
For two hours, conference attendees
inspected the Forth-controlled fusion
research facility, whose multiple-beam
laser can be fired at half-hour intervals. LLE workers were kind enough
not only to tolerate the presence of
more than one hundred visitors crowding an evening shift, but to answer
many questions a n d generally
humor us.
The lecture program concluded with

Volume VII, No. 2

a presentation by Lawrence Forsley ,
conference chairman. His paper on
"nth-Order Defining Words" discussed clearly a subject that is somewhat
abstract for many, the definition of
words that will define other words.
Although limited by time, Larry also
managed - with the help of an assistant - to demonstrate programming
on the fly, and the difficulties of debugging an overhead projector. Needless to say, the audience was delighted.
The final day consisted of a number
of well-attended exhibits, including
Forth Inc., Miller Microsystems, Forth
machines from Novix and Metaforth,
the Institute for Applied Forth Research, the Forth Interest Group and
Dash-Find Assoc., a Forth-specific
employment referral service. Concurrent tutorials attracted members of the
community as well as conferees.
In addition to the caliber of presentations, integral to the success of the
Rochester conference was the inspiration and efficiency of its organizers.
Congratulations and thanks go to
Lawrence P. Forsley, conference chairman; Thea Martin, conference coordinator; and to Jonathan Ross and
Sherry Snyder of the institute. Their
friendly and patient efforts were a
reward to all who attended.

-Marlin Ouverson

For details of the approximately
sixty presentations, watch for the
published Proceedings of the 1985
Rochester Forth Conference.

1

with LMI FORTHTM1
I

1 For Programming Professionals:
an expanding family of
compatible, high-performance,
Forth-83 Standard compilers
for microcomputers
For Development:
Interactive Forth-83 Interpreter/Compilers
16-bit and 32-bit implementations
Full screen editor and assembler
Uses standard operating system files
400 page manual written in plain English
Options include software floating point, arithmetic
coprocessor support, symbolic debugger, native code
compilers, and graphics support

For Applications: Forth-83 Metacompiler
Unique table-driven multi-pass Forth compiler
Compiles compact ROMable or disk-based applications
Excellent error handling
Produces headerless code, compiles from intermediate
states, and performs conditional compilation
Cross-compiles to 8080, Z-80, 8086, 68000, and 6502
No license fee or royalty for compiled applications

Support Services for registered users:
Technical Assistance Hotline
Periodic newsletters and low-cost updates
Bulletin Board System

Call or write for detailed product information
and prices. Consulting and Educational Services
available by special arrangement.
m~aboratoryMicrosystems Incorporated
Post Office Box 70430, Marina del Rey, CA 90295
credit card orders to: (213) 306-7412
Oversees Distributors.

Volume VII, No. 2

Germany: Forth-SystemeAngel~kaFlesch. D-7820 Tillsee-Neustadt
UK: System Science Ltd., London E C l A 9JX
France: Micro-Slgrna S.A.R.L., 75008 Paris
Japan: Southern Pacific Ltd.,Yokohama 220
, Australia: Wave-on~cAssociates, 6107 W~lson.W.A

Ultra-Fast Text Search Using

Probabilistic Dictionaries
John James
Santa Cruz, California

After all 40,000 English words have
been entered in this way, somewhat
fewer than 400,000 bits - half of the
Suppose you have a large database 800,000 available - will have been set.
of text files, such as the documents in a Now, to look up a word, compute the
lawyer's office, perhaps one or 100 ten hash functions on it and see if all
megabytes or more in dozens or hund- ten bits are set. If even one of the bits is
reds of separate files. You want to not set, then the word is definitely not
search the whole database for any files in the dictionary. If all ten of the bits
which contain certain words, phrases, are set, the word is probably in the
or AND and OR combinations of dictionary. But with each bit having
words and phrases. And you want the about a fifty percent probability of
search to be very fast, almost being set anyway, there is about one
instantaneous.
chance in a thousand of a false hit,
I haven't implemented this proce- meaning that a word not in the
dure, and don't know of anyone who dictionary would be "found." For a
has. So it's impossible to know for sure spelling program, this represents a onehow well it will work. Despite the in-a-thousand chance that a misspelled
uncertainty, this tutorial seems worth word would not be detected, a risk
publishing because it illustrates which may be acceptable. Hence the
important data structures and concepts name "probabilistic dictionary ."
as well as offering the promise of
important practical benefits.
Background: Hashing
Background:
The Probabilistic Dictionary

The point of "hashing" is to take a
value, such as an English word or a
lengthy part number, and transform it
Used in some spelling checkers, the into an arbitrary number which is a
probabilistic dictionary is a most inter- more suitable key for indexing into a
esting data structure, and one which table. In the example, we need to
opens new approaches to a number of transform an English word into a
problems. I'll explain it first with an number from 0 to 799,999. Of course,
example. Suppose a spelling checker different words may transform into the
needs a dictionary of about 40,000 same number (a "collision"); but we
English words but only has lOOK bytes try to select a computational procedure
to store them in RAM and can't afford such that the numbers don't tend to
the speed penalty of keeping the words bunch up, so there won't be too many
on disk, which could require a separate collisions.
disk access for each word being
A common hashing computation is
checked. A probabilistic dictionary can to divide by an appropriate number,
comfortably store the words in two- throw away the quotient and take the
and-a-half bytes each, no matter how remainder. In the example above, this
long the actual words are.
divisor would be a little less than
To build the dictionary, start by 800,000, so that the remainder will be
clearing all the l00K bytes (800K bits) the right size to select one of the bits.
to zero. Now, to add each word to the The divisor should be a prime number;
dictionary, use ten different "hashing" for more background on picking a
functions (see below for explanation of good one, see ~ n u t h ~In. the above
hashing) on the ASCII strings which example, ten different divisors would
represent the word. Each hashing be used to select the ten bits in the table
function will select one of the bits, by of 800,000. Note that before division,
computing a number between zero and the English word whose ASCII string
799,999 from the ASCII string. Set will be the dividend should be lefteach of the ten selected bits to "1" - justified or rearranged in some other
whether or not it had been set before. way; otherwise, for short words the

FORTH Dimensions

40

dividend would be less than 800,000
and all ten divisions would give the
same remainder. Picking a good
hashing function can be tricky.
Dictionary for Text "Search"
Now let's use the probabilistic dictionary for another purpose - text
searching. The trick is to prepare a
separate, small dictionary for each file
in the database. All these little
dictionaries might fit into RAM or in a
small file on disk. Then, to search for a
word in the entire text database, just
look it up in all of the dictionaries.
Only one pass through the dictionaries
is enough, even for a complex search
involving many words, phrases, and
AND and OR combinations of them.
Different kinds of condensed dictionaries could be used, not only the
probabilistic dictionary suggested here.
We suggested this one because it is
compact, easy to implement and very
efficient, especially when many
dictionaries must be searched for the
same words.
How big should each of the dictionaries be? A typical text document
of about 10,000 words will have only
about 1500 distinct words; a 3000 word
dictionary would accommodate much
more than a 20,000 word document.
Two-and-a-half bytes per word gives
7.5K bytes for each document's
dictionary. And note that each dictionary can actually hold more than 3000
words and in fact will never overflow,
although performance degrades
gradually if too many words are added.
The actual dictionary size can be
selected by the end user, although for
any given database of text files, it's
easier to keep all dictionaries the same
size than to have larger ones for large
documents.
If 500K of RAM is available, over
sixty dictionaries of 7.5K each could be
kept there for faster searches, although
it wouldn't hurt much to keep these
dictionaries as a file on disk, since a
search would need only one pass
through that file. Each dictionary
should also contain the name of the file

Volume VII, No. 2

ESRUE'ISB

3

On October Ist, 1985, the price

for fieFORTH w l l be increased to
$89.95 ;Order NOW and you can have
the complete figFORTH system for only $ 74 95

1
which it represents. Then the search
through the dictionaries could yield a
list of file names. These files would
then be searched word by word (full
text search), both to eliminate the few
false hits resulting from the probabilistic nature of the dictionary, and also to
locate the words or phrases sought, in
case the user wanted to examine them
in context.

entering or searching for any word.
Some false hits will occur, but they will
be resolved during the full text search,
at a modest cost in performance. Let
users know that irregular plurals must
still be searched explicitly, with an
AND.

(6) In the full text search, you can do
better than looking at every letter. For
example, when you are searching text
for a word, look at the last-letter
position in the text first. A quick
Miscellaneous Hints
lookup in a small table specially
(I) Logical AND and OR searches prepared for the word being sought
are easily handled, but NOT presents a will usually show that that particular
problem because it changes false hits, letter is not contained anywhere in the
which are tolerable, into false misses, word; and in that case, the interwhich are not. So use the full text mediate character positions don't need
search before excluding any file from to be examined at all, since they could
not possibly be part of the word being
consideration.
sought. Many other refinements have
(2) Searches are fast. The hash func- been developed, since text searching
tions need only be computed once, no has such practical importance.
matter how many dictionaries need to
(7) Include each file's lastbe searched, so the time to compute
them should be imperceptible. And for modification date and time with its
any single word or AND of words, a dictionary. Then the search program
single bit mask can be prepared for can examine the directory of files, to
high-speed test against the dictionaries. automatically regenerate the dictionary
It's reasonable to estimate that the dic- for any new or changed text file. This
tionary search of dozens of files, even mechanism will also generate the
long ones, could be completed within a dictionary initially, the first time the
second or two. Any full text searches program is run.
required would take longer, but usually
they can be concurrent with display of
the output to the user.
(3) The suggested 7.5K-bytes dictionary size requires hash-function divisors
around 60K. If your system doesn't
have an unsigned division available,
consider getting one bit by another
method, such as adding the ASCII
letters of the English word together
and taking the last bit of the sum. But
note that this bit will be the same for all
ten hash values of a given word.

References

1. Bentley, J o n , "A Spelling
Checker," Communications of the
ACM, May 1985, Vol. 28, No. 5. This
"Programming Pearls" article includes
background on text documents and on
several methods of checking spelling,
and has good references for further
(4) Phrases can be handled as an research.
AND of the words, with false hits
excluded later in the full text search.
2. Knuth, Donald E., The Art of Com(5) This method won't find parts of puter Programming, Vol. 3, Addisonwords. But common prefixes and Wesley, Reading, Mass., 1973. This
suffixes can be treated. For example, to classic programming text has a long
avoid missing plurals of words, just section on hashing and related
drop the final "s" or "es" before methods.

1IgFORTH from SOTA Computrng Systems
Limited IS rapldly becomlng the FORTH of cholce
lor both the novice and experienced FORTH
programmer Featuring a complete, accurate
lmplementatron of the figFORTH model,
figFORTH from SOTA Computing Systems
Llmlted also olfers

full featured string handling
floating point
screen editor
assembler
beginner's tutorial
comprehensive programmer's
guide
exhaustive reference manual
unparalleled technical support
source listings
no licensing requirements
no royalty arrangements
unbeatable price
For the best implementation of
FORTH that money can buy -- at a
truly allordable price -- order
figFORTH from SOTA Computing
Systems Limited today!

I
1

Gentlemen: I want to save mone I
OEnclosed 1s mv
Ocheclc Omon:-order
,
lor i 7 4 95 (U S Funds)
OBill my
OVISA
OMastercard
~

I have lndlcaled m y card number and expiry date below
P l e s n rush me m y CODY of ~IEFORTH
b v SOTA for

nnmE:
STREET:
STRTE:
CRRD TYPE:
CARD no:

ZIP:
EXPIRY:
0OWM)O.

TRS-80 is a reelstered trademark of Radio Shack
CP/M and CP/M Plus are registered trademarks of

Volume V I I .NO. 2

41

1

I
I

ALABAMA
Huntsville FIG Chapter
Call Tom Konantz
205/881-6483
ALASKA
Kodiak Area Chapter
Call Horace Simmons
907/486-5049
ARIZONA
Phoenix Chapter
Call Dennis L. Wilson
602/956-7678
Tucson Chapter
Twice Monthly,
2nd & 4th Sun., 2 p.m.
Flexible Hybrid Systems
2030 E. Broadway #206
Call John C. Mead
602/323-9763
ARKANSAS
Central Arkansas Chapter
m i c e Monthly: 2nd Sat., 2 p.m. &
4th Wed., 7 p.m.
Call Gary Smith
501/227-7817
CALIFORNIA
Los Angeles Chapter
Monthly, 4th Sat., 10 a.m.
Hawthorne Public Library
12700 S. Grevillea Ave.
Call Phillip Wasson
213/649-1428
Monterey/Salinas Chapter
Call Bud Devins
408/633-3253
Orange County Chapter
Monthly, 4th Wed., 7 p.m.
Fullerton Savings
Talbert & Brookhurst

Fountain Valley
Monthly, 1st Wed., 7 p.m.
Mercury Savings
Beach Blvd. & Eddington
Huntington Beach
Call Noshir Jesung
714/842-3032
San Diego Chapter
Weekly, Thurs., 12 noon
Call Guy Kelly
619/268-3100 ext. 4784
Sacramento Chapter
Monthly, 4th Wed., 7 p.m.
1798-59th St., Rm.A
Call Tom Ghormley
916/44-7775

Bay Area Chapter
Silicon Valley Chapter
Monthly, 4th Sat.,
FORML 10 a.m., FIG 1 p.m.
ABC Christian School Aud.
Dartmouth & San Carlos Ave.
San Carlos
Call John Hall 415/532-1115
or call the FIG Hotline:
408/277-0668
Stockton Chapter
Call Doug Dillon
209/93 1-2448
COLORADO
Denver Chapter
Monthly, 1st Mon., 7 p.m.
Call Steven Sarns
303/477-5955
CONNECTICUT
Central Connecticut Chapter
Call Charles Krajewski
203/344-9996

FLORIDA
Orlando Chapter
Every two weeks, Wed., 8 p.m.
Call Herman B. Gibson
305/855-4790
Southeast Florida Chapter
Monthly, Thurs., p.m.
Coconut Grove area
Call John Forsberg
305/252-0108

INDIANA
Central Indiana Chapter
Monthly, 3rd Sat., 10 a.m.
Call John Oglesby
317/353-3929
Fort Wayne Chapter
Monthly, 2nd Wed., 7 p.m.
Indiana/Purdue Univ. Campus
Rm. B71, Neff Hall
Call Blair MacDermid
219/749-2042
IOWA
Iowa City Chapter
Monthly, 4th Tues.
Engineering Bldg., Rm. 2128
University of Iowa
Call Robert Benedict
319/337-7853
Central Iowa FIG Chapter
Call Rodrick A. Eldridge
515/294-5659
Fairfield FIG Chapter
Monthly, 4th day, 8:15 p.m.
Call Gurdy Leete
515/472-7077
KANSAS
Wichita Chapter (FIGPAC)
Monthly, 3rd Wed., 7 p.m.
Wilbur E. Walker Co.
532 Market
Wichita, KS
Call Arne Flones
316/267-8852
LOUISIANA

Tampa Bay Chapter
Monthly, 1st Wed., p.m.
Call Terry McNay
813/725-1245

New Orleans Chapter
Call Darryl C. Olivier
504/899-8922
MASSACHUSETTS

GEORGIA
Atlanta Chapter
Call Ron Skelton
404/393-8764
ILLINOIS
Cache Forth Chapter
Call Clyde W. Phillips, Jr.
Oak Park
312/386-3147
Central Illinois Chapter
Urbana
Call Sidney Bowhill
217/333-4150
Fox Valley Chapter
Call Samuel J. Cook
3 12/879-3242
Rockwell Chicago Chapter
Call Gerard Kusiolek
312,485-8092

Boston Chapter
Monthly, 1st Wed.
Mitre Corp. Cafeteria
Bedford, MA
Call Bob Demrow
617/688-5661 after 7 p.m.
MICHIGAN
Detroit Chapter
Monthly, 4th Wed.
Call Tom Chrapkiewicz
313/562-8506
MINNESOTA
MNFIG Chapter
Even Month, 1st Mon., 7:30 p.m.
Odd Month, 1st Sat., 9:30 a.m.
Vincent Hall Univ. of MN
Minneapolis, MN
Call Fred Olson
612/588-9532

MISSOURI
Kansas City Chapter
Monthly, 4th Tues., 7 p.m.
Midwest Research Inst.
Mag Conference Center
Call Linus Orth
816/444-6655
St. Louis Chapter
Monthly, 1st Tues., 7 p.m.
Thornhill Branch Library
Contact Robert Washam
91 Weis Dr.
Ellisville, MO 63011
NEVADA
Southern Nevada Chapter
Call Gerald Hasty
702/452-3368
N E W HAMPSHIRE
New Hampshire Chapter
Monthly, 1st Mon., 6 p.m.
Armtec Industries
Shepard Dr., Grenier Field
Manchester
Call M. Peschke
603/774-7762
N E W MEXICO
Albuquerque Chapter
Monthly, 1st Thurs., 7:30 p.m.
Physics & Astronomy Bldg.
Univ. of New Mexico
Call Rick Granfield
505/296-865 1
N E W YORK
FIG, New York
Monthly, 2nd Wed., 8 p.m.
Queens College
Call Ron Martinez
212/517-9429
Rochester Chapter
Bi-Monthly, 4th Sat., 2 p.m.
Hutchinson Hall
Univ. of Rochester
Call Thea Martin
716/235-0168
Rockland County Chapter
Call Elizabeth Gorrnley
Pearl River
914/735-8967
Syracuse Chapter
Monthly, 3rd Wed., 7 p.m.
Call Henry J. Fay
315/446-4600
OHIO
Athens Chapter
Call Isreal Urieli
614/594-3731
Cleveland Chapter
Call Gary Bergstrom
2 16/247-2492
Cincinatti Chapter
Call Douglas Bennett
513/831-0142

Dayton Chapter
Twice monthly, 2nd Tues., &
4th Wed., 6:30 p.m.
CFC 11 W. Monument Ave.
Suite 612
Dayton, OH
Call Gary M. Granger
513/849-1483

OKLAHOMA
Central Oklahoma Chapter
Monthly, 3rd Wed., 7:30 p.m.
Health Tech. Bldg., OSU Tech.
Call Larry Somers
2410 N.W. 49th
Oklahoma City, OK 73112

OREGON
Greater Oregon Chapter
Monthly, 2nd Sat., 1 p.m.
Tektronix Industrial Park
Bldg. 50, Beaverton
Call Tom Almy
503/692-2811

PENNSYLVANIA
Philadelphia Chapter
Monthly, 4th Sat., 10 a.m.
Drexel University, Stratton Hall
Call Melonie Hoag
215/895-2628

TENNESSEE
East Tennessee Chapter
Monthly, 2nd Tue., 7:30 p.m.
Sci. Appl. Int'l. Corp., 8th F1.
800 Oak Ridge Turnpike, Oak Ridge
Call Richard Secrist
615/693-7380

VERMONT
Vermont Chapter
Monthly, 3rd Mon., 7:30 p.m.
Vergennes Union High School
Rm. 210, Monkton Rd.
Vergennes, VT
Call Don VanSyckel
802/388-6698

VIRGINIA
First Forth of Hampton Roads
Call William Edmonds
804/898-4099
Potomac Chapter
Monthly, 2nd Tues., 7 p.m.
Lee Center
Lee Highway at Lexington St.
Arlington, VA
Call Joel Shprentz
703/860-9260
Richmond Forth Group
Monthly, 2nd Wed., 7 p.m.
154 Business School
Univ. of Richmond
Call Donald A. Full
804/739-3623

WISCONSIN
Lake Superior FIG Chapter
Call Allen Anway
715/394-8360
MAD Apple Chapter
Contact Bill Horzon
129 S. Yellowstone
Madison, WI 53705

FOREIGN
AUSTRALIA

TEXAS
Austin Chapter
Contact Matt Lawrence
P.O. Box 180409
Austin, TX 78718
Dallas/Ft. Worth
Metroplex Chapter
Monthly, 4th Thurs., 7 p.m.
Call Chuck Durrett
214/245-1064
Houston Chapter
Call Dr. Joseph Baldwin
713/749-2120
Permian Basin Chapter
Call Carl Bryson
Odessa
915/337-8994

UTAH
North Orem FIG Chapter
Contact Ron Tanner
748 N. 1340 W.
Orem, UT 84057

VolumeVII, No. 2

Southern Belgium FIG Chapter
Contact Jean-Marc Bertinchamps
Rue N. Monnom, 2
B-6290 Nalinnes
Belgium
071/213858

Melbourne Chapter
Monthly, 1st Fri., 8 p.m.
Contact Lance Collins
65 Martin Road
Glen Iris, Victoria 3146
03/29-2600
Sydney Chapter
Monthly, 2nd Fri., 7 p.m.
John Goodsell Bldg.
Rm. LG19
Univ. of New South Wales
Sydney
Contact Peter Tregeagle
10 Binda Rd., Yowie Bay
02/524-7490

CANADA
Nova Scotia Chapter
Contact Howard Harawitz
227 Ridge Valley Rd.
Halifax, Nova Scotia B3P2E5
902/477-3665

Southern Ontario Chapter
Quarterly, 1st Sat., 2 p.m.
General Sciences Bldg.
Rm. 312
McMaster University
Contact Dr. N. Solntseff
Unit for Computer Science
McMaster University
Hamilton, Ontario L8S4K1
416/525-9140 ext. 3443
Toronto FIG Chapter
Contact John Clark Smith
P.O. Box 230, Station H
Toronto, ON M4C5J2

COLOMBIA
Colombia Chapter
Contact Luis Javier Parra B.
Aptdo. Aereo 100394
Bogota
214-0345

ENGLAND
Forth Interest Group - U.K.
Monthly, 1st Thurs.,
7p.m., Rrn. 408
Polytechnic of South Bank
Borough Rd., London
D.J. Neale
58 Woodland Way
Morden, Surry SM4 4DS

BELGIUM
Belgium Chapter
Monthly, 4th Wed., U):OOh
Contact Luk Van Loock
Lariksdreff 20
2120 Schoten
03/658-6343

FRANCE
French Language Chapter
Contact Jean-Daniel Dodin
77 Rue du Cagire
31100 Toulouse
(16-61) 44.03.06

43

GERMANY
Hamburg FIG Chapter
Monthly, 4th Sat., 1500h
Contact Horst-Gunter Lynsche
Common Interface Alpha
Schanzenstrasse 27
2000 Hamburg 6

IRELAND
Irish Chapter
Contact Hugh Doggs
Newton School
Waterford
051175757 or 051/74124

ITALY
FIG Italia
Contact Marco Tausel
Via Gerolamo Forni 48
20161 Milano
021'645-8688

JAPAN
Japan Chapter
Contact Toshio Inoue
Dept. of Mineral Dev. Eng.
University of Tokyo
7-3-1 Hongo, Bunkyo 113
812-2111 ext. 7073

REPUBLIC OF CHINA
R.O.C.
Contact Ching-Tang Tzeng
P.O. Box 28
Lung-Tan, Taiwan 325

SWITZERLAND
Swiss Chapter
Contact Max Hugelshofer
ERN1 & Co., Elektro-Industrie
Stationsstrasse
8306 Bruttisellen
01/833-3333

SPECIAL GROUPS
Apple Corps Forth Users
Chapter
Twice Monthly, 1st &
3rd Tues., 7:30 p.m.
1515 Sloat Boulevard, #2
San Francisco, CA
Call Robert Dudley Ackerman
415/626-6295
Baton Rouge Atari Chapter
Call Chris Zielewski
504/292-1910
FIGGRAPH
Call Howard Pearlmutter
408/425-8700

FORTH Dimensions

Seventh Annual

Forth National Convention
September 20-21, 1985

Hyatt Rickeys, Palo Alto
4219 El Camino Real, Palo Alto, California
Forth Elements Conference Program
EARTH AEROSPACE FIRE WATER
Major Forth conference covering Earth resources, aerospace projects, fire and
fusion in industry, and water hydroprojects. Learn about these successful
Forth applications during the two-day conference.

Convention preregistration $10.00; or $15.00 at the door.
Banquet $32.00
Special Convention room rates are available a t Hyatt Rickeys.
Telephone direct to Hyatt reservations by calling 800 228-9000 and request
special Forth Interest Group rates for September 20th and 21st.

More information . . . . . . . . . . . . . . . . Call FIG Hotline 408 277-0668
Be a conference speaker . . . . . . . . . Call FIG Hotline 408 277-0668
Exhibitor information . . . . . . . . . . . . Call FIG Hotline 408 277-0668

FORTH INTEREST GROUP
P. O. BOX8231
Sari Jose, CA 95155

BULK RATE
U S POSTAGE
Permit NO. 3107

San Jose, CA

Address Correction Requested



Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.6
Linearized                      : Yes
XMP Toolkit                     : 3.1-702
Create Date                     : 2004:04:21 04:10:13-07:00
Creator Tool                    : Adobe Acrobat 7.08
Modify Date                     : 2007:02:02 00:07:32-08:00
Metadata Date                   : 2007:02:02 00:07:32-08:00
Producer                        : Adobe Acrobat 7.08 Paper Capture Plug-in
Format                          : application/pdf
Document ID                     : uuid:ff49aa60-fb4f-4d5d-9c80-211056e4ad0a
Instance ID                     : uuid:36b10865-ae16-461c-87a9-96de88db2a57
Page Count                      : 44
Creator                         : Adobe Acrobat 7.08
EXIF Metadata provided by EXIF.tools

Navigation menu