Skip to main content

Full text of "Forth Dimension Volume 04 Number 4"

See other formats


FORTH 






VOLUME IV, NUMBER 4 



$2.50 



INSIDE: 



CODING FOR ROM 

79 FORTH ROM for Apple II 

ROMable FORTH with Separate Headers. 
8080 fig-FORTH in ROM 



Dr. C. H. Ting 6; 

Robert H. Hertel, Robert D. Villwock 91 

i 

Ted Croat 161 



FEATURES: 

Quick Text Formatter — Part II 



Leo Brodie 21 



DEPARTMENTS: 

Letters 

Standards Corner 

A Techniques Tutorial 



3 

311 
33 i 




CODING FOR ROM 



pORTH Programming J^ids 

from Curry Associates 



Forth Programming Aids is 

a software package containing 
high-level FORTH routines that 
allow you to write more efficient 
programs in less development 
time. It is also useful for 
maintaining existing FORTH 
programs. The FPA package 
includes four modules: 



TRANSLATOR provides a 
one-to-one translation of 
FORTH run-time code. 



CALLFINDER finds calling 
words, i.e. calls to a specific 
word. 



DECOMPILER generates 
structured FORTH source code 
from RAM and inserts program 
control words (e.g., IF, ELSE). 

SUBROUTINE DECOMPILER 

finds called words, i.e., words 
called by a specific word, to all 
nesting levels. 



Forth Programming Aids 

enables you to: 

■ Minimize memory require- 
ments for target systems by 
finding only those words used 
in the target application. 

■ Tailor existing words (includ- 
ing nucleus words) to specific 
needs by decompiling the 
word to disk, editing, and 
recompiling. 

■ Build on previous work by 
extracting debugged FORTH 
routines (including constants 
and variables) from RAM to 
disk. 

■ Patch changes into existing 
compiled words in seconds. 

Forth Programming Aids 

comes with complete source 
code and a 50-page, indexed 
manual. 



The DECOMPILER alone is 
worth a second look. This is a 
true decompiler which converts 
the FORTH words in RAM into 
compilable, structured FORTH 
source code, including program 



You can decompile one word, 
or a range of words at one 
time — even the whole FORTH 
system! This decompiled output 
may be sent by FPA options to 
the console, printer, or disk. 



control words such as IF, ELSE, 
THEN, BEGIN, etc. If you ask 
FPA to DECOMPILE the nucleus 
word INTERPRET, you get the 
following output displayed on 
your terminal within 3 seconds: 



DECOMPILE is useful for look- 
ing up words, or for obtaining 
variations of words by decom- 
piling to disk, editing, and 
recompiling. 



( NFA!.:F'Fh: 4796 4S10 ) 
: INTERPRET 

BEGIN -FIND 

IF STATE :i) < 
IF CFA . 

ELBE CFA EXECUTE 

THEN -'STACK 
ELSE HERE NUMBER DEL .5 1 + 

IF L COMPILE J DLITERAl 

ELSE DROP C COMPILE J LITERAL 

THEN ''STACK 
THEN 
AGAIN : 



System Requirements: FORTH nucleus based on the fig-FORTH model or 79-STANDARD; a minimum 
of 3K bytes and a recommended 13K bytes of free dictionary space. 

For more information, call Ren Curry 415/322-1463 or Tom Wempe 408/378-2811 



Yes, send me a copy of Forth Programming Aids, including all source code and the 50-page manual. 

□ fIg-FORTH model $1 50 Calif, residents add 6.5% tax. 

□ FORTH-79 STANDARD (specify system) $150 Foreign air shipments add $15. 

□ Manual alone (credit toward program purchase) $25 

□ Send more information 



□ Master Charge □ Visa Account Number 

Name 

Company 

Street 



City/State/Zip _ 



Exp. Date_ 



Indicate disk format: 

□ 8" ss/sd fig-FORTH screens 

□ 8" ss/sd CP/M" 2.2 file 

□ Apple 3.3 

□ PC FORTH 

□ Othier, 



Send to: Curry Associates, P. O. Box 11324, Palo Alto, OA 94306 415/322-1463 or 408/378-2811 



FORTH Dimensions 



2 



.>--ie IV. No. 4 



Letters . . . 



2C0NSTANT and/or DCONSTANT 

Dear FIG, 

Charles H. Moore recently explain- 
ed to me the origin of 2C0NSTANT, 
2VARIABLE, 2DUP etc. In spite of my 
earlier opinion, that we certainly do 
not mean 2 constants with 2C0NSTANT, 
he really did mean 2 constants. The en- 
tire family of words were originally 
used to apply to two integers! The two 
intergers were ratios to be used with 
operations such as */. For example: 

355 113 2C0NSTANT PI 
Then to multiply a value by PI: 

1000 PI */ 

This all makes sense to me now. See 
the footnote on page 122 of Starting 
FORTH for a handy table of similar 
ratios. 

The implementation of these words 
usually is the same as the implemen- 
tation necessary for operations on dou- 
ble precision integers. Thus it might be 
argued that there is no reason for dif- 
ferent names for the double number 
word set. 

However, Charles Moore also poin- 
ted out to me that the implementations 
are not always the same. I gather that 
they are never the same in 32-bit CPUs. 

We have a precedent for different 
names with the same function — for 
example: R@ and I. Though the im- 
plementation may be the same for 
2C0NSTANT, with two single integer 
constants, and DCONSTANT, for a dou- 
ble precision constant, the meaning is 
different. As long as the implementa- 
tion remains the same there is no con- 
flict in using one as an alias for the 
other. But beware! 

GJen B. Haydon 
La Honda, California 



Neater S->D 

Dear FIG, 

In Vol. IV, No. 1 Robert Smith gave 
us a definition of S— > D to convert 16 
to 32 bit integer. We have used a much 
neater one for a long time: 

: S->D DUP 0< MINUS ; 
Think about it! 

].R. (Roger] Stapleton 
University Observatory 
St. Andrews, Fife. 

Scotland 



FORTH Machine Project 

Dear FIG, 

I would like to extend an invitation 
to anyone interested to take part in a 
volunteer project to build a FORTH 
machine. Some support will be coming 
from Advanced Micro Devices, in- 
cluding one of their new 29116 16 bit 
wide microprogrammable chips. Any- 
one interested in this should contact 
me at the address and phone number 
below. 

Martin Schaaf 
IWO N. Placentia, #E-38 
FuUerton, California 92630 
(714) 993-7128 



Reflections 

Dear FIG, 

It is said that introspection is good 
for the soul. Let's slow down and 
reflect for a few moments on the 
marvelous invention wich we know as 
FORTH and the industry which has 
sprung up around it. 

It has become clear that Charles 
Moore's efforts to increase his produc- 
tivity as an applications programmer 
has had and will continue to have a 
substantial impact on the software in- 
dustry. What has caused this remark- 
able phenomenon? 

— FORTH was designed and im- 
plemented by an eminently capable 
committee of 1. 

— FORTH was hammered into its cur- 
rent form on the hard anvil of actual 
applications experience. 

— FORTH was the by-product of 
work done under a government grant, 
rather than the object of the grant. 

— A small group of applications pro- 
grammers who had experienced the 
awesome power of FORTH recog- 
nized the critical lack of FORTH ven- 
dors and selflessly conspired to 
develop and place in the public do- 
main FORTH implementations for all 
of the major microprocessors. Thus 
came the birth of FIG and a revolution 
in the software industry. 

These efforts have resulted in a 
burgeoning FORTH community com- 
plete with a deluge of vendors offering 
a wide range of products, a broadly 
based interest group, and a lengthy list 



of successful projects in which 
FORTH has played a major role. One 
can almost feel the ground rumble as 
IBM, HP, GE, and other industry 
giants start to sit up and take notice. 

Although this all sounds so wonder- 
ful, I have some grave concerns over 
the state of our young industry. 

First, we have failed to publicly 
recognize the individual contributions 
of our teachers. Although we stand on 
the shoulders of giants, we have 
systematically failed to recognize them 
for the tremendous contributions they 
have made. 

Who publicly acknowledges the debt 
to Charles Moore? or Bill Ragsdale? 
What recognition has Dean Sanderson 
received? How strongly do vendors of 
FIG model derivatives acknowledge 
their debt to the implementors? What 
mechanism exists to express our 
gratitude to these people? 

Perhaps, due to the effort required to 
learn the internals of FORTH, we 
overemphasize our own intellect at the 
expense of our teachers. No other suc- 
cessful philosophy or technique which 
I am aware of has this ominous attri- 
bute. 

Letters continued on next page 



FORTH Dimensions 

Published by FORTH Interest Group 
Volume IV, No. 4 
November/December 1982 
Editorial/Production 
Leo Brodie 
Publisher 
Roy C. IVIartens 



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 repro- 
duced with credit given to the author 
and 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/or to submit 
material, the address is: FORTH 
Interest Group, P.O. Box 1105, San 
Carlos, CA 94070 



FORTH Dimensions 



3 



Volume IV, No. 4 



Letters . . . (cont.j 



Second, we have become confused 
over what FORTH is. We have attemp- 
ted to force a comprehensive appUca- 
tions programming approach into the 
confines of what has traditionally been 
termed a programming language. We 
are guilty of placing constraints on 
what FORTH can be and endowing it 
with features it was never meant to 
have. 

Standard FORTH programs current- 
ly must limit themselves to string I/O 
to the system console and block I/O to 
the first 32 blocks available on mass 
storage. Although it is possible to fetch 
and store data within the 64K byte ad- 
dressable range, it is unlikely that 
hardware specific addresses or data 
formats will be relevant, unless the 
program is transported to an identical 
configuration. Given a reasonable 
amount of mass storage. Data Reduc- 
tion, DataBase manipulation and self- 
contained algorthms appear to be the 
only likely candidates for transporta- 
tion across standard systems. 

The goal of standardization is to 
allow the transportation of hardware 
and configuration independent 
algorthms across standard FORTH 
systems. Few existing FORTH appli- 
cations are either hardware or con- 
figuration independent. In the past, 
FORTH has been applied mostly to 
solving applications which were 
distinguished by their hardware and 
configuration dependent nature. 
Without the ability to extend and adapt 
itself around such environments, 
FORTH would not be where it is 
today. 

It has been my experience that por- 
tions of applications which control 
specific hardware are transportable at 
two levels. Either as a generic 
algorthm for supporting a specific 
class of hardware (i.e., graphics) or as 
a specific algorthm to support a 
specific device in a new environment 
(i.e., disc conroUer]. Both cases typical- 
ly require some level of tailoring in the 
new environment. 

As a member of the standards team, 
I am concerned with how to specify 
a "standard" FORTH environment 
which is flexible enough to handle 
both cases and still provide the 
transportability we all desire. 



Third, although we have been ex- 
tremely successful in providing a 
tremendously powerful tool to a large 
number of people, we have failed to 
teach them how to effectively use it. 
As a result, a lot of effort has been 
spent on careful inspection and in- 
fatuation with the tool rather than ex- 
periencing the benefits of its use. 

It is said that the first two applica- 
tions that a new FORTH programmer 
writes are a de-compiler and a screen 
editor (order dependent on whether or 
not source code for the system was 
supplied). I would feel more comfor- 
table if the majority of new FORTH 
programmers were immediately able 
to use the tool to solve an application 
problem. The best complement we can 
bestow upon our teachers is effective 
use of what they taught us. 

Finally, if the FORTH community is 
to continue to grow, we must all 
become more business-like. While 
recognizing that availability of low 
cost, public domain versions has been 
instrumental in the proliferation of the 
language, we are quickly approaching 
the point when we will have reached 
all those hardy souls willing to provide 
enough of their own efforts to over- 
come the limited documentation and 
support implications of such low cost 
versions. We are already seeing 
FORTH rejected for perfectly feasable 
applications due to unwillingness on 
the part of the customer to shoulder 
this burden. 

As is typical of the software in- 
dustry, we all underestimate the cost 
and effort involved in developing and 
supporting a software product. I claim 
that the total net worth of all FORTH 
vendors is under 3 million dollars, and 
that the total yearly revenues resulting 
directly from FORTH goods and ser- 
vices is under 5 million dollars. 

I know of few reasonably profitable 
FORTH vendors and suspect that most 
are just meeting expenses. Unfor- 
tunately, I don't see this picture chang- 
ing substantially in the near future. 

Although I can conceive of nothing 
I enjoy more than providing tools and 
solutions to technically challenging 
applications, I am concerned that by 
trading fun for cash, we do ourselves 
and our industry a disservice. The 



accumulation of capital would provide 
the necessary management and sup- 
port services (i.e., product specific 
documentation) which I feel is so 
desperately needed. 

You may accuse me of presenting 
views intended to feather my own bed 
as a FORTH vendor. I would like to 
believe that my interests are more 
highly motivated by the concerns that 
we more suitably honor our teachers. 
A healthy industry can better repay 
this debt. 

Don Colburn 
FORTH Programmer 



Closer Approximations 

Editor's Note: Some of you may he in- 
terested in this letter I recently received: 

Dear Mr. Brodie, 

I am reading and enjoying your 
book, Starting FORTH. I found some 
better approximations for your foot- 
note on page 122. Here they are, along 



with the 


ones from 


page 122: 


Definition 


Approximation 


(Approx.-Def.)/Definltlon 


e 


28667 / 10546 


- 5.7 X 10 » 




25946 / 9545 


- 2.0 


V10 


22936 / 72S3 


5.7 




27379 / 8658 


0.67 " 


Ln2/16.384 


485 / 11464 


91. 




846 / 19997 


-12. 



Robert T. Corry 
Polytechnic University of New York 
Brooklyn, New York 



Virginia Figs? 

Dear FIG, 

Do you have any method of helping 
members to locate other members? 
The Potomac FORTH Interest Group 
is currently the closest I know of, and 
120 miles is a long way to go. I would 
like to see a central Virginia FIG 
organized, or organize one. Any 
suggestions? 

John C. Lundin, Jr. 
Richmond, Virginia 

John, let's hope your letter stirs up some 
interest in the Richmond area. See 
"Start Your Own FIG Chapter" on page 
5. —Editor 

Letters continued on next page 



FORTH Dimensions 



4 



Volume IV, No. 4 



Letters . . . (cont.) 

Cleaner Stepper Driver 

Ze£: FIG. 

FGRTH certainly is a splendid 
^"g_age for controlling stepper 
~ and the method shown in the 
Txze'.'.ent article by Martin Petri and 
li?: 5:odie can be compacted still fur- 
tzr: 3\ reducing the outputs table to 
4 bytes. 

my implementation, each motor 
^ iii;gned a byte-variable (X-PHASE, Y- 
mASE). whose value is restricted to 0-3 
izi -.vhich is a pointer to the current 
-I'lauon of the motor phase within the 
'iz\e sequence 5, 6, A, 9. The word 
STEPCODE expects on the stack a direc- 
flag and the address of the 
—PHASE word for the motor to be step- 
STEPCODE fetches the current 
zc.nter. increments or decrements it 
iiiording to the direction flag, ANDs 
-jie result with 0003 to maintain the 0-3 
rir.ge of value, adds the result to the 
:£;e value for the table, and fetches 
:r.e output code. The ANDed result is 
-^io stored back to —PHASE. 

The outputs code table has values in 
:-:h nibbles, i.e., 55,66,AA,99. The 
. =;ue left by STEPCODE is ANDed with 
e.iner OOOF or OOFO to leave only the 
;jde for the selected motor. If 16-bit 
ports are available, this scheme can be 
readily expanded to control 4 motors. 

I invented this method while work- 
ing on an 1802-based application; 
iince then I have seen it described 
:nree times in the literature, for con- 
:roI applications ranging from wafer 
scribers to radio telescopes, and it is 
completely in the public domain. 

And last — regardless of the method 
used to generate the code, the DO loop 
which steps the motor should include 
a word which tests the limit switch in 
the direction of travel for the motor be- 
ing stepped, and if set then executes 
LEAVE, and jumps immediately to LOOP, 
without stepping the motor. 

MTFBWY, 
WendaJJ C. Gates, PE 
Advanced Instrumentation 
Santa Cruz, California 

Thanks, Mr. Gates and MTFBWY, too. 
— Editor □ 



"What did FORTH say to 
BASIC?" 
"I'm okay, you're ready." 

—Ed Rotberg 



Start Your 
Own FIG 
Chapter 

What is a FIG Chapter? 

There are two kinds of FIG chapters; 
local, and special-interest. Local 
chapters are centered in a city or 
region, special-interest chapters may 
be non-geographical; they focus on an 
interest area such as an application 
(e.g., robotics, telecommunication), or 
on FORTH for a particular computer. 

All chapters must provide a contact 
point, and some form of regular 
public access (usually meetings). Non- 
geographical chapters will normally 
provide other forms of access, such as 
a newsletter or telecommunications, 
instead of meetings. 

Why Have a FIG Chapter? 

A chapter lets you share information 
with other FORTH users in your 
geographical or application area. In 
addition, FIG provides several specific 
benefits: 

(A) FIG will list your chapter in 
FORTH Dimensions, so that others can 
find your group. 

(B) FORTH Dimensions will give 
priority to publishing chapter news, 
which can help you make professional 
contacts in the areas of your particular 
interests. 

(C) FIG will occasionally supply 
material, such as meeting handouts or 
tapes, which can serve as a discussion 
topic at local meetings. 

(D) FIG will supply its publications 
at bulk rates; local chapters can sell 
them to raise money, and to provide 
immedite local access to the material. 

(E) Chapters can apply to FIG for 
one-time funding for activities. 

How to Start a FIG Chapter 

To be recognized as a chapter, a group 
must have (1) a contact person, (2) 
regular public access (usually by 
meetings which are open to the 
public), and (3) at least five members 
of FIG. If you don't know five 
members in your area, FIG can help 
you contact them. If you want to start 
a chapter, send a request for a FIG 
Chapter Kit to the Chapter coor- 
dinator, FORTH Interest Group, P.O. 
Box 1105, San Carlos, CA 94070. 



Chapter News 

New Jersey Chapter 

The New Jersey FIG Chapter held its 
fourth meeting October 28th at the 
Computer Center of Rutgers Univer- 
sity, in New Brunswick. Meetings are 
purely informal discussions at this 
stage, with between ten and twenty 
members at our previous meetings; 
cocktail-party style multiple conversa- 
tions is the rule, as we have yet to 
receive any offers for set piece presen- 
tations. Some presentations are in 
written handouts that may or may not 
be discussed at the meeting. 

Everyone is a fig-FORTH model user 
at the moment, and several are in- 
volved in implementations on new 
machines including 8086, 68000, and 
Perken Elmer mainframes. As the 
number of participants grows a more 
formal organization may be created, 
but for the moment there is no mail- 
ing list or dues; attendees at one 
meeting set the time and place of the 
next meeting. 

We have been very fortunate to date 
by having members volunteer facilities 
at their academic institutions for the 
meetings. Meetings are bimonthly. 
Call George Lyons at home at (201) 
451-2905 to learn the place and time 
of the next meeting. 

Potomac Chapter 

Joel Shprentz described and demon- 
strated the cross compiler system crea- 
ted by Nautilus Systems. Joel has used 
it to prepare new versions of FORTH 
for the TRS-80 and to create ROMable 
code for control applications. 

The demonstration traced the devel- 
opment of an application from interac- 
tive development to cross compilation 
to ROM burning. 

Dayton Chapter 

The Dayton Chapter of FIG held its 
second meeting at the Datalink Com- 
puter Center on Sept. 14, 1982 with 
fourteen members in attendance. 

Mr. James Gaston told about his pro- 
blems in learning FORTH when he 
was first programming. He suggested 
that a good club project would be to 
build a FORTH model for the new 
Motorola 68000 microprocessor. The 
membership was in favor of the pro- 
ject, so we will begin at our next meet- 
ing, October 12, 1982, with Jim offer- 
ing suggestions in order to give each 
person a chance to learn the process. 



FORTH Dimensions 



5 



Volume IV, No. 4 



TS-FORTH ROM for Apple II 



Dr. C. H. Ting 



The Design Goals 

The main purpose of this project 
was to implement a FORTH system of 
the lowest possible cost, and to carry 
this exciting language to the large 
population of Apple II users. To lower 
the system cost, it is necessary to fully 
utilize all the existing resources inside 
the Apple II computer, without such 
expensive peripherals as the floppy 
disk drives. The design goals were 
thus set as follows: 

• Use a stripped Apple II as the 
host 

• Put the FORTH dictionary in 
8K bytes of ROM 

• Implement the 79-Standard 
with editor and assembler ex- 
tensions 

• Build a pseudo disk in RAM 
with cassette tape as the off- 
line storage medium 

The resuh will be a FORTH com- 
puter in a small box, which can be 
operated standing-alone and has the 
capacity of expanding into many 
educational and professional appli- 
cations. 

Development Tools 

I did not have very sophisticated 
tools to develop 6502 based microcom- 
puter systems. The only tool was a HP 
65000 Development System, which 
had a 6502 cross assembler in it. The 
only way to build a FORTH system 
was to assemble the 6502 assembly 
source program on this development 
system, burn the object codes into a set 
of PROMs, and insert the PROMs in- 
to the Apple for testing and debugging. 
Any uncovered bug would have to be 
fixed at the source level. However, I 



had both the Auto Start Monitor and 
the Old Monitor in the Apple. The lat- 
ter was very useful in the debugging 
process because of its trace capability. 
Approach 

Because of the lack of good develop- 
ment tools, it would be very difficult 
trying to build a FORTH system from 
scratch towards the design goals. The 
best approach was to divide the pro- 
ject into two phases: 

• Implement a fig-FORTH sys- 
tem using the 6502 fig-FORTH 
source listing; and 

• Modify the fig-FORTH to 
meet the design goals. 

It was extremely important to build 
a working fig-FORTH system, because 
the object codes can be checked out by 
comparing byte-by-byte with the 
source. This greatly eased the task of 
debugging. Once I had the fig-FORTH 
running, further modifications could 
be checked and debugged using the 
FORTH interpreter, which was much 
more convenient to use and test. 
Implementation 

I first keyed in the 6502 source 
codes, identical to the 6502 fig-FORTH 
Source Listing. Both the source codes 



The result was four 

2716 PROMs 
sitting neatly on a 
small PC board. 



and the assembled object codes were 
thoroughly checked out. After chang- 
ing the terminal I/O routines and off- 
seting the object codes to start at 
6000H, the resulting object codes were 
burnt into 2716's and moved into the 
Apple on the Apple ROM Card. Using 
the Apple Monitor, I could move the 



dictionary from the PROM's into 
RAM area, starting at 6000H. Debug- 
ging in RAM was much easier than 
doing it in ROM. The tracing aids pro- 
vided by the fig-FORTH was helpful. 
However, I found it was more conve- 
nient to replace the JMP W-1 instruc- 
tion by BRK, which returned the 
system to the monitor. To continue 
execution, I just keyed in OBOG in the 
monitor, which jumped over to W-1 
(address OBOH) and continued onto 
the next word. 

Only minor errors were detected 
and fixed at this stage, because most 
errors were flushed out by byte com- 
parison of object codes. Since the en- 
tire system was in RAM, errors were 
corrected immediately and more tests 
could be carried out before a new set 
of PROMs were burnt. 

After the fig-FORTH was thoroughly 
bug free, I proceeded to the task of 
modifications. The first thing to do 
was to trim the fig tree, making room 
for the editor and the assembler. I 
deleted the name fields and the link 
fields of all the run-time codes and 
some system words which the users 
are not expected to use. All the disk 
words were also deleted because the 
final system would not have a disk. 
The pseudo disk was implemented by 
a simple redefinition of BLOCK: 
: BLOCK (n addr) 

MAXBUF MOD B/BUF * FIRST + ; 
It returns a RAM address of the 
desired block, from which data can be 
referred. 

The second task was to make the 
FORTH system ROMmable. All varia- 
bles were either eliminated or changed 
to user variables. The only impure 
words were the vocabulary words like 
FORTH. To make FORTH, EDITOR, and 
ASSEMBLER stay comfortably in ROM, 
a new defining word ROM-VOCABULARY 
ought to be used: 

Continued on next page 



FORTH Dimensions 



6 



Volume IV, No, 4 



yU I URTH ROM for Apple II (continued from page 6) 



WM-VOCABULARY ( addr ) 

OffiATE , DOES> @ CURRENT ! ; 
1062 ROM-VOCABULARY FORTH 
1068 ROM-VOCABULARY EDITOR 
106E ROM-VOCABULARY ASSEMBLER 

Zze addresses specified above point 
:: "_~e R,\M locations where the name 
T.-e.z addresses of the last words 
zer.ned in the respective vocabularies 
ire stored. These RAM locations are 
:: be initialized at boot-up to: 

FORTHUNK: 1060H: A081 
EF3D 

EINTRLINK: 1066H: A081 
E8DF 

ASSEMLINK: 106CH: A081 
EE01 

Tr.e original VOCABULARY remained in 
tne dictionary for the purpose of 
:reating new vocabularies in RAM by 
:-e user. 

The editor was basically the fig- 
FORTH editor. However, the com- 
— and structure was modified to that 
used by Brodie in his Starting FORTH. 
'. hoped to use Starting FORTH as an 
instruction manual for this ROM 
FORTH system and a compatible 
editor would not do any harm. The 
only major departure from the Starting 
FORTH editor was the handling of 
null strings. Only one string buffer 
i PAD) was used here, while Brodie used 



two independent buffers for searching 
and inserting. 

Bill Ragsdale's 6502 Assembler was 
included in this FORTH to let the user 
experiment at the code level. 

Finally, the whole system was up- 
dated to the 79-Standard. Many words 
needed to have their names changed. 
A few new words were added, and a 
few words needed to be redefined. 
Bob Smith's '79-FORTH Conversion 
was most helpful in this phase. 
Result 

The result was four 2716 PROMs sit- 
ting neatly on a small PC board. When 
it was inserted into Slot in an Apple 
II, it turned the Apple into a very 
powerful FORTH computer. In an 
Apple II with 48K bytes RAM, 24K are 
used as a pseudo disk which holds lots 
of programs. With some tricks like 

-32 OFFSET ! 
one could even turn the 16K high 
graphics memory into a second disk, 
making the total disk memory 40K. 
The programs can be dumped to cas- 
sette tape for storage. By loading or 
dumping large chunks of memory 
from or to tape, the necessity of disk 
can be avoided while still having all 
the advantages of FORTH. The main 
dictionary, securely stored in PROMs, 
makes the system immune from fre- 
quent crashes during program devel- 
opment and testing. □ 



FORTH Dementia 



Leo Brodie 




ADA PPOGRAMHEK AND FORTH PROGRAHHr^ 
i OBSERVING CREATION 

FORTH Dimensions 7 



FOR TRS-80 MODEL I OR III ' 
IBM PERSONAL COMPUTER 

MORE SPEED 

10-20 tliriM faat«r th«n intsrpreted BASIC. 
MORE ROOM 

Vary compact compiled code plus VIRTUAL MEMORY 
makes your RAM act larger. Variable number of block 
buffers. 3i-char.-unlque wordnames use only 4 bytes In 
header! 

MORE INSTRUCTIONS 

Add YOUR commands to Its 7S-STANDAflD-plus instruc- 
tion set! 

Far more complete than most Forths: single & double 
preclalon, arrays, string-handling, ctOck, graphics (IBM 
low-res. gives B/W and ^6 color or 200 tint color display) 

MORE EASE 

Excellent full-screen Editor, structured & modular 

programming 

Word search utility 

THE NOTEPAD letter writer 

Optimized for your TRS-OO or IBM with keyboard repeats 
upper/lower case display driver, full ASCII 

MORE POWER 

Forth operating system 

Concurrent Interpreter AND Compiler 

VIRTUAL I/O for video and printer, disk and tape 

dO-Meaabyte hard disk available) 

Full 8080 or 8088 Assembler aboard 

(Z80 Assembler also available tor TRS-SO) 

intermix 35- to 80-track disk drives 

IBM can read, write and run M 3 Disks 

M.3 can read, write and run M.1 disks 




Fmrn 



THE PROFESSIONAL FORTH SYSTEM 
FOR TRS-80 & IBM PC 

(Thousands ot systems in use) 
MMSFORTH Disk System (requires 1 disk drive, 32K RAM) 

V2.0 For Radio Shack TRS-dO Model I or lii S129.85 

V2 1 For IBM Personal Computer (80-col. screen] . S249,95 

AND MMS GIVES IT PROFESSIONAL SUPPORT 

Source code provided 

MMSFORTH Newsletter 

Many demo programs aboard 

MMSFORTH User Groups 

Inexpensive upgrades to latest version 

Programming staff can provide advice, modifications and 

custom programs, to fit YOUR needs 

MMSFORTH UTILITIES DISKETTE: includes FLOATING POINT 
MATH (BASIC ROM routines plus Complex numbers, Rectan 
gular-Poiar coordinate conversions, Degrees mode, more): a 
powerful CROSS-ftEFERENCER to list Forth words Dy block 
and line; plus (TRS-60) a full Forth-style Z80 assemble) 
requires MMSFORTH V2.0. 1 drive & 32K RAM) $39.95* 

FORTHCOM: communications package provides RS-23S 
driver, dumb terminal mode, transfer of FORTH blocks, ana 
host mode to operate a remote FORTHCOM systems (requires 
MMSFORTH V2.0, 1 drive & 32K RAM) S39.95- 

THE DATAHANDLER: a very fast database management 
system operable by non-programmers (requires MMSFORTH 
V2.0, 1 drive & 32K RAM) $59.95* 

FORTHWRITE: fast, powerful Word Processor wJeasy 
keystrokes, Help screens, manual & demo files. Full propor- 
tional w/tabs, outdenting. Include other blocks, documents & 
keyboard inputs— ideal tor form letters (requires MMSFORTH 
V2.0, 2 drives & 48K RAM) $175.00* 

MMSFORTH GAMES DISKETTE: real-time graphics & board 
games w/source code. Includes BREAKFORTH, CRASH- 
FORTH. CRYPTOOUOTE. FREEWAY (TRS-80), OTHELLO & 
TICTACFORTH (requires MMSFORTH V2.0, 1 drive i 32K RAM> 

S39,9S* 

Other MMSFORTH pfoducts under development 

FORTH BOOKS AVAILABLE 

MMSFORTH USERS MANUAL • w/o Appendices $17.50* 

STARTING FORTH - best! $15.95* 

THREADED INTERPRETIVE LANGUAGES- advanced, analysis 
3t FORTH internals $18.95* 

PROGRAM DESIGN & CONSTRUCTION intro. to structured 
programming, good for Forth $16-00* 

i=ORTH-79 STANDARD MANUAL - official reference to 79- 
5TANDARD word set. etc $13.95* 

=ORTH SPECIAL ISSUE. BYTE Magazine (Aug. 1980) - A collec- 
:or"s Hem for Forth users and beginners $4.1K)* 

ORDERING INFORMATION; Software prices include 
nanuals and require signing of a single computer license for 
>ne-person support. Oescribe your Hardware. Add $2.00 S/H 
)lus $3.00 per MMSFORTH and S1.00 per additional book; 
^ass orders add 5% tax. Foreign orders add 20V«. UPS COD. 
/ISA and M/C accepted; no unpaid purchase orders or refunds. 

Seifl SAS£ tor tree MMSFQRTH tniormaVon 

Gooa aeaiers sought 

Get MMSFORTH products from your 
computer dealer or 

MILLER MICROCOMPUTER 
SERVICES (B9) 

61 Lake Shore Road, Natick, MA 01760 
(617) 653-6136 



Volume IV, No. 4 



THE FORTH SOURCE 



MVP-FORTH - A Public Domain Product 

MVP Forth is fig-FORTH modified by 100% of the FORTH-79 Standard 
Required Word Set plus the vocabulary for the instructional book Starting 
FORTH. Editor, assembler and utilities are included. 

Transportability of programs is assured since the kernal of MVP-FORTH 
is the same for all computers to the machine dependent READ/WRITE 
instructions. 

Modification and extension (up or down) is simplified by having the 
source code and through the use of MVP-FORTH Programming Aids and 
Cross Compilers. 

The CP/M® are supplied on 8", SS/SD, IBM 3740, format disks. The 
include a track and sector calculation array for down loading to other 
sizes and formats. Other disks are machine specific 

All About FORTH is an annotated glossary of MVP-FORTH words as well 
as other dialects. It is in 8080 code, other MVP-FORTH implementations 
include documentation of the differences between it and other CPU's and 
computers 



MVP-FORTH PRODUCTS for CP/M® IBM-PC® and Apple® 
n MVP-FORTH Programmer's Kit including disk with 
documentation, ALL ABOUT FORTH, and STARTING 
FORTH Assembly source listing versions. $100 

[ ! MVP-FORTH Disk with documentation. Assembly source 

listing version $75 
r MVP-FORTH Cross Compiler with MVP-FORTH source in 

FORTH. $300 
LJ MVP-FORTH Programming Aids for decompiling, 

callfinding, and translating. Specify computer $1 50 

LJ MVP-FORTH Fast Floating Point for Apple ll/ll-i- on board 

with 9511 math chip Requires MVP-FORTH for Apple $400 
! ; MVP-FORTH Assembly Source Printed listing $20 
1. i ALL ABOUT FORTH by Haydon. MVP-FORTH reference, 

plus fig-FORTH and FORTH-79. $20 

★ ★♦MVP-FORTH operates under a variety of CPU's, computers, 
and operating systems. Specify your computer and operating 
system CP/M supplied on 8", SS/SD, 3740 format %** 



FORTH DISKS 

FORTH with editor, assembler, and 
C APPLE \\m+ by 

MicroMotion $100 
r APPLE II by Kuntze $90 
~ ATARP valFORTH $50 
Zi CP/M* by MicroMotion $1 00 
LJ CROMEMCO® by Inner 

Access $1 00 

C HP-85 by Lange $90 
~ IBM-PC® by Laboratory 

Microsystems $100 

NOVA by CCI, quad 

(loppy $100 



FORTH MANUALS, GUIDES & DOCUMENTS 



manual 
!Z PET' 



by FSS $90 
TRS-80/1'' by Nautilus 
Systems $90 
6800 by Talbot 
Microsystems $100 
6809 by Talbot 
Microsystems $100 
Z80 by Laboratory 
Microsystems $50 
8086/88 by Laboratory 
Microsystems $100 
VIC FORTH byHES, VIC20 
cartridge $60 



Enhanced FORTH with: F-Floating Point, G-Graphics, T-Tutorial, 
S-Stand Alone, M-Math Chip Support, MT-Multi-Tasking, X-Other 
Extras, 79-FORTH-79 



TRS-80/1 or III by Miller 
Microcomputer Services, 
F, X, &79 $130 
TUTORIAL by Laxen & 
Harris, CP/M with a copy of 
Starting FORTH $95 
Extensions for Laboratory 
Microsystems IBM,Z80, and 



Z APPLE 11/11+ by Micro- 
Motion, F, G, & 79 $140 
Z ATARI by 

PNS, F, G, & X $90 
Z". CP/M by MicroMotion, 

F&79 $140 
: Apple ll/ll 4- , GraFORTH by 
Insoft, stand alone 
graphics $75 
. H89/Z89 by Haydon, 

T & S $250 
; H89/Z89 by Haydon, T $175 
Z IBM-PC, PolyFORTH by 
FORTH Inc., 

F, G, S, M, MT, & X $300 
Z Multi-Tasking FORTH by 

Shaw Labs, CP/M, 

X & 79 $395 
CROSS COMPILERS Allow extending, modifying and compiling for 
speed and memory savings, can also produce ROMable code. 'Requires 
FORTH disk 

; CP/M $200 I ' IBM* $300 

: H89/Z89 $200 1 i 8086* $300 

: TRS-80/1 $200 i Z80« $300 

I Northstar'--' $200 Z Apple ll/ll -i- $350 

L_ fig-FORTH Programming Aids for decompiling, callfinding, 
and translating Specify CP/M, IBM-PC, 8086, Z80, or 
Apple 11/11+ $150 



Software Floating 




Point 


$100 


8087 Support 




(IBM-PC or 8086) 


$100 


951 1 Support 




(Z80 or 8086) 


$100 


Z Color Graphics 




(IBM-PC) 


$100 


Data Base 




Management 


$200 



Z ALL ABOUT FORTH by 

Haydon. An annotated 
glossary of common FORTH 
words. MVP-FORTH 
reference. $20 

Z And So FORTH by Huang. A 
college level text. $25 

Z FORTH Encyclopedia by 
Derick & Baker. A complete 
programmer's manual to fig- 
FORTH with FORTH-79 
references Flow charted, 
2nd Ed. $25 

Z Starting FORTH by Brodie 
Best instructional manual 
available (soft cover) $16 

Z Starting FORTH (hard 

cover) $20 

[ 1980 FORML Proc. $25 

_ i 1981 FORML Proc. 

2 Vol $40 

Z 1982 FORML Proc. $25 

[ ! 1981 Rochester FORTH 
Proc. $25 

I 1982 Rochester FORTH 
Proc. $1 5 

Using FORTH $25 

■ A FORTH Primer $25 

_ Threaded Interpretive 



$12 



$20 



$19 



[Z AIM FORTH User's 

Manual 
[] APPLE User's Manual 

MicroMotion 

□ TRS-80 User's Manual, 
MMSFORTH 

Z METAFORTH by Cassady, 
Meta compiler in 8080 
code $30 
n Systems Guide to fig- 
FORTH $25 
Zl Caltech FORTH Manual $1 2 
Z Invitation to FORTH $20 
Z PDP-11 FORTH User's 

Manual 
Z CP/M User's Manual, 
MicroMotion 

□ FORTH-79 Standard 
Z FORTH-79 Standard 

Conversion 
Z Tiny Pascal in 

fig-FORTH 
Z NOVA fig-FORTH by CCI 

with editor, assembler, and 

utilities $15 
Z MVP-FORTH Source Listings 

Z; IBM-PC Z CP/M 

Z Apple 11/11 + 



$20 



$20 
$15 



$10 



$10 



$20 



Languages $20 

_ Installation Manual for fig-FORTH, contains FORTH 

model, glossary, memory map and instructions $15 

Source Listings of fig-FORTH, for specific CPU's and computers. The 
Installation Manual is required for implementation. Each $1 5 

Z 1802 6502 6800 Z AlphaMicro 

Z 8080 8086/88 Z 9900 Z APPLE II 

Z PACE _ 6809 - NOVA Z PDP-11/LSI-1 1 
Z 68000 ^ Eclipse _ VAX 
Ordering Information: Check Money Order (payable to MOUNTAIN VIEW PRESS, 
INC ), VISA, MasterCard or COD's accepted No billing or unpaid PO's California 
residents add sales tax Shipping costs m US included in price Foreign orders, pay 
n US funds on US bank, include tor tianOling and shipping by Air $5 for each item 
under $25, $10 for each item between $25 and $99 and $20 for each item over 
$1 00 Minimum order $10 All prices and products subject to change or withdrawal 
without notice Single system and/or single user license agreement required on 
some products 

DEALER & AUTHOR INQUIRIES INVITED 



MOUNTAIN VIEW PRESS, INC. 

PO BOX 4656 MOUNTAIN VIEW, CA 94040 (415)961-4103 



FORTH Dimensions 



8 



Volume IV, No, 4 



ROMable FORTH with Separate Headers 



Robert H. HerteJ 
Robert D. Villwock 
Microsystems, Inc. 



Traditional implementations of 
FORTH assume a single computer en- 
vironment in which the program is 
compiled, tested and used. In this en- 
vironment it is expected that: 

• Memory is all-RAM 

• Terminal and disk are available 

• System software (compiler, 
editor, etc.] is needed 

In a typical dedicated micropro- 
cessor application such as a "smart" 
product of some kind, there are two 
distinct environments which we will 
call the development and target envir- 
onments. The development environ- 
ment is usually the same as the 
traditional FORTH environment, but 
the target environment is different: 

• ROM/RAM memory organiza- 
tion 

• No conventional terminal or disk 

• System software is not needed. 
In our own work, the development 

setup consists of a microprocessor 
development system connected to a 
prototype target system by means of 
an in-circuit emulator. The memory 
space can be mapped so that some 
parts of the memory reside in the 
development system and other parts in 
the target hardware. 

Until recently, the usual method of 
developing FORTH software for 
dedicated applications has been to 
compile and test with a traditional 
FORTH implementation. After testing 
is completed in this mode, a "target 
compiler" or cross compiler is used to 
reprocess the source code to produce 
the final target code. This produces 
headerless target code without the 
name fields and without unneeded 
system software. ROM copies of this 
code can be installed in the target 
system. 

The cross-compilation method of 
producing ROMable code has several 



drawbacks. Obviously it adds an extra 
step to the software development pro- 
cess. The cross compiler itself is com- 
plex and much more difficult to use 
than an ordinary compiler. With the 
target names discarded, interactive 
testing becomes difficult or impossible 
at a critical point in the development 
process. 

When we selected FORTH as our 
primary software development tool, 
we decided to develop a new compiler 
to recognize and fully support the dual 
development/target environments. In 
the resulting implementation (called 
proFORTH™) the ROM/RAM and 
system/target separations are made as 
the code is compiled. Target names 
are retained in the system area of 
memory in such a way that interactive 
testing can continue until and even 
after the target code is transferred to 
ROM. When development is com- 
pleted it is only necessary to program 
ROMs for the appropriate memory 
areas; system code is simply dis- 
carded. 

The remainder of this discussion 
will describe those elements of the 
proFORTIT" system related to com- 
piling ROMable target code, and will 
explain how the programmer uses the 
system. 

Memory Organization 

The processor's memory space is 
divided into three kinds of segments; 

• ROM — target code or read-only 
memory 

• RAM — target variables or 
read/write memory 

• DICTIONARY — system code, 
names, etc. (also read/write) 

Any number of segments of each 
kind may be defined. ROM and RAM 
segments are dictated by the needs of 
the application and the design of 
its hardware. For example, separate 
ROM segments might be assigned for 
an interrupt vector jump table, op- 
tional code, and for all other target 
code. RAM areas might be set up for 
a CRT refresh memory and for all 
other target RAM. Figure 1 shows a 
memory map with these ROM and 
RAM segments defined. 



0000 

IFEO 
2000 

4000 
4800 

6000 
6400 
7000 
8000 



FFFF 



ROM 1 



ROM 2 



7777777777777 
lllllllllllll 
lllllllllllll 



ROM 3 



lllllllllllll 
lllllllllllll 
lllllllllllll 



RAM 2 



lllllllllllll 
lllllllllllll 



RAM 1 



DICTIONARY 




FIGURE 1 - SAMPLE MEMORY MAP 



Often a single dictionary area will 
suffice, but proFORTH™ supports 
multiple dictionaries and they can be 
used in a variety of ways. For now we 
will assume that only one dictionary 
is needed. 

Segments within each class are 
numbered as indicated in Figure 1. 
ROM and RAM numbers begin with 
1; dictionaries are numbered from 
zero. They are established using the 
words ROIW, FlAiVI and DiCTiONARY. Thus 
the directives 

8000 FFFF DiCTiONARY 

6000 63FF 2 RAIM 

4000 47FF 3 ROIVI 
assign the address space 8000 through 
FFFF to dictionary 0, 6000 through 
63FF to RAM segment 2 and 4000 to 
47FF to ROM segment 3 (we will 
assume throughout this article that 
numbers are expressed in hex- 
adecimal). More specifically, each 
memory segment has a segment con- 
trol block structure like the one for 
Continued on next page 



FORTH Dimensions 



9 



Volume IV, No. 4 



ROMable FORTH (continued from page 9) 



RAM 2 shown in Figure 2. The control 
block has three pointers referred to as 
VBOT, VLOC and VTOP (V for variable 
memory). VBOT and VTOP point to the 
lower and upper address limits of the 
RAM segment, and VLOC points to the 
next available address within the seg- 
ment. In the example above, execution 
of the sequence 6000 63FF 2 RAM sets 
the contents of VBOT and VLOC in RAM 
control block 2 to 6000, and the con- 
tents of VTOP to 63FF. As space in 
RAM segment 2 is used, the contents 
of VLOC will be incremented so that it 
always points to the next available 
byte. 

The dictionary and ROM control 
blocks have the same form as the RAM 
control blocks, except that the pointers 
are re/erred to as DBOT, etc., and CBOT, 
etc. (C stands for code). 
Definition Components 

Although for some processors the 
standard proFORTH™ implementa- 
tion uses direct threaded code for 
faster execution and byte savings, this 
Continued on next page 



RAM 
SEGMENT 
2 



VBOT ( 2 ) 



VLOC { 2 ) 



VT0P(2) 



ALLOTTED 
SPACE 



AVAILABLE 
SPACE 



FIGURE 2 - SEGMENT CONTROL BLOCK 
FOR RAM SEGMENT 2 



-=-=-=- 8080/Z80 FIG-FORTH for CP/M & CDOS systems -=-=-=- 

$50 saves you keying the FIG FORTH model and many published FIG FORTH screens onto diskette and 
debugging them. You receive TWO 8 inch diskettes (single sided, single density, soft sectored 
only) . The first disk is readable by Digital Research CP/H or Cromemco CDOS and contains 8080 
source I keyed from the published listings of the FORTH INTEREST GROUP (FIG) plus a translated, 
enhanced version in ZILOG Z80 mnemonics. This disk also contains executable F0RTH.COM files for Z80 
& 8080 processors. 

The 2nd disk contains FORTH readable screens including a extensive FULL-SCREEN EDITOR plus many 
items published in FORTH DIMENSIONS, including a FORTH TRACE utility, a model data base handler, an 
8080 ASSEMBLER and formatted memory dump and I/O port dump words. The disks are packaged in a ring 
binder along with a complete listing of the FULL-SCREEN EDITOR and the FIG-FORTH INSTALLATION MANUAL 
(the language model of FIG-FORTH, a complete glossary, memory map, installation instructions and the 
FIG line editor listing and instructions) . 

This entire work is placed in the public domain in the manner and spirit of the work upon which 
it is based. Copies may be distributed when proper notices are included. 

USA Foreign 
AIR 

+- + 

I I Above described package $50 $60 

+- + 
+- + 

I I Printed Z80 Assembly listing w/ xref $15 $18 

+-+ (Zilog mnemonics) 

+-+ 

i I Printed 8080 Assembly listing $15 $18 

+-+ 

TOTAL $ 

Price includes postage. No purchase orders without check. Arizona residents add sales tax. 
Make check or money order in OS Funds on US bank, payable to: 

Dennis Wilson c/o 
Aristotelian Logicians 
2631 East Pinchot Avenue 
Phoenix, AZ 85016 
(602) 956-7678 



FORTH Dimensions 



10 



Volume IV, No. 4 



discussion will consider only the more 
familiar indirect threaded code. Figure 
3(a) shows the proFORTH™ defini- 
tion structure for a system constant — 
that is, a constant which is not refer- 
enced in high-level target code. Except 
for the location of the LFA, it is essen- 
tially identical to the traditional struc- 
ture, in that the entire definition is 
compiled into the active dictionary 
(in this case, dictionary 0). The header 
begins at the link field address or LFA, 
and consists of the link and the defini- 
tion's name. The body immediately 
follows the header in memory and 
consists in this case of a pointer to a 
common support procedure named 
(CONST) located at the CFA or code 



field address, followed by the parame- 
ter field at the parameter field address 
of PFA. In the example the parameter 
field contains the constant's value, 
which the procedure (CONST) will put 
on the stack when it executes. In pro- 
FORTH™ the procedure (CONST) 
resides in target ROM so that it is also 
available for supporting target con- 
stants. 

Consider now the structure for a 
target constant shown in Figure 3(b). 
Notice that the definition body is now 
located in target ROM. In order to be 
able to access the body, a pointer is 
added to the header at the definition 
field address DFA, and the CFA of the 
definition is stored there. 

Continued on next page 



LFA 



NPA 



SUPPORT 
PROCEDURE 



DFA/CFA 
PFA 



(CONST) 



LINK 



VALUE 



ACTIVE 
DICTIONARY 



ACTIVE 
ROM SEGMENT 



FIGURE 3(a) - proFORTH DICTIONARY STRUCTURE FOR SYSTEM CONSTANT 



LINK 



NAME 



ACTIVE 
DICTIONARY 



BODY 



CFA I 

I 

PPA ! VALUE 



-j<- 



SUPPORT 
PROCEDURE 



(CONST) 



ACTIVE 
ROM SEGMENT 



FIGURE 3(b) - proFORTH DICTIONARY STRUCTURE FOR TARGET CONSTANT 



Look to 
TIMIN 
Engineering 

for FORTH 
software of 
professional quality. 

* ready to-run 
FORTH development 
systems 

^application programs 

in FORTH 

* Consulting services, 

including custom 
program development 

Our latest product: 

DUAL TASKING 
FORTH 

Now you can run your 
process control programs 
in background while still 
using your FORTH 
system in the normal way. 
Background and 
foreground tasks may 
each be written in high 
level FORTH. They can 
execute simultaneously 
and exchange data. The 
foreground task can 
control the background 
task. 

Available NOW: 

8" diskette $285 

Write for our FORTH 
information booklet 



Cp Qrimin Engineering Co. 

CKHp 6044 ErI anger St. 
no ^^'^ Diego, 
^ ^ CA 92122 

(714) 455-9008 



FORTH Dimensions 



11 



Volume IV, No. 4 



ROMable FORTH (continued from page 11) 



Another pair of examples is given in 
Figures 4(a) and 4(b) to show the struc- 
ture of definitions for system and 
target variables. Again, the system 
variable's definition is similar in form 
to the traditional one. The CFA points 
to the generic run-time procedure for 
variables called (VAR). Since the two- 
byte space for the variable is allocated 
in line, the procedure (VAR) is usually 
used only for system-based (dictionary) 
variables and is itself therefore, stored 
in system memory. 

Figure 4(b) shows how pro- 
FORTH™ separates the definition 
components for a target variable. The 
system component is the header — 
essentially, the name. A DFA pointer 
is added to it, and in it is stored the 
CFA or body address. The body is 
compiled in target ROM. However, in- 
stead of the generic procedure (VAR), 
the CFA of the ROM-based body is 
pointed to (CONST). In addition, the 
space allocated for the variable will be 
in the target RAM area. The address of 
the RAM space allotted is stored at the 
PFA in ROM, i.e., it is the value of the 
constant. When the variable's name is 
typed, the (CONST) support procedure 
executes, placing the variable's ad- 
dress on the stack in the usual way. 

Other definition structures follow 
the same principles as those discussed. 
For example, a code word is similar in 
structure to the constant, except that 
the CFA points to the PFA, and the 
assembly language code begins at the 
PFA. A colon definition's CFA points 
to the colon support procedure (COL- 
ON), and at the PFA is compiled the list 
of addresses of pointers to executable 
code which will be processed by the 
address interpreter at run time. All 
these structures can be compiled "in 
line" or in target ROM (connected by 
a DFA pointer). 

Extensions involve more complex 
structures than those illustrated, but to 
avoid obscuring the principles in a 
mass of details, we will concentrate on 
the simpler definition forms. 
Compilation Control 

The first step in compiling pro- 
FORTH™ code is to define the ROM, 



HEADER 



BODY 
& DATA 



LFA 



NFA 



SUPPORT 
PROCEDURE 



DFA/CFA 
PFA 



(VAR) 



LINK 



LENGTH 



NAME 



VALUE 



ACTIVE 
DICTIONARY 



ACTIVE 
DICTIONARY 
(USUALLY) 



FIGURE 4(a) - proFORTH DICTIONARY STRUCTURE FOR SYSTEM VARIABLE 



HEADER 



LFA 



NFA 



DFA 



LINK 



LENGTH 



NAME 



ACTIVE 
DICTIONARY 



BODY 



SUPPORT 
PROCEDURE 



CFA 
PFA 



(CONST) 



ADDRESS 



DATA - 1 



VALUE 



-|< — 

I 

"I I 



■|<- 



ACTIVE 
ROM SEGMENT 



ACTIVE 
RAM SEGMENT 



FIGURE 4(b) - proFORTH DICTIONARY STRUCTURE FOR TARGET VARIABLE 



FORTH Dimensions 



12 



Volume IV, No. 4 



RAM and dictionary segments as ex- 
plained above. We will assume that the 
basic proFORTH™ system has 
already been supplied or compiled. 
This sytem will have two main com- 
ponents: the system code, and the 
target code nucleus. The system code 
(located in dictionary in our exam- 
ple) includes the text interpreter, com- 
piler, disk interface, assembler and 
editor, as well as the names of all 
accessible system and target words. 
The target nucleus (which would be 
located in ROM segment 1 in our illus- 
tration) includes the bodies of all 
words which will be needed by the 
target system, as well as the address in- 
terpreter and support procedures like 
(CONST) and (COLON). Stacks and 
variables needed by the target are 
allocated in target RAM — say RAM 
segment 1. 

During compilation, there will at all 
times be an active dictionary, ROM 
segment and RAM segment. These are 
specified by the compiler directives 
DSEG, CSEG and VSEG respectively. For 
instance, the sequence 

DSEG 1 CSEG 1 VSEG 
activates ROM and RAM segments 1 
and dictionary 0. With these assign- 
ments, the compiler will separate 
definition components as in Figures 
3(b) and 4(b): 

DICTIONARY 0-headers 

ROM segment 1-bodies 

RAM segment 1 -variable space 
allocations 

Recall that there are no target 
memory segments corresponding to 
the zero ROM and RAM indices. In- 
stead, these refer to the active dic- 
tionary, and are used for compiling 
system code. Thus CSEG instructs the 
compiler to compile definition bodies 
into the active dictionary. In the same 
way VSEG causes the compiler to 
make RAM allocations in the active 
dictionary. The sequence 

ODSEG OCSEG VSEG 
then causes all definition components 
to be compiled into dictionary 0, and 



DSEG CSEG 

8 CONSTANT SYS. CON 

VSEG 

VARIABLE SYS.VAR 
: H. 

BASE e HEX SWAP 
BASE 1 ; 

1 CSEG 
1 VSEG 

9 CONSTANT TARG.CON 
VARIABLE . TARG . VAR 

: 2* DUP + ; 



compile headers & bodies in diet. ) 
define a system constant equal to 8 ) 
allocate variable space in diet. ) 
define a system variable ) 
define a system procedure ) 

compile bodies in ROM seg. 1 ) 
allocate variable space in RAM seg. 1 ) 
define a target constant equal to 9 ) 
define a target variable ) 
define a target procedure ) 



FIGURE 5 - EXAMPLES OF DIRECTIVES 
FOR COMPILATION CONTROL 



proFORTH™ functions exactly like 
an ordinary FORTH compiler. This is 
in fact the default mode of pro- 
FORTH™. When CSEG is active, the 
DFA pointer is not needed (since the 
CFA immediately follows the header) 
and is omitted as shown in Figures 3(a) 
and 4(a). One of the control bits in the 
length byte is used to indicate when 
the DFA pointer is omitted and the 
code is in line. 

As proFORTH™ code is compiled, 
there are effectively three compiler 
pointers replacing the usual dictionary 
pointer DP. From the earlier discus- 
sion, we see that these pointers are just 
the DLOC, CLOC and VLOC for the active 
segments. As space in a segment is 
used, the appropriate pointer is ad- 
vanced. At each step it is checked 
against the segment's limits (e.g., CBOT 
and CTOP) and the operator is warned 
if the pointer exceeds its assigned 
boundaries. 

Figure 5 shows the compiler direc- 
tives used to compile such typical 
definitions as system and target con- 
stants, system and target variables, and 
system and target colon definitions. As 
the examples illustrate, there is no 



change at all in the source code for the 
definitions themselves; all that is 
necessary is to insert the appropriate 
DSEG, CSEG and VSEG directives. 
Absolute Compilation 

There are some situations in which 
it is necessary to specify the exact loca- 
tion of a target code construct. For ex- 
ample, an interrupt system might use 
a jump table with the first jump located 
at JBASE. To support absolute compila- 
tion proFORTH™ uses one extra 
ROM segment control block. The ab- 
solute ROM segment limits are set to 
0000 and FFFF. The words ACSEG (for 
absolute code segment) and CSEG are 
used to manipulate the absolute seg- 
ment pointer (or CLOC). Their glossary 
definitions are: 

ACSEG ( addr b ) 

Begin compiling in the ab- 
solute CSEG at address addr. 
Save index b of currently 
active CSEG on stack. 

CSEG (b ) 

Select ROM segment b to be 
the recipient of future defini- 
tions and constant data. 
Returning now to our interrupt jump 
table example, consider the definitions 
Continued on next page 



FORTH Dimensions 



13 



Volume iV, No. 4 



ROMable FORTH (continued from page 13) 



in Figure 6. After assembling the code 
for the interrupt service routines INT.O 
through INT. 7, an ACSEG directive is us- 
ed to set the absolute compile pointer 
to JBASE. The active ROM segment in- 
dex is saved on the stack. Next the ac- 
tual jump table is assembled, starting 
at the address of JBASE. Finally, the 
CSEG directive restores the previously 
active ROM segment. 
HERE, ALLOT, etc. 

In traditional monolithic FORTH 
implementations, the word HERE pro- 
vides the next available dictionary ad- 
dress (usually the contents of a variable 
called DP]. In proFORTH™, the word 
HERE provides the next available ad- 
dress in the active ROM segment. For 
CSEG = 0, this defaults to the active 
dictionary segment. Similarly, the 
word ALLOT allocates space in the 
active ROM segment (or dictionary if 
CSEG = 0]. In addition to HERE, pro- 



FORTH™ provides the word VHERE to 
obtain the next available address in the 
active RAM segment. If VSEG = 0, 
VHERE provides the next available 
address in the active dictionary just as 
for HERE. Therefore, in its default mode 
proFORTH™ remains completely 

compatible with traditional FORTH, 
but broadens in a consistently logical 
way as segment control directives are 
issued. This enables the user to have 
complete control over where the com- 
piler stores each component of every 
definition. 
Conclusion 

It is not possible, in an article of this 
size, to even introduce all of the com- 
pilation control mechanisms available 
in proFORTH™. For example, we 
have not discussed the subjects of 
multiple dictionaries, extensions, 
selective purging of names, split sys- 
tem definitions, etc. Insofar as ROM- 



able code compilation is concerned, 
the principles discussed above apply to 
all of these areas even though imple- 
mentation details are often complex. 

proFORTH™ logically extends and 
broadens the meaning of the tradi- 
tional FORTH words such as HERE and 
ALLOT, so that the programmer is given 
complete control over compilation 
memory assignments. This is accom- 
plished without giving up the tra- 
ditional behavior of a monolithic 
dictionary system if the user wishes to 
program in that environment. B 

CODE INT.O ... RST, END-CODE 
CODE INT.! ... RET, END-CODE 



CODE INT. 7 



JBASE ACSEO 

' INT.O J«P, 



RET, END-CODE 
' IHT.l JMP, 



INT. 7 JMP, 
CSEG 



FIGUIIE 6 - EXAMPLE OP ABSOLUTE COMPILATION 



CHAIRMAN OF THE BOARDS 



INTRODUCING P-FORTH 

The p-FORTH Card is the Icev 
member in a family of control 
systems cards offered by the 
innovators at Peopleware 
Systems, Inc. P-FORTH has four 
major advantages: 

1. It is a versatile building block. 
The simple addition of a 
power supply and terminal 
makes the P-FORTH card both a 
low cost development system 
as well as a target system. 

2. An integrated high-level 
interactive language allows for 
fast software development. 

3. Application programs are 
stored automatically in non- 
volatile memory. 

4. The STD BUS interface allows 
the use of a variety of existing 
peripheral cards. 



PUTTING P-FORTH TO WORK: 

users interactively develop 
applications through a combi- 
nation of hardware and software. 
These applications are automatic- 
ally programmed into non- 
volatile memory (EEROM). When 
the applications are proven and 
functioning, a single switch 
transforms the system from the 
developmental mode into the 
target system. 



P€OPL€UJflR€ /V/T€M/ INC. 

5190 west 76th St. 
Mpls., MN 55435 USA 
(612)831-0827 • TWX 910-576-1735 



SOFTWARE 

• An interactive high-level 
language following the 
fig-FORTH model 

• A monitor for system checkout 

• "FORTH-type" screen editor for 
developing application 
programs 

• A "FORTH-type" assembler for 
writing assembly language 
routines 

• High-level interrupt-linkage 

• High-level communications 
protocol for down loading from 
a host system. 

HARDWARE 

• 6801 microprocessor 

• 6K EEROM 

• 8K FORTH firmware 

• 2K RAM 

• STD BUS interface 

• RS232 serial I/O 

• 16 TTL I/O lines 

• Programmable timer 



FORTH Dimensions 



14 



Volume IV, No. 4 



z-80® and 8086 FORTH 

PC/FORTH™ for IBM® Personal Computer available now! 



FORTH Application Development Systems include interpreter/compiler with virtual memory 
management, assembler, full screen editor, decompiler, demonstration programs, utilities, and 130 
page manual. Standard random access disk files used for screen storage. Extensions provided for 
access to all operating system functions. 



Z-80 FORTH for CP/M® 2.2 or MP/M $ 50.00 

8086 FORTH for CP/M-86 $100.00 

PC/FORTH for IBM Personal Computer $100.00 

Extension Packages for FORTH systems 

Software floating point $1 00.00 

Intel 8087 support (PC/FORTH, 8086 FORTH only) $100.00 

AMD 951 1 support (Z-80, 8086 FORTH only) $100.00 

Color graphics (PC/FORTH only) $100.00 

Data base management $200.00 



Nautilus Cross-compiler allows you to expand or modify the FORTH nucleus, recompile on a host 
computer for a different target computer, generate headerless code, and generate ROMable code with 
initialized variables. Supports forward referencing to any word or label. Produces load map, list of 
unresolved symbols, and executable image in RAM or disk file. No license fee for applications created 
with the Cross-compiler! Prerequisite: one of the application development systems above for your host 



computer. 

Hosts: z-80 (CP/M 2.2 or MP/M), 8086/88 {CP/M-86), IBM PC (PC/DOS or CP/M-86) 
Targets; Z-80, 8080, 8086/88, IBM PC, 6502, LSI-11 

Cross-compiler for one host and one target $300.00 

Each additional target $100.00 

FORTH Programming Aids by Curry Associates. Includes Translator, Callfinder, Decompiler, and 
Subroutine Decompiler. 40 page manual. Used with Cross-Compiler to generate minimum size target 
applications. 

Specify host system $1 50.00 

Z-80 Machine Tests Memory, disk, console, and printer tests with all source code in standard Zilog 
mnemonics $ 50.00 



All software distributed on eight inch single density soft sectored diskettes, except PC/FORTH on S'A inch soft sectored single 
sided double density diskettes. Micropolis and North Star disk formats available at $10.00 additional charge. 

Prices include shipping by UPS or first class mail within USA and Canada. Overseas orders add US$1 0.00 per package for air 
mail. California residents add appropriate sales tax. Purchase orders accepted at our discretion. No credit card orders. 



Laboratory Microsystems 

41 47 Beethoven Street 
Los Angeles, CA 90066 
(213) 306-7412 

Z-80 is a registered trademark of Zilog, Inc. 

CP/M is a registered trademark of Digital Research, Inc. 

IBM is a registered trademark of International Business Machines Corp. 



FORTH Dimensions 



15 



Volume IV, No. 4 



8080 f ig-FORTH in ROM 



Ted Croal 
Brant/ord General Hospital 
Ontario, Canada 



Editor's note: This article outlines the 
author's experiences in modifying the 
8080 /ig-FORTH assembly listing to run 
in ROM. The easiest way to make such 
a substantive change to a FORTH sys- 
tem, of course, is to use a cross-compil- 
er. This allows you to modify FORTH 
in FORTH. 

Like many others, I joined the FORTH 
Interest Group after reading about 
FORTH in the August 1980 issue of 
Byte. I had become weary of program- 
ming in hand assembled machine 
language and it seemed to me that 
FORTH would be a big improvement. 
I have not been disappointed. 

I was a bit dismayed, however, when 
I received my copy of 8080 fig-FORTH 
(1] to find that some modifications 
would be required to place the code in 
ROM. As my home-built S-100 system, 
which is a mixture of kits, assembled 
boards and wire-wrap, has no disk, 
and I was not willing to wait for the 
FORTH core to load from cassette 
every time I wanted to use it, I began 
at once to copy the listing in a form 
suitable for ROM. 

I had a 16K EPROM board assigned 
to the upper quarter of memory and I 
was in the process of rewriting my 
utilities to use my new IK memory 
mapped video board. I therefore de- 
cided to begin the ROM listing at the 
lowest address on the EPROM board, 
COOOH (START] instead of OOOOH. 
This meant transposing all the ad- 
dresses up 48K, that is OlOOH became 
ClOOH, lOOOH became DOOOH, and so 
on. This is a relatively simple but time 
consuming task (especially without an 
assembler). It soon became apparent 
that more was required than simply 
transposing the addresses. Certain 
values change during the execution of 
FORTH and must be in RAM. Before 



proceeding very far with the project I 
found it necessary to assign functions 
to the various parts of my RAM. I have 
16K of RAM in the first quarter of 
memory. I decided to use the first lOK 
for screens and the next 6K for RAM 
dictionary. The second quarter of the 
memory is not implemented in my 
system. The first kilobyte of the second 
half of the memory is occupied by my 
cassette interface. I then have 2K of 
RAM before my video display which 
begins at 8C00H. The rest of memory 
to COOOH is not implemented. 

I decided to use the 2K of RAM 
below the video board for the main 



FORTH stack, the terminal input buf- 
fer, return stack, user variables, a 
single IK screen buffer and assorted 
patches. The size function and labels 
for these areas are well explained in 
the fig-FORTH installation manual (2). 
As there is plenty of room for these, I 
used larger sections of memory than 
suggested in the manual. Listing 1 is a 
set of equates which I used to replace 
those supplied on page 2 of the fig- 
FORTH 8080 Assembly Source List- 
ing. If space is a problem, US and RTS 
could be restored to 64 and 160 respec- 
tively, and STACK could be reduced 
to 64. 



LISTING 1 

rievised Memory Allocstion; Eouales to eslsblish slacKsi lerndnal input 
buffer? user vansbles 3nd 3 sinsle IK buffer. 



04OO = KEBUF EQU 1024 

0OB4 = US EClU 130 

OOEO = RTS EQU 224- 

0060 = STACK EQU 96 

3400 = BTM EQU 3400H 

3460 = INITSO EQU BTM4STACK 

3540 = INITRO EQU INITSO+RTS 

35F4 = BUFl EQU INITRO + US 

35F6 = BUFF EQU BUFl+2 

3?rs = EH EQU BUFF+KBBUF+2 

SAOO = STARTP EQU EM+8 

OOOA = NUMS EQU 10 

1300 = LENGTD EQU 1300H 

0000 = STARTS EQU 

2800 = LENGTS EQU NUMS«KBBUF 

2300 = STARTD EQU STARTS+LENGTS 

4000 = ENDD EQU STARTBf LENGTD 

3540 - USBASE EQU INITRO 

3572 = RPP EQU USEASE+32H 

OOOB = BYTASK EQU 11 

280B = INITDP EQU STARTD+BYTASK 

8C00 = STARTU EQU 3CO0H 



dal3 bales per buffer 
user variable space 
return stacK and TIB 
stacK space 

starlina adr of 2K memory blocK 

top of stacK 

top of return stscK 

index of buffer 

first data bate of buffer 

upper limit of buffer 

start of RAM patch 

number of screens in sastem 

lenSth of RAM dictionary^ 6K 

start of first screen 

lensth of screen me«iora»10K 

start of RAM dictionara 

end of dictionara area 

user variable base address 

return stacK Pointer 

number of bates in "TASK" 

initial value of dictionara pointer 

start adr of video displaa 



LISTING 2 

Toli-nes tu LIS moved to RAM on cold start. See paSes 46 and 54 of Assembla 
Soui ce LisLinS. 



C0E6 
C0E7 
COtE 
COEC 
COEC 

core 
cor2 
cor3 

C0F4 
C0F6 

C0F3 
C0F7 
COFB 

COFC 
CO Fir 
COFF 



C5 

464F5 
C8 

CCCA 
E2CF 
31 
AO 

0028 
0000 

73 

DBOO 
C? 

7D 

B300 
C? 



PATCH 



FORTH 



INPATCH 



OUTPATCH 



ORG C0E6H 
DB 0C5H 
BB 'FORT' 
BB 'H'+80H 
DU UOCAB-13 
DU BOnOE 
BOUOC 
31H 

' ' fSOH 
STARTD 


used ba 
MOV MiE 
IN 
RET 

used ba 
MOV ArL 
OUT 
RET 



; FORTH 



DU 
DB 
DE 
BU 
DW 



P! 



start of RAM dictionara 
end of vocabulara list 



FORTH Dimensions 



16 



Volume IV, No. 4 



I used the first page of my FORTH 
ROM for machine code pecuHar to my 
system. The first 15 bytes are vectors. 
(JMP COLD JMP INSTATUS JMP KEYBOARD 
JMP VIDEODIS JMP PRINTOUT) After 
these referenced machine code rou- 
tines I have additional routines to 
move a block of memory (MOVIT), blank 
the front panel of my computer 
(BLANK), clear the video screen (CLSCR), 
and debug FORTH (DEBUG). DEBUG is 
a rewrite of the Debug Support on page 
5 of the Assembly Source Listing. I 
moved it so there would be room for 
initial values of additional user varia- 
bles. I added a new variable BREAK- 
POINT (857EH) to replace BIP in the 
listing so that TNEXT LXI H, BIP on page 
5 becomes DEBUG LXI H, BREAKPOINT. 
Listing 2 consists of 3 patches to be 
moved into RAM (above limit 89F8H) 
on a cold start. These are required by 
certain FORTH words whose diction- 
ary entries change during execution. 
(FORTH P@ PI) 

This brings us to the start of the code 
on page 3 of the fig-FORTH listing. In 
addition to transposing the addresses, 
the following changes are required. 
Substitute STARTD for TASK-7. Since 
the word FORTH will be in RAM after 
start-up, beginning at STARTP, and 
since there are 8 bytes in the word 
before the label "FORTH," substitute 



STARTP +16 for FORTH + 8 to in- 
itialize VOC-LINK. (In my system this is 
8A00H + lOH = 8A10H.) Listing 3 is 
the list of additional user variables I 
added to the system. 

The FORTH address interpreter is 
next. If you wish to use BREAKPOINT 
and DEBUG, substitute JMP DEBUG for 
the first three bytes of NEXT. I found 
this routine quite useful. Now that my 
fig-FORTH is operating, I suppose I 
could improve the speed of the system 
by removing this jump in an alternate 
EPROM chip, but I have not yet 
done so. 

From this point on, if you have an 
assembler, your task is relatively sim- 
ple, but if your reason for wanting 
your FORTH in ROM is your lack of 
resources, you may have to hand 
assemble the code as I did. You will 
soon get used to recognizing the ad- 
dresses which have to be transposed 
and adding the extra ASCII characters 
not shown in the listing if a word has 
more than 6 characters. You have to 
watch for ocurrences of RPP (return 
stack pointer) and substitute your 
RAM address for the address given in 
the listing. (RPP = USBASE + 32H) 
RPP is found in (LOOP) (DO) I RP@ RP! 
;S LEAVE >R R> and DOES>. Be sure 
to transpose UP (pointer to user 
variable base address) from 0126H by 
Continued on next page 



LISTING 3 

IrritiisI vslues of additional user variables added to system. These are 



loaded to 


USBASE + 32H = 


RPP on cold 


start. 


C12<!> 


4035 


UP DU 


INITRO 


! init return stack pointer 


CI23 


C03F 


DU 


STARTV+3C0H 


! init yP ( 1 ) 


C12A 


003C 


DU 


STARTV 


; init VPl <2) 


C12C 


008C 


IiU 


STARTU 


! init yp2 


C12E 


0100 


DU 


1 


! video displaa flaa set 


CI 30 


0000 


DU 





f printer flag clear 


C132 


0000 


DU 





! init BREAKPOINT 


C134 


0000 


DU 





; init XCUR ( 3 ) 


C136 


0000 


DU 





; init YCUR <3) 


C13S 


0028 


DU 


STARTD 


; init HI 


C13A 


0000 


DU 





i not implemented 


C13C 


0000 


DU 





> not implemented 


C13E 


0000 


DU 





i not implemented 


C140 


0000 


DU 





i not implemented 


C142 


00 


DB 





; not implemented 



(1) Initial value of yP ( video pointer ) is starting address of last 
line of video display. 

(2) Initial value of yPl ( auxiliary video pointer ) is starting address 
of video display. yF'2 is similar. 

(3 ) Used by Editor . 



* Spectrum Model 11 Forth * 

Stand alone Forth Svsiem for the TRS 
Model II 

• Superset of Forth 79 

• Full CRT Suppon 

• Interrupt driven KB, line printer and serial 
I/O drivers. 

• High level redirectable character I/O 

• Variable number block buffers employing 
least recently used scheme. 

• Automatic disk format recognition. 

• Extensions: 
Z-80 Assembler 
Strings 

Array Words 
Double Word Set 

• Utilities: 

Single Screen Editor 
Multi-Screen Editor 

Cross Reference Program with word search 
Disk Formaier (8 different formats) 

608 K capacity per drive 
Smart Terminal program 
Execuljon profile package 

Word tracing with stack display 

Single User System 250.00 

Manual 25.00 

Run time Module licenses available upon request. 

* The-Dala-Base * 

The-Data-Base is a menu driven, stand alone 
data filing and retrieval system for the TRS-80 
Model II. 

• User formated input screen to facilitate data 
entry. 

• Query/Update module contains full edit 
features, including update, insert, delete and 
replace modes. Repeating feature of last 
record/field entered and default data key. 

• Search feature allows comparisons of field 
constants, or field contents to another field 
within the same record. 

• Disk spanning provides a ma.\imum file 
capacity of over 2.2 megabytes on a four 
drive system. 

• Ten user-defined keys provided 

• Code file feature enables data to be entered 
in condensed and expanded modes, which 
then may be referenced globally by the 
system. Data may be retrieved in either con- 
densed or expanded format. 

• Merge/Copy feature provides for the ap- 
pending of one file to another. Only match- 
ing fields of the files are copied, allowing 
the user to add or delete fields in the new 
file. 

• Screen oriented Report Writer employes a 
virtual screen of 60 x 146 characters. Sorts 
may be performed on all fields in ascend- 
ing or descending order, or any combina- 
tion of same. Break field feature provided. 

Arithmetic module enables the display of 
intermediate results. 

• Simple password .security provided for User, 
Update and System levels. 

Single User System 300.00 

Manual 25.00 

•Demo Disk and Manual 50.00 

•Full Credit applied to purchase of 
The-Data-Base. 

Z-80 is a trademark of Zilog, Inc. 
TRS-80 is a trademark of Tandy Corp. 

SPECTRUM DATA SYSTEMS 

5667 Phelps Luck Drive 
Columbia, Maryland 21045 
(301) 992-5635 



FORTH Dimensions 



17 



Volume IV. No, 4 



SOSO f ig-FOPTH in ROM (continued from page 17) 



for 3 cold slsrt. 



r? 

2112C1 
114i83 
011000 
CDG7C0 
212iCl 
117235 
OllDOO 
Cri89C0 
21EiC0 
11003A 
OllAOO 
Cri87C0 
2A30C1 
DOBA EH 
DODB 217DDA 

olonoo 

Cri89C0 
CriA3C0 
OICDDO 
C345C1 
D6C0 



no92 

!)073 

D079 
B07C 
D07r 
D0A2 

doa: 
noAO 

DOAIl 
DOAE 

Bora 

DOB 4 
DOB 7 



BO BE 
BOCl 
DOC 4 
DOC 7 
BOCA 
DOCD 



DOCF 84 



DODO 
DOB 3 
D0D4 
D0D6 
BOD 3 
DOBA 
DODC 
DO BE 
DOEO 

doe: 



434F4C 
C4 

32D0 
11C6 
70B3 
DEDO 
33110 
EODO 
DB07 
C345C1 
( 1 ) ELANDCL 1= 
system. Write 



CLB LIILD 0RIGi l2H 

CPHL 

LXI li, 0r;IGI12H 
LXI D, U5EASE+6 
LXI d> lOH 
CALL MOVIT 
LXI H» UP 
LXI D. RPP 
LXI B, IDH 
CALL MOVIT 
LXI H. PATCH 
LXI Dt 3TARTP 
LXI B, lAH 
CALL MOVIT 
LIILD RPP+12H 
XCHG 

LXI H. TASK-7 
LXI B. BYTASK 
CALL MOVIT 
CALL BLAMDCL 
LXI B, CLBl 
JMP NEXT 

CLDl BU COLB 
BB 84H 
BB 'COL' 
BB 'B'ISOH 
DU UARM-7 

COLD BU EOCOL 
BU MTBUF 
BU INITKEY 
BU ABORT 

IfJITKEY DU *+2 
IN 7 

JMP NEXT 
3 front panel blanK snd 
suitable subroutine for 



> init 5tacK pointer 



source ) 


In i tial ize 


destination > 


low user 


length ) 


variables 


move ) 




source ) 


Initialize 


destination ) 


hiah user 


length ) 


variables 


move > 




source ) 


Move 


destination ) 


patch 


lenath ) 


to RAM 


move > 




destination ) 


Move TASK 




to start 


source > 


of RAM 


lenath ) 


dictionary 



move 

blanK front Panel t clear screen <1) 
load IP with pointer to CPA of COLB 
beain FORTH 

; COLD 



i initialize Keyboard 

> This is an alternate way 
r to add machine code 
j words to your system, 
video screen clear peculiar to my 
your use. 



LISTING 5 



com A FORTH word to turn off a cassette recorder ba sending to port 4, 
Substitute the appropriate code for your system. 



adding your offset (to C126H in my 
system] in SP! and USER. 

When you reach the higher level 
FORTH words at page 21 in the 
Assembly Source Listing, note that 
labels which refer to other FORTH 
words are addresses which must be 
transposed to refer to ROM. A081 in 
VOCABULARY is not a label however, (it 
is a dummy header) so leave it as is. 
Leave the 18 bytes for the word 
FORTH blank as the word is part of 
our patch. Change the link field of 
DEFINITIONS from FORTH-8 (OFEA) to 
STARTP (8A00) to refer to FORTH in 
RAM. Similarly change the address for 
FORTH in ABORT to STARTP + 8 
(8A08). 

The code for a warm start can be 
transposed to ROM in the usual man- 
ner, but I had to rewrite CLD and COLD 
to make the necessary changes for 
ROM. See Listing 4. Instead of using 
CMOVE, I used a short machine code 
subroutine in the first page of ROM. 
(MOVIT: MOVE A,B ORA C RZ MOV A,M 
STAX D INX D INX D OCX B JMP MOVIT) 

If you wish to have complete mes- 
sages instead of message numbers you 
will have to rewrite MESSAGE to print 
out text from ROM. For instance, if 
TABLE is the starting address of a table 
of addresses of the messages listed in 
order, then the sequence TWO STAR LIT 
TABLE PLUS AT COUNT TYPE SPACE could 
be inserted between DDUP and MESS2 
(replacing ZBRAN . . . SPACE). As this 
uses 4 bytes less you will have to ad- 
just your branch offsets. I have not 
tried this yet. 

The code for P@ and P! must be 
changed to use the patches in Listing 
2. Replace LXI H, $ + 5 MOV M,E IN in 
P@ with LXI H, STARTP + 14H CALL 
STARTP +12H. In P! replace LXI H, $+7 
with LXI H, STARTP + 18H and replace 
MOV A,L OUT with CALL STARTP +16H. 

This brings us to the CP/M Disk In- 
terface on page 55 of the listing. I re- 
placed this with a cassette interface. If 
you have copied out the listing this far, 
you should have little difficulty in con- 
structing special FORTH words for 
your system. For example, Listing 5 is 
the word I added to turn my cassette 
recorder off. This is done in my system 
by sending to port 4. Remember to 



D2BC 84 BB 34H 

D2BD 434F46 BB 'COF' 

D2E0 C6 BB 'F'+80H 

B2E1 CAB2 BU 0B2CAH 
C2E3 E5B2 COFF BU $+2 

D2E5 AF XRA A 

B2Eo D304 OUT 4 

D2E2 C345C1 JHP NEXT 

insert the name field address of the 
preceding word at the link field of each 
word. Some of the disk interface 
words can be modified for use with a 
cassette system. Listing 6 shows some 
useful words. By this time the name 
fields and link fields should be obvious 
to you so I have listed only the labels, 
code fields and parameter fields. The 
label indicates the address of the code 
field of the corresponding FORTH 
word. EMPTY-BUFFERS can be used as 
is (transposed), but if you change its 
relative location be sure to change the 
reference in WARM and COLD. 

The CP/M console and printer inter- 
face on page 63 of the listing can be 



; COFF 

; NFA prevoius word 



used with a few changes. First, lOS is 
changed to LXI H, START DAD D PCHL 
(21 00 CO 19 E9). PRINT must be in 
RAM so change it to a user variable, 
PF (Print Flag) at RPP + OAH (857C). I 
modified PCR on page 64 to output on- 
ly a CR instead of a CR and LF as I have 
the machine code for the video display 
written accordingly and the printer set 
accordingly. (PCR: PUSH B MVI C.ODH 
MOV L,C CALL CPOUT POP B JMP NEXT). 

The rest of the listing is straightfor- 
ward. For BYE, I use a jump to my utili- 
ty directory instead of a jump to 0. If 
you add additional words after TASK, 
change the link field of TASK to the 
name field address of the last word 



FORTH Dimensions 



18 



Volume IV, No. 4 



.iu.jiricd Diil; IiiLerface for use with cassette interface. Each t>lock 

iuf-r esponds to s full screeni but since hlocK is used to indicate terminal 

oferstion; blocK 1 is for screen 0. ( that iSf blocKt = screen* + 1 ) 

DLKi ( n i Pisces the blocK number currently occupainS the buffer onto the 

5lscK. If the uiost sianificant bit is set it means blocK has been updated. ) 

elockn: docol tirst at semis 

UPDATE < Modified to use BLK* ) 

updat: docol blockn lit soooh orr first store semis 

BUF ( n ; A constant which leaves address of first data bate of buffer on 

the atacK . ) 

buf: docon buff 

HI ( n ; User variable containing address of end of screen ares.) 

IIIGIi: DOUSE 44H 

R/U ( adr n f i sdr refers to buffer > n is blocK nu»ber» f is 

f l53>0=uri te> l=re3d. DisK primitive rewritten for simulation of disK by 
ftemory. See fia-FORTH installation mamual. Error *6 is "SCREEN RANGE ERROR".) 
RSLU: DOCOL TOR ONE SUDB BBUF STAR DUP HIGH AT GREAT LIT 6 QERR FROMR ZBRAN ♦ 
CUAP BBUF CMOVE SEMIS 

DUFFER < n sdr ; Assigns buffer to block n. If contents of bufer are 

ftsrked as UFdsted> it is written to memory. Address left on stacK is first 

data bate of buffer . ) 

EUFFE: docol elockn ZLESS ZBRAN lOH BUF BLOCKN LIT 7FFH ANDD ZERO RSLU FIRST 

STORE BUF SEMIS 

BLOCK ( adr j n is a blocK numbers adr is the address of the first data 

byte of the buffer. If the blocK is not in the buffer already? it is moved 
there. If the blocK in the buffer is different and is updated it is first 
iioved to screen meniory. ) 

block: docol DUP elockn SUBB DUP PLUS ZBRAN lOH DUP BUFFE SWAP ONE BSLU BRAN ♦ 
DROP BUF SEMIS 

FLUSH ( Urite buffer to memory if updated.) 

flush; doccl zero euffe drop semis 

LOAD ( n ; Besin interpretation of screen n.) 

load: docol BLK at tor inn at tor zero inn store GNEP BLK STORE INTER FROMR 

im STORE FROMR BLK STORE SEMIS 

< Labels not explained above will be found in the Assembly Source Listing. ) 



added and the link field of the first 
word added to the name field address 
of .CPU (DA58) and hnk the added 
words appropriately. 

The revised listing is now ready for 
burning into EPROMs. Without an 
assembler, entering the program into 
memory is a tedious task but effort 
spent in checking at this stage will pay 
off later in debugging time. It can take 
quite a while to find that you have 
reversed the digits in a byte some- 
where or have switched the bytes in a 
label. Check your 10 routines in the 
first page of ROM carefully, be sure 
they work as intended and be sure 
your code for COLD is written and 
entered correctly. 

If you read "8080 FIG-FORTH" on 
your screen on a jump from START 
(COOOH), you are indeed fortunate. 
Your debugging procedure will de- 



pend on your front panel and utilities. 
If you can step your program to JMP 
NEXT in CLD (DOCA) and change the 
value of BREAKPOINT (at 857E] through 
the front panel you can run the pro- 
gram under control until it crashes and 
thereby locate the problem. 

After I removed the bug from the 
system, I was ready to start writing 
programs in FORTH. I found Starting 
FORTH by Leo Brodie (3) very helpful. 
As I began to learn, I soon reahzed that 
I required an Editor. Fortunately, I 
was in contact with John Cassady (who 
implemented 8080 fig-FORTH) who 
supplied me with a compact Editor 
ideal for ROMing. I entered the 
screens in RAM using my "typewri- 
ter" utility and LOADed them. For a 
while I saved the screens on tape for 
use while I was placing the Editor in 
ROM. After loading the Editor, I 



printed out the RAM dictionary, iden- 
tified the words by their ASCII 
characters and the DOCOL and SEMIS 
addresses and transposed the code to 
ROM, with the link field changes 
described above. 

Implementing my fig-FORTH sys- 
tem has been a long laborious process 
but I have acquired a good understan- 
ding of the language as I have pro- 
gressed and I am looking forward to 
increasing my programming skills. □ 



References: 

1. Fig-FORTH for 8080 Assembly Source 
Listing. Release 1.1 September 1979. FORTH 
Interest Group. 

2. Fig-FORTH Installation Manual. Release 1 
by W. F. Ragsdale. November 1980. FORTH 
Interest Group. 

3. Starting FORTH by Leo Brodie. Prentice- 
Hall, Inc. 



FORTH Dimensions 



19 



Volume IV, No. 4 



□EVELOPMEIMT TOOLS 



Develop FORTH code for any target 
8080/Z80 system on your current 8080/Z80 
or Cromemco CDOS based system 




8080/Z80 METAFORTH 
CROSS-COMPILER 

• Produces code that may be downloaded to any Z80 or 
8080 processor 

• Includes 8080 and Z80 assemblers 

• Can produce code without headers and link words for up to 
30% space savings 

• Can produce ROMable code 

• 79 Standard FORTH 

• Price $450 



No downloading - No trial PROM burning. 
This port-addressed RAM on your S-100 host 
is the ROM of your target system 




WORD/ BYTE 

WIDE ROM SIMULATOR 

• Simulates 16K bytes of memory (8K bytes for 2708 and 2758) 

• Simulates 2708, 2758, 2516, 2716, 2532, 2732, 2564 
and 2764 PROMS 

• The simulated memory may be either byte or 16-bit 
word organized 

• No S-100 memory is needed to hold ROM data 

• Driver program verifies simulated PROM contents 

• Price $495 each 



CONSULTING SERVICES 

inner Access provides you witfi Custom Software Design. We have supplied many clients with 
both Systems and Application Software tailored to their specific needs. Contact us for your 
special programming requirements. 



FORTH WORKSHOPS 

ONE-WEEK WORKSHOPS - ENROLLMENT LIMITED TO 8 STUDENTS 



FORTH 

Fundamentals 

• Program Design 

• Program Documentation 

• FORTH Architecture 

• FORTH Arithmetic 

• Control Structures 

• Input/Output 

• The Vocabulary Mechanism 

• Meta-Defining Words 

OCT. 4-8 NOV. 8-12 
JAN. 3-7 FEB. 7-11 

$395 Incl. Text 



Advanced FORTH 
Applications 

• FORTH Tools 

• Engineering Applications 

• Floating Point 

• Communications 

• Sorting & Searching 

• Project Accounting System 

• Process Control 

• Simulations 

NOV. 15-19 
FEB. 14-18 

$495 Incl. Text 



Advanced FORTH 
Systems 

• FORTH Internals 

• Assemblers and Editors 

• Other Compilers 

• Cross-Compilation Theory 

• Romability, Multitasking, 

Timesharing 

• File Systems/ 

Database Systems 

OCT. 11-15 
JAN. 10-14 

$495 Incl. Text 



R 



Instructors: LEO BRODIE, GARY FEIERBACH and PAUL THOMAS 
(For further Information, please send for our complete FORTH Workshop Catalog.) 

Inner Access Corporation 



VISA 



P.O. BOX 888 • BELMONT CALIFORNIA 94002 • (415)591-8295 



FORTH Dimensions 



20 



Volume IV, No. 4 



Q T F 

Quick Text Formatter — Part II 



Leo Brodie 
Chatsworth, California 



In the last issue of FORTH Dimen- 
sions, I introduced my Quick Text For- 
matter, a very simple but powerful text 
processor written in FORTH. That 
issue included the code for the format- 
ter section of the application. This ar- 
ticle continues with the QTF Editor, 

The QTF Editor allows you to edit 
FORTH blocks which will serve as 
source blocks for the formatter. The 
Editor is designed with text manipula- 
tion in mind, and offers cursor- 
control, wrap-around, insert, delete, 
replace and string-move functions. 
I/O Option 

I've included two versions of display 
formatting for you to choose from. In 
the first approach, called Continuous 
Refresh, if you insert text in the mid- 
dle of a line, the remainder of the line 
visibly shifts across the screen. At a 
certain point, the word or words at the 
end of the line drop down to the begin- 
ning of the next line, and the re- 
mainder of the block is adjusted as 
needed. This approach is fine if you're 
a single user on a system and you have 
fast video I/O. 

You may need the alternate ap- 
proach, which I call the Burst I/O, if 
you're working on a multi-tasked 
system with other users or with a slow 
baud rate. In the Burst I/O approach, 
as soon as you begin to enter text, the 
remainder of the screen past the cur- 
sor is blanked, so that you can type in- 
to the space without the remainder of 
the text having to be continually 
refreshed. A copy of the remaining 
text appears near the bottom of the 
screen, so you can see what will follow 
the point of insertion. 

When you press return, the remain- 
ing text reappears, following the in- 
serted text. 

Another reason to use the second ap- 



proach is if your system does not in- 
clude the word <CMOVE and you're 
not up for writing it in code. I'm afraid 
you really need a fast version of 
<CMOVE for satisfactory results. 

Similarly, there are two kinds of text 
deletion. For Burst I/O, you position 
the cursor at the beginning of the 
string to be deleted, then type "X"s 
over the full length of the string. (This 
is in "Command Mode," so the "X"s 
are commands, not characters.) When 
you press the return key, the X'ed-out 
text is deleted. Again, this avoids con- 
tinualUy refreshing the remainder of 
the screen. 

(A nice side-effect is that if you over- 
shoot the number of "X"s, you can 
backspace and the former characters 
will reappear, since nothing is actual- 
ly clobbered in memory until you 
press "return."] 

If you're using the Continuous 
Refresh version of insertion, then you 
can also delete text by being in Enter 
Mode, positioning the cursor at the 
end of the text to be deleted, then 
pressing the backspace key until the 
string has been gobbled up by the text 
to the right of the cursor. You still have 
the "X"-ing command available 
though, if you prefer it. 
Another Unusual Approach 

One of the problems of using 
someone else's software is that you 
have to put up with that person's 
quirky preferences, at least until you 
understand the application well 
enough to change it. In the case of the 
QTF Editor's cursor commands, I've 
implemented a quirky preference of 
my own, which I'll explain right now 
in case you don't like it. 

Most Editors of this type employ 
control codes to indicate cursor posi- 
tioning commands. You have to hold 
down the control key while you press 
various other keys to move the cursor 
up, down, left, or right, in order to let 
the Editor distinguish between com- 
mands and characters. 

My approach, though, was to use 
"modes." When you first enter the 



Editor, you are in "Command Mode." 
Now various keys represent com- 
mands, including both cursor move- 
ment commands as well as commands 
to enter other modes. 

As for my choice of keys to control 
the cursor with, I prefer to use the 
position of the keys on the keyboard 
rather than an association of actual let- 
ters. Instead of "U" for "up," etc., I 
picked four keys that were adjacent 
and nearest the first two fingers of my 
right hand: 

up 
i 

left j k right 
m 
down 

Even with my IBM Personal Com- 
puter's special set of cursor keys at the 
right side of the board, I prefer the 
mode approach because it takes less 
hand movement. But, as I say, that 
may just be my own quirk. You can 
easily change the keys by modifying 
the key function table in screens 32 
and 33, which I'll discuss later. 

For rapid horizontal cursor moves 
(four characters at a time], just 
capitalize } and K. 
Prerequisites 

An early warning: to make this thing 
work, your terminal must be able to 
perform certain functions. In this 
application they are named: 

X y XY moves the cursor to 

coordinates x and y, 
where 0,0 is the up- 
per left. 

CLR- > LN clears the line to the 
right of the cursor. 

CLR— > SCR clears the screen to 
the right of and be- 
low the cursor. 

PAGE clears the entire 

screen; homes the 
cursor. 

You'll have to write these routines if 
they don't already exist in your 
system. Redefine your routines to bear 
the names in Block 18, or simply patch 
their addresses into the execution 

Continued on next page 



FORTH Dimensions 



21 



Volume IV, No. 4 



QTF (continued from page 21) 



variables. (I used execution variables 
just to avoid confusing things). 
Using the Commands 

To enter the Editor, type the word 

n write 

where "n" is the number of the block 
you want to edit. If there's anything in 
the block already, it will be typed out. 
Since our formatter application re- 
quires a continuous stream of text 
within each block (no embedded car- 
riage returns), the Editor decides 
where to end each line on the display 
— actually, the first occurrence of a 
blank after the 55th character on each 
line. (Remember, the Editor formats 
the contents of the screen differently 
than the formatter will display your 
text.) 

The cursor will appear just after the 
last character displayed, or, if the 
block is empty, at the home position. 
The number of characters in the block 
(the current "length") will appear in 
the lower right hand corner. 

You can use the cursor movement 
keys to position the cursor to any 
character that actually exists in the 
block. You can move it backwards or 
up, but not forward or down (beyond 
the "length"), until you enter more 
text. If you move the cursor all the way 
back to the beginning of a line, it will 
then skip up to the end of the next line 
above — not to the 79th column, but 
to the blank space that follows the last 
word on the line. And you can only 
move the cursor forward as far as the 
last character in each line (the space), 
then it will drop to the beginning of 
the next line. 

While in command mode you can 
also get into Enter Mode, Replace 
Mode, or Delete Mode by pressing 
"e," "r," and "d" respectively. 

Table 1 shows all the commands that 
are available as keystrokes in Com- 
mand Mode. 
Enter Mode 

Press the "e" key while in Com- 
mand Mode to begin entering text. 
The words "ENTERING MODE" will 
appear in the upper right-hand corner. 
In this mode, all the alphanumeric 
keys on your keyboard will be con- 



sidered characters you want to enter, 
not commands. 

I've already discussed the Editor's 
two approaches to the I/O problem in 
Enter mode. But with either approach 
the Editor's wrap-around strategy ap- 
plies. This means you don't press 
"return" at the end of each line; you 
just keep typing and the editor will 
worry about line breaks. Press return 
only when you want to get back to 
Command Mode. 

If you make a mistake while in Enter 
Mode, press the backspace key. You 
can even backspace past the beginning 
of a displayed line and up to the end 
of the previous line, just like with cur- 
sor movements. 

In either the Burst or Continuous 
versions of Enter Mode, you can 
backspace all the way back to the 
beginning of the block, thereby 
deleting all such text. 

As you enter text, make sure the 
length in the lower right hand corner 
doesn't exceed 1024, or you'll lose the 
end of your text. I recommend that 
you only fill blocks about 2/3 full, to 
leave room for later insertions. 
Deiete IVIode 

I've also covered Delete Mode in 
the discussion on the I/O alternatives 
earlier. For either version, just "X" 
over the string to be deleted. Press- 
ing the return key joins the parts 
of the text on either side of the de- 
letion. 

While in Delete Mode, the only valid 
keystrokes are "x," upper case "X" for 
fast deletions, backspace and return. 
Any other key will emit a beep. 

A quick way to clear everything 



from the cursor to the end of the 
screen is the "cntrl-c" key. Since this 
is a dangerous command, it requires 
holding down the "control" key and 
the "c" simultaneously. You can clear 
the entire contents of a screen with the 
combination "a" "cntrl-c" (the "a" key 
homes the cursor to the beginning of 
the screen). 
Repiace IVIode 

Use this mode when you want to 
correct text without moving any text 
forward (as in insert) or backward (as 
in delete). For example, to change the 
word "most" to "many," simply move 
the cursor to the "o," then enter 
Replace Mode by typing "r." Then 
type "any." Be sure to hit "return" 
when you're done replacing! 
Tiie "Take" Command 

The "t" (for Take) key takes the 
string you just "x"ed out, and inserts 
it wherever the cursor is now. In com- 
bination with "x," you can use this 
command to move any length of text 
from one place to another, even from 
one block to another. Use it to swap 
phrases, sentences, paragraphs, etc. 

You can also use "t" if you need 
multiple copies of the same string, 
without having to retype it each time. 
Just "x" out the string, then press "t" 
to take it back, then press "t" again to 
take a second copy, and again as many 
times as you need. This technique 
works because "x" saves the text that 
you delete in a buffer. The "t" com- 
mand copies whatever is in that buf- 
fer into your block. 

If you need to transfer a LOT of text 
from the end of one block to another 
block, or even copy an entire block, 



Table 2 Editor-related FORTH commands 

w re-enters the Editor, using the block most recently displayed 
n re-enters the Editor, using the next block 
b re-enters the Editor, using one block back 

lb enters the Editor, displaying your document's loadblock. When you press 
return to exit, lb returns to the block you were originally editing. You must 
first identify your loadblock with the phrase n loadblock I where "n" is the 
number of your loadblock. 



FORTH Dimensions 



22 



Volume IV, No. 4 



you can use "t" in combination with 
"cntrl-c." "Cntrl-c" saves what it 
deletes in the same buffer that "x" 
does. For example, to transfer the se- 
cond half of one screen to another 
screen, first position the cursor at the 
start of the text to be transferred, press 
"cntrl-c,", move to the other screen, 
then press "t." 
Extensions 

As we mentioned earlier, the word 
write gets you into the Editor. There 
are also a few variations on that word 
for your convenience. These are sum- 
marized in Table 2. 

Another optional word, which I in- 
clude, paren'ed out, in block 35, is call- 
ed catch. Catch is only needed when 
the Burst I/O version of Enter Mode 
is used. Because in this version you 
can't see how much text lies below the 
cursor, catch is your protection in case 
you insert too much and lose some text 
off the "bottom" of the block. If this 
happens, you can "catch" everything 
that existed to the right of the cursor 
at the time you began "Enter Mode" 
in another block. For instance, 

55 catch 

copies all such text to block 55, and 
enters the Editor. 
Theory of Operation 

One of the reasons I'm publishing 
this application is the need for good, 
exemplary FORTH programs for 
teaching and learning. I've done my 
best to make this code elegant and 
readable, and I think it reflects a good 
design since, to be honest, it's been 
through quite a few design iterations 
as I've expanded its capabilities over 
the past six months. 

With this in mind, I have an obliga- 
tion to explain some of the design. Or 
to put it more accurately (since every 
decent programmer loves to brag 
about his code), I now have an excuse 
to explain some of the design. I'll see 
how much I can explain before this ar- 
ticle gets too long. 
Two Dimensional Execution Table 

At the heart of the key interpreter 
lies an execution table defined in 
blocks 32 and 33, called FUNCTIONS. 
When a key is struck, its value is com- 



pared against the ASCII values that ap- 
pear in column one of the table. If a 
match is found, then the appropriate 
function from one of the other col- 
umns is executed. For example, sup- 
pose an "e" is pressed. If the Editor 
is in Enter Mode, ICHAR will be ex- 
ecuted. ICHAR inserts a character, in 
this case the "e." In Replace Mode, 
RCHAR will be executed, to replace a 
character. In Delete Mode, the "e" is 
invalid, so a beep will sound. (I re- 
named the usual BELL function as 
for clarity in this table.] In Com- 
mand Mode, however, an "e" will ex- 
ecute ENTER (block 29], which sets the 
Editor to Enter Mode. 

If no match is found, then the ap- 
propriate function from the last row 
of the table is executed. For example, 
a "q" will be inserted or replaced 
while in Enter or Replace Modes, but 
will cause a beep while in Delete or 
Command Modes. 

The word FUNCTION in block 34 is do- 
ing the work. First it finds the address 
in the FUNCTIONS table where the key 
match occurred, then it offsets this ad- 
dress by the contents of the variable 
IVIODE (which contains a 2, 4, 6, or 8]. 
It then fetches the address of the ap- 
propriate function from the table and 
EXECUTES it. The modes are defined as 
CONSTANTS in Block 19, so the phrase 

DELETING MODE ! 
for example, sets MODE to 6. 

An alternative approach might have 
been to design key-interpreters within 
the key-interpreter. For instance, 
pressing "e" in Command Mode 
might have executed an inner loop 
which also executed KEY and inserted 
each character. This inner loop, 
however, must also detect backspaces 
and carriage returns. Similarly, 
Replace Mode and Delete Modes 
would have needed their own inner 
key-interpreters as well. I think the 
result would hae been much more 
cumbersome. 

From what I understand, this im- 
plementation of a two-dimensional 
vectored execution table runs along 
the lines of classical State Machine 
theory. Whatever, I found this ap- 



proach remarkably easy to work with, 
due to the direct correspondence be- 
tween what I was trying to do and the 
notation I used to describe it. 

By the way, the design is such that 
you can add a new key and row of 
commands without having to change 
any code elsewhere. This works 
because the address of the end of the 
table is given by the constant 
FUNCTIONS >, defined as HERE im- 
mediately after the table is compiled. 

The functions associated with 
Delete Mode, Replace Mode, and 
Enter Mode are implemented in 
Blocks 27, 28 and 29 respectively. 
Data Structure 

The design of this Editor is more 
complicated than that of ordinarly 
FORTH screen editors because of the 
uneven line lengths. For instance, 
moving the cursor up one line isn't just 
a matter of moving back exactly 64 
characters; the exact number of char- 
acters between two vertically adjacent 
characters depends on the number of 
characters displayed in the higher line. 

As the user moves the cursor within 
the horizontal and vertical frame, the 
Editor must always keep track of its 
analogous position within the 1024- 
byte array (the conventional R#). 

To correlate the two points of view, 
I implemented a table called EDGES. 
For each line of text on the display, 
there are a pair of values in the table. 
One represents the x-cursor position 
of the last character displayed on the 
line (actually the space); the other in- 
dicates the value of R# for that same 
character. 

For example, if there are 57 charac- 
ters displayed on the 0th line, the final 
character is the 57th. The first two en- 
tries of the table, then, are both 57. If 
there are 60 characters on the next 
line, then the final x-cursor position 
for that line is 60, and the value of R# 
for that final character is 118 (the first 
character on that line is R# 58, so 58 
+ 60 = 118. 

Say there are only three lines, and 
the final line contains 10 characters. 
Thus the first table entry for that line 
is 10, the other entry is 129. All entries 
Continued on next page 



23 



Volume IV, No. 4 



OTP (continued from page 23) 



for subsequent lines will contain 
zeros. 

We can picture the table like this: 
57 57 
60 118 
10 129 




etc. 

(As a debugging tool, the word SNAP 
in block 36 displays the values of the 
EDGES table, as well as several of the 
other major variables. If you want to 
use it, load block 36 from line 10 of 
block 34, and leave the word SNAP in 
the definition of (WRITE) on line 13. 
Now you can execute the word 
W/SNAP to turn SNAP on, or WO/SNAP 
to turn it off.) 

The phrase EDGE @ fetches the x- 
cursor value for the current line from 
the table. For example, if we're cur- 
rently in the middle line, EDGE @ will 
return 60. The phrase EDGE 2+ @ 
fetches the associated R# value for the 
current line, e.g., 118. 

The variables XCUR and YCUR con- 
tain the current coordinates of the cur- 
sor, relative to the text display area 
(YCUR is for line zero of the text; this 
is actually line 2 on your terminal). 

Here is the algorithm for moving the 
cursor from the middle of one line 
down to the next line: 
1 YCUR +! 

(moves the cursor to the next line 

down) 
EDGE @ XCUR @ - 

(computes the distance between 

where the cursor is horizontally on 

the new line, and the last character 

of that line, as a positive number.) 
EDGE 2+ ® SWAP - 

(subtracts this value from the 

R#-value of the last character on this 

line.) 
R# ! 

(having computed the value of R# 
associated with the character the 
cursor has just landed on, stores that 
value into R#.) 

The algorithm is complicated by the 



fact that the space below the current 
position might not be a valid character 
position. For example, if the cursor 
sits at the 60th character in the mid- 
dle line, and the user tries to move it 
down, the cursor should slide down 
and left to the last character position 
of the next line, the 10th position. 

Furthermore, it turns out that this 
algorithm is the same for both moving 
down and for moving up, the only 
thing that changes being the value (1 
or -1) that is plus-stored into YCUR. 
That being the case, the complete 
algorithm is factored as the word 
UP/DOWN in block 22. Enough said. 

I haven't begun to discuss the com- 
mands that format and display the 
text, and keep the display looking right 
during the editing process. A par- 
ticularly interesting routine is the one 
which minimizes the amount of 
screen typing necessary after a short 
insert or delete, by only typing as 
many lines as are necessary to take up 
the slack. But this article is already too 
long, so I guess Fll just bag it. I hope 
I've given you enough hints to pursue 
it further. 

If You Type It In . . . 

As with the Formatter, the Editor is 
written according to 79-Standard, ala 
Starting FORTH. If you're running a 
FIG system, then preload the follow- 
ing definitions: 
: VARIABLE VARIABLE ; 
: CREATE VARIABLE -2 ALLOT ; 
: WORD WORD HERE ; 
: >IN IN ; 
: ?DUP -DUP ; 
: NOT 0= ; 

Make sure you set the value of the 
constant RETURN to 13 or 0, depending 
upon which number KEY returns when 
you press carriage return. This con- 
stant is in block 18. 

A related problem will be your 
definition of ', ("tick-comma") which 
is used to create the FUNCTION table. 
The purpose of this word is simply to 
find the address of the next word in 
the input stream, and comma into the 



dictionary whatever address (cfa or 
pfa) is appropriate for your system's 
version of EXECUTE. Three versions — 
FIG, 79-Standard, and Starting 
FORTH are provided in Block 18. 

Another precaution: the word ASCII 
is normally used inside colon defini- 
tions to compile the next word in the 
definition as a literal. I'm using it in 
the creation of the FUNCTIONS table, 
and this is not inside a colon defini- 
tion. In this case, ASCII should simply 
return the value of the character on the 
stack. Make sure that you have a 
definition of ASCII that does this, or 
else just comma in the actual numbers 
(no fun, I know). 

And still another precaution: some 
FORTH systems store a null into the 
first cell of empty blocks. If you insert 
text into such a screen with this 
Editor, those nulls will ride along, 
glued to the last character you type. 
This may cause funny problems at for- 
mat time. Probably the best solution is 
to add a routine to the Editor which 
scans the block for control characters 
and changes any to blanks. 

Finally, I've used the words T and F 
to indicate true and false flags, respec- 
tively. This is purely in the interest of 
style, since it often helps to know 
whether Is and Os are to be treated as 
numbers or as flags. Their definitions 
are, of course: 

CONSTANT F 

1 CONSTANT T 

Notice: Permission to use this apphca- 
tion is granted for individual, personal 
use in a non-commercial manner. AH 
commercial rights reserved. Vendors 
interested in offering QTF as an ap- 
plication package should contact the 
author. □ 

© Copyright 1982 Leo Brodie 



Leo Brodie is an author, lecturer and 
consultant on FORTH programming. 
He is currently working on his second 
book, and is employed as a consultant 
to IBM in San Jose. 



FORTH Dimensions 



24 



Volume IV, No. 4 



EEcJ ± tor- eXoss^r-v' 



Cgmmand_Mode 

In this mode, the following keys perform these functions: 



X 

j 
k 
m 
J 
K 
a 
z 

ctrl-c 

n 

b 

e 



X 

X 
t 



return 



moves cursor up 
moves cursor left 
moves cursor right 
moves cursor down 

moves cursor left four characters 

moves cursor right four characters 

sets cursor to first character in block 

sets cursor to last character in block 

Cuts-off everything to the right of the cursor. 

displays Next block 

displays one block Back 

enters "Enter Mode", allowing you to enter or insert 
text. 

enters "Replace Mode", allowing you to overwrite 
text. 

deletes a character, and enters "Delete Mode", 
deletes four characters at a time. 

Takes the text that was most recently deleted with 
"x" or "cntrl-c", and inserts it at the current 
cursor position. 

returns to FORTH 



Screen I 18 crc ver < 83i4 

( Quick Text Fonatter By Leo Brodte 

1 I Systei dependent words) 

2 VARIABLE 'PA6E VARIABLE 'CLR->LN 

3 VARIABLE 'CLR->SCR VARIABLE 'XY 

4 : PA6E 'PA6E } EXECUTE ; 

5 : CLR->LN 'CLR->LN } EXECUTE ; 

6 : CLR->SCR 'CLR->SCR 3 EXECUTE ; 

7 : XY 'XY S EXECUTE ; 



09/25/82 ) 



Screen I 19 crc ver 

( VARIABLES li CONSTANTS 



31127 



9 : BUTTON 20 XY 

10 : .NODE 65 1 XY 

11 13 CONSTANT RETURN 

12 : CCOHPILE] ' 

13 ( : [COMPILE] 
111.' ' 

n . . , , , 

15 --) 



CLR->LN ; 
CLR->LN i 

( value KEY returns when (return) pressed) 
, ; I 79 Standard) 
CPA , ; ( fig VERSION) 

( Starting FORTH) 



78 CONSTANT HIDE 



55 CONSTANT NEAR-RIGHT 



07/28/82 ) 



2 CONSTANT ENTERIN6 4 CONSTANT REPLACIN6 
6 CONSTANT DELETIN6 8 CONSTANT COHNAND 

VARIABLE NODE ( coiiand, enter, replace or delete) 
4 2t CONSTANT iNODES ( nuiber of lodes, in bytes) 

32767 CONSTANT HOOT ( iipossible I of shifts to accoiodate) 

VARIABLE XCUR VARIABLE YCUR 

VARIABLE TALLY ( count of chars entered) 

19 CONSTANT tLINES 

CREATE ED6ES 4 ILINES 1* t ALLOT ( table of right edges: ) 
( xcursor-pos, rl, for each line. ) 

--> 



Copyright 1982 Leo Brodie 



10/13/82 



FORTH Dimensions 



25 



Volume IV, No. 4 



Screen I 20 

( VARIABLES i 

1 CREATE xHOLDING 

2 VARIABLE IKEY ( 

3 VARIABLE ?ESC ( 



crc ver = 3403 
CONSTANTS 

1026 ALLOT ( delete buffer; cell 

latest key entered) 

true for escape froi outer loop) 



Screen I 21 



crc ver = 34110 



07/28/82 
■■ count) 



4 CREATE OLDPOS 6 ALLOT ( ycurs xcurs rt) 



5 VARIABLE REALIBN 

6 VARIABLE DONE ( 

7 VARIABLE SHIFTS 

8 VARIABLE LEN6TH 

9 VARIABLE RI6HT i 

10 --> 
11 

12 
13 
14 
15 



( true = need to realign in replace lode) 
true = stop REWRITE) 
( I to adjust table ris in SET-REST) 
{ t of Nriteable chars.) 

current right largin) 



) I Precursors 07/28/82 1 

BUFF ( ~ adr: beg. of buffer) SCR 9 BLOCK ; 
CHARACTER ( - adr: current pos. in buffer) BUFF Rt } + ; 
AT XCUR 9 YCUR 9 2+ XY ; 
.CHAR AT CHARACTER C9 EHIT ; 
ROOH ( -- n) 1024 Rl 9 - j 
lOLDPOS { save current cursor position) 
KCUR 9 YCUR 9 OLDPOS 2! R» 9 OLDPOS 4 + ! ; 
: 90LDP0S ( restore previous cursor position) 
OLDPOS OUP 29 YCUR I ICUR ! 4 f 9 Rt I ; 
i COHHAND! .NODE .' Coiiand lode' COHHAND HODE ! AT ; 
: RET ( drop to beg. of next line; let RCHAR knoN) 

AT CLR->LN 1 YCUR t! KCUR I T REALIGN ! ; 
-> 



Screen I 22 



crc ver = 20164 



Screen t 23 



crc ver = 45597 




1 
2 
3 
4 
5 
6 
7 

a 

9 
10 
11 
12 
13 
14 
15 



( Cursor loveients 07/30/82 ) 

: ED6E ( -- adr) YCUR 9 21 21 ED6ES + ; 
( These Nords confori to preset edge table:) 
: FORMARD Rt 9 LENGTH 9 < IF 1 XCUR *\ 

XCUR 9 ED6E 9 > IF RET THEN 1 Rt +1 THEN ; 
: BACKWARD Rt 9 IF XCUR 9 0« IF -1 YCUR 

ED6E 9 XCUR ! ELSE -1 XCUR tl THEN 

-1 Rt +! THEN ; 
: UP/DOHN ( n) YCUR +! EDGE 29 ( rt x) XCUR 9 - DUP 

0< IF DROP EDGE 9 XCUR ! ELSE - THEN Rt I ; 
: UP YCl« 9 > IF -1 UP/DONN THEN ; 
: DOMN EDGE 4 + 9 IF 1 UP/DONN THEN ; 



-> 



( Maintain table of right edges 07/30/82 ) 

SET ( set both edge larkers for this line in table; and 

flag REWRITE to stop if shifts have been accoiodated) 

Rt 9 1- XCUR 9 1- DUP EDGE 9 - SHIFTS +! 

SHIFTS 9 0= DONE I EDGE 2! ; 
FIT ( go to next line, if neceisary) 

RIGHT 9 XCUR 9 < IF SET RET THEN ; 
ECHO ( c) ( display c; break line on blank or end of line) 

DUP AT EHIT 1 XCUR +! 1 Rt +! BL = XCUR 9 WIDE = OR 

IF FIT THEN ; 

ADJUST t adjust rt's in edge-table after x's or t's) 
YCUR 9 tLINES OVER DO I YCUR ! EDGE 9 IF EDGE 2* 9 
TALLY 9 - 1024 HIN EDGE 2+ I THEN LOOP YCUR ! ; 

-> 



Screen t 24 



crc ver « 20218 



Screen t 25 



crc ver 16193 




1 
2 
3 
4 
5 
6 
7 
8 
9 

10 
11 
12 
13 
14 
13 



( Maintain table of right edges 07/30/82 ) 

NO-nORE ( zero-out edge table froi next line on doiin) 
YCUR 9 tLINES OVER U DO I YCUR ! 
EDGE 21 LOOP YCUR ! ; 

PATCH ( fix remainder of edge table, after actual REMRITE) 
DONE 9 IF ADJUST ELSE Rt 9 XCUR 9 EDGE 2! 
NO-HORE CLR->SCR THEN ; 

CHANGE In) ( pos. or neg. change in t characters) 
DUP TALLY i DUP SHIFTS ! NEGATE 

LENGTH 9 + 1024 2DUP NIN LENGTH I / HOOT t SHIFTS +! ; 
( if length exceeds 1024, shifts are "ioot") 

-> 



( REWRITE 07/30/82 
REWRITE ( display reiainder of text) 
! OLDPOS F DONE I LENGTH 9 DUP IF Rt 9 - ?DUP IF 
DO NEAR-RIGHT XCUR 9 - DUP 0> IF 

LENGTH 9 Rt 9 - HIN AT CHARACTER OVER TYPE 
DUP XCUR +1 DUP Rt +! 

ELSE DROP CHARACTER C9 ECHO 1 THEN DONE 9 
IF LEAVE THEN +LOOP THEN 
ELSE DROP .CHAR THEN PATCH ; 



Copyright 1982 Leo Brodie 



10/13/82 



FORTH Dimensions 



26 



Volume IV, No. 4 



Screen I 26 crc ver = 20392 

( Various Hodes Setup 08/02/82 ) 

1 : REATTACH ( source-buHer-adr) 

2 DUP 3 IF .HODE AT DUP 2^ CHARACTER ROT i ROOH HIN CHQVE 

3 REMRITE iOLDPOS AT ELSE DROP THEN COHHAND! ; 

4 : HONE Rt I tCUR ! YCUR ! ; 

5 : — 7 EMIT ( bell) .CHAR ; 

6 : ESCAPE ( letvc outer loop) T ?ESC ! ; 

7 --> 
8 

9 
10 
11 
12 
13 
14 



Screen I 27 crc ver = 11426 

( Delete Mode 07/30/82 ) 

: XCHAR ( delete one char.) 

Rl i LEN6TH 3 < IF AT ASCII I EMIT FORWARD THEN ; 
: MN6 ( begin delete lode) IOLDPOS Ri 3 TALLY ! XCHAR 

DELETINB HODE I .MODE ." DELETE NODE' ; 
: CLOSE-UP CHARACTER DUP TALLY 3 - 

DUP xHOLDINB 2* TALLY 3 DUP xHOLDINS I CNOVE 
I save deleted) ROOH CNOVE ( close gap) ; 
: BLANK->END ROON 30LDP0S CHARACTER * TALLY 3 BL FILL ; 
: xSTOP ( exit delete lode) 

Rt 3 TALLY 3 - CHAN6E CLOSE-UP BLANK->END AT SPACE 

REWRITE 30LDP0S CONNAND! ; 
: x< I delete lode backspace) TALLY 3 Rt 3 - IF 

BACKWARD .CHAR AT ELSE T DONE ! xSTOP BACKWARD THEN ; 

-> 



Screen • 28 crc ver « 28142 

( Replace Node 08/02/82 ) 

1 : REPLACE ( go into replace lode) REPLACIN6 NODE ! TALLY ! 

2 F REALI6H ! .NODE ." REPLACE" ; 

3 I RCHAR I replace one char.) 

4 Rt 3 LENGTH 3 < IF tKEY 3 DUP CHARACTER C! ECHO 

5 REALI6N 8 IF REWRITE 30LDP0S AT F REALI6N ! THEN THEN ; 

6 : r< ( replace-iode backspace) BACKWARD .CHAR ; 

7 : rSTOP ( exit replace) 

8 SHIFTS ! REWRITE 30LDP0S CONNAND! ; 
9 

10 ~> ( paren out this arroN to load Burst I/O version) 
11 

12 37 LOAD ( Burst I/O version) 

13 

14 

15 



Screen t 29 crc ver * 2278 

( Enter lode CONTINUOUS I/O VERSION 09/30/82 ) 

: ENTER ( go into Enter ) 

Rt 3 1024 < IF ENTERING HODE ! .NODE ." ENTERINB NODE" 

TALLY ! THEN j 
1 PATIENT RISHT 3 1+ 77 HIN RI6HT ! EDBE 3 75 = 

XCUR 3 NEAR-RIBHT 5 + « OR IF NEAR-RI6HT RIBHT I THEN ; 
: ICHAR ( insert one char.) Rt 3 1024 < IF CHARACTER DUP 1+ 

LEN8TH 3 1023 NIN Rt 3 - <CNOVE tKEY 3 DUP CHARACTER CI 

-1 CHAN6E ECHO Rt 3 LENGTH 3 - IF PATIENT REWRITE 30LDPOS 

THEN THEN ; 

: eSTOP NEAR-RIGHT RIGHT I CHANGE REWRITE 30LDP0S 
CONNAND! ; 

: e< ( backspace in Enter lode) RIGHT 3 1- NEAR-RIGHT NAX 
RIGHT I Rt 8 IF BACKWARD AT SPACE CHARACTER DUP U SWAP 
LENGTH 3 Rt 8 - CHOVE 1 CHANGE REWRITE 30LDP0S THEN ; 



Screen t 30 



crc ver » 29713 



Screen t 31 



crc ver = 29467 




1 
2 
3 
4 
5 
6 
7 

a 

9 
10 
11 
12 
13 
14 
IS 



( Nisc. functions 07/30/82 
TAKE ( spread radr. of block; restore xHOLDING) 

CHARACTER ( source) DUP xHOLDING 3 t ( dest) 

ROON xHOLDING 3 - I count) DUP 0> IF <CNOVE I spread) 
ELSE 2DR0P DROP THEN 

xHOLDINS 8 NEGATE CHANGE xHOLDING REATTACH ; 
-HONE ( love to last non-blank char.) 

LENGTH 3 DUP Rt I tLINES DO I YCUR I DUP ED6E 2+ 3 " IF 

LEAVE THEN LOOP DROP EDGE 3 im ! ; 
CUTOFF ( erase to end) 

CHARACTER xHOLDING 2^ LENGTH 3 Rt 8 - DUP xHOLDING I 

CNOVE CHARACTER ROON BL FILL CLR->SCR 

CONNAND! Rt 3 DUP LENGTH ! XCUR 8 EDGE 21 NO-NORE ; 

-> 



( Nultiple-operation keys: 
4 CONSTANT HULTIPLE 



10/13/82 



BACKS 
FORWARDS 
XCHARS 
NEXTSCR 
BACKSCR 
-> 



HULTIPLE DO BACKWARD LOOP ; 

HULTIPLE 00 FORWARD LOOP 
HULTIPLE DO XCHAR LOOP ) 
1 SCR +1 ESCAPE i 
-1 SCR *! ESCAPE : 



Copyright 1982 Leo Brodie 



10/13/82 



^ORTH Dimensions 



27 



Volume IV, No. 4 



Screen t 32 


crc ver 


= 49176 


( Function latrix 




1 CREATE FUNCTIONS 




2 


( E-iode 


R-iode 


3 ASCII e , 


', I CHAR 


RCHAR 


4 ASCII X , 


', ICHAR 


', RCHAR 


5 ASCII i , 


', ICHAR 


', RCHAR 


6 ASCII 1 , 


ICHAR 


', RCHAR 


7 ASCII J , 


', ICHAR 


', RCHAR 


e ASCII k , 


', ICHAR 


', RCHAR 


9 ASCII r , 


', ICHAR 


RCHAR 


10 3 ( ''c) , 


» 


1 


11 8 ( del) , 




r< 


12 ASCII a , 


', ICHAR 


', RCHAR 


13 ASCII z , 


', ICHAR 


', RCHAR 


14 --> 






IS 






Screen 1 34 


crc ver 


■= 60149 



-■ode 



, XCHAR 



( QTF Editor 

1 mODES 2t CONSTANT 6R0UP ( bytes in FUNCTIONS for each coiund) 

2 FUNCTIONS) 6R0UP - CONSTANT 'NOHATCH 





Screen 1 33 


crc ver 


= 8347 






08/09/82 ) 


( Function latrix cont'd 






08/09/82 ) 


Coiiand) 


ASCII J , 


, ICHAR 


, RCHAR 




', BACKS 


', ENTER 


ASCII K , 


, ICHAR 


, RCHAR 


» 


', FORHARDS 


', MN6 


ASCII n , 


, ICHAR 


, RCHAR 


r ___ 
1 


', NEXTSCR 


', UP 


ASCII b , 


, ICHAR 


, RCHAR 


' 

1 


', BACKSCR 


DOMN 


ASCII t , 


, ICHAR 


, RCHAR 




TAKE 


', BACKWARD 


ASCII I , 


, ICHAR 


, RCHAR 


', XCHARS 


X-INS 


', FORHARD 


RETURN , 


eSTOP 


, rSTOP 


', xSTOP 


', ESCAPE 


', REPLACE 


( other) , ' 


, ICHAR 


, RCHAR 


' 


> 


CUTOFF 


HERE CONSTANT FUNCTIONS) i 


end of FUNCTION table) 




', BACKHARD 












', HOHE 


--> 










', -HOHE 














Screen t 3S 


crc ver 


» 61269 






08/09/82 ) 


( QTF Editor 








08/09/82 ) 


each coiund) 


: itrite ( icr) 


( enter editor) 







3 ! 

4 

5 
6 

7 : 
8 

9 : 

10 I 

11 : 
12 
13 
14 --) 
15 



FUNCTION ( key) 'NOHATCH SNAP 
FUNCTIONS) FUNCTIONS DO DUP I S > IF 2DR0P I LEAVE 
( replace noutch adr n/ latch) THEN 6R0UP >LOOP DROP 
( adr in table -- ) NODE i * » EXECUTE ; 
INIT HOOT SHIFTS I BUFF 1024 -TRAILIN6 LEN6TH ! DROP 
HOHE NEAR-RI6HT RI6HT I COHHAND! ; 
STAGE ( scr) PA6E DUP . SCR I INIT ; 
36 LOAD ( snapshot debugger) 
(WRITE) ( scr) STAGE REWRITE NO-HORE F ?ESC ! 
BEGIN 75 19 XY LENGTH S 4 .R AT KEY DUP IKEY I 
FUNCTION ( SNAP ) ?ESC i UNTIL UPDATE BUTTON CR ; 



BEGIN DUP (WRITE) SCR ) - ( n or b) WHILE 

SCR 9 REPEAT ( .' Saving on disk ' FLUSH (optional ) i 

i N ( reenter editor) SCR } write ; 

: n SCR i U Nrite ; 

: b SCR a 1- write ; 

: index INDEX ; 

VARIABLE loadblock 

: lb SCR i loadblock i (WRITE) write ; 

17 LOAD ( teriinal-specific coiiands ~ write your own) 



( : catch ( scr } DUP SCR ! INIT 
SWAP BLOCK HOLDING 8 CHOVE w | ) 



CUTUFF HOLDING 2* 



Screen t 36 



crc ver « 53315 



( snapshot debugger 
: SEE 3 SPACES DUP NFA ID. . " 
VARIABLE 'SNAP 

: (SNAP) 6 XY XCUR SEE YCUR SEE 
RIGHT SEE TALLY SEE 3 SPACES 
YCUR a ILINES DO I YCUR ! 



EDGE a 
( use ['] 
: W/SNAP 
: WO/SNAP 



9 
10 
11 
12 
13 

14 WO/SNAP 
15 



a 5 .R ; 

LENGTH SEE 
Rl ■ Rl ? 

71 I 2+ 

4 .R EDGE 2+ a 5 .R LOOP YCUR I 
instead of ' in Starting FORTH systeis: 
' (SNAP) 'SNAP I ; 
' TASK 'SNAP I ! 



include CFA in fig-FORTH systees: 
SNAP 'SNAP a ( CFA) EXECUTE : 



Screen I 37 crc ver = 31510 

10/02/82 ) ( Enter lode BURST I/O VERSION 07/30/82 ) 

CREATE HOLDING 1026 ALLOT ( insert buffer; cell < count) 
: ENTER ( go into Enter lode) 

Rl a 1024 < IF ENTERING RODE ! CLR->SCR BOTTOH .' Insert:)" 
CHARACTER DUP ROOfl 60 HIN TYPE HOLDING 2* ROOH CHOVE 
XY ROOH HOLDING ! .NODE AT TALLY ! THEN ; 

AT ; : ICHAR ( insert one char.) Rl a 1024 < IF IKEY a DUP 

) CHARACTER C! ECHO -1 CHANGE THEN ; 

: eSTOP ( end Enter lode) 

HOOT SHIFTS ! HOLDING REATTACH ; 
: e< ( backspace in Enter lode) 

Rl a IF BACKWARD AT SPACE 1 CtMNGE THEN ; 
30 LOAD ( continue loading reiainder of application) 



Copyright 19G2 Leo Brodie 



10/13/82 



FORTH Dimensions 



28 



Volume IV, No. 4 



Now Available On 

HEWLETT PACKARD DESKTOP COMPUTERS 




HARDWARE 



Unbeatable Combination 



~1 

SOFTWARE 



The HP 9826A and 9836A are two of Hewlett-Packard's 
newest and most powerful desktop computers. Each Is based 
on the Motorola MC68000 microprocessor. Both machines 
have full graphics capability and up to 2 full megabytes of 
user read/write memory. Both operate on 5Vt" flexible disc 
drives (the 9836A has two) which feature 264K bytes of 
mass storage. While the 9826A has an integral 7" (178mm) 
CRT which makes it useful for computer-aided testing (CAT) 
and control, the 9836A has a full 12.2" (310mm) CRT 
which makes it ideal for computer-aided engineering (CAE) 
applications. Each model features the following: 

• Seven levels of prioritized interrupt 

• Memory-mapped I/O 

• Built-in HP-IB interface 

• Standard ASCII keyboard with numeric keypad and 
international language options 

• Ten (20 with shift) user-definable soft keys with soft labels 

• Rotary-control knob for cursor control, interrupt generation 
and analog simulations 

• System clock and three timers 

• Powerfail recovery option for protection against power lapses 

• Seven additional interface cards 

— DMA controller (up to 2.4 mb/sec) 

— 8/16 bit bi-directional parallel 

— Additional HPIB interface 

— Serial RS232/449 

— BCD 

— Color video(RGB) 3 planes 512 x 512 8 color 



HP 9826/36 Multi-FORTH 
HP PRODUCT # 97030JA 

Multi-FORTH was developed in 1979 by Creative Solutions, 
Inc. The standard product has been substantially modified to 
take full advantage of the 9826/36 hardware features. 

Multi-FORTH features 

• 79 standard programming environment 

• Multitasking 

• Full screen editor 

• In-line structured assembler 

• I/O and graphics extensions 

• Loadable H.P. floating point (IEEE format) 

• Extensive user manuals and documentation 
Optional Features: 

• Meta compiler 

• Multi user 

• Data access methods library 

This product is part of HP PLUS — a program for locating user software. It has been 
developed by an independent software supplier to run on HP computer systems. It is 
eligible for HP PLUS as determined by references from satisfied end users. Support 
services are available only through the software supplier. Hewlett-Packard's 
responsibilities are descritjed in the Responsibilities Statement below. 

Responsibilities Statement 

HP PLUS software was developed by an independent software supplier for operation 
on HP computer systems. The supplier is solely responsible for Its software and 
support services. HP is not the manufacturer or developer of sucf) software or support. 
HP disclaims any and all liabilities for and makes no warranties, expressed or implied, 
with respect to this software. Distritiution of this product or information concerning 
this product does not constitute endorsement of the product, the supplier, or support 
services. The cwtomer is responsible for selection of the software it purchases. 



For more information, please write 

Marvel Ross, Hewlett Packard Company 

3404 East Harmony Road, Ft. Collins, CO. 80525 



FORTH Dimensions 



29 



Volume IV, No. 4 





SShFORTH for the IBM Personal Computer is fig-FORTH and much 
more. Our FORTH system is designed for the serious PC programmer and 
offers powerful editing and debugging capabilities and a complete interface 
to BIOS and DOS for the keyboard, screen, disks, communication ports, etc. 
In addition, SSI*FORTH can accept text from other text editors (like our text 
editor P-Edit), and perform screen to text converions. All screens used are 
DOS format compatible. 

Editor 

• Full Screen FORTH Editor with Search 

• Machine Speed Search Over Multiple Screens 

Additions to FIG FORTH 

• Complete Interface to BIOS and DOS for Keyboard, Screen. Disks, 

Communication Ports, etc. 

• The words PEEK, POKE, PEEKW. POKEW for easy transfer of functions 

defined in the BASIC language. 

- Ability to use the speaker and timer to produce tones. 

Debugging Capabilities 

Debugging Aid 

- HEX Dump 
Decompiler 

Text Conversion 

- Screen to Text Document Conversion 
^ Load from Text Format 

Requirements 

^ IBM Personal Computer 
PC/ DOS 



SATEt-LITE SOFTWARE I MTE HIM ATIOMAL 
aaS WEST CENTER OREM, UTAH 84057 



(aai) Ba4-.a554 (aaoj 3si-59ob telex asa-iaa 






FORTH Dimensions 3O Volume IV, No. 4 



FORTH Standards Corner 



Representation for Logical True 



Robert L. Smith 



One of the proposals for the next 
FORTH Standard is that the system 
default value for "true" is all 16 bits 
set to "1." The system default for 
"false" would be unchanged, namely 
the value returned on the stack has the 
16 bits set to "0." FORTH-79 returns 
a default "true" value with only the 
low order bit set to "1" and the re- 
maining bits set to "0." Since logical 
operators in FORTH usually mani- 
pulate 16 bit quantities rather than 1 
bit quantities, it makes somewhat bet- 
ter sense for the default truth values 



to return either all bits cleared or all 
bits set. It should be noted that in 
many cases the implementation of all 
ones as a default true is somewhat 
more efficient than 15 "0"s and a "1." 
Frequently there is also some improve- 
ment in the high level FORTH code. 

For a trivial example, consider the 
function discussed in a previous issue, 
S->D. This is used to "sign-extend" 
a single precision signed number to a 
double precision format. Using the 
suggested logical default, the function 
may be written: 

: S->D DUP 0< ; 
Using the older default for true re- 
quires an additional term, NEGATE, to 
be placed after the 0<. 

An often used trick in FORTH is for 
a function to either return a zero value 



or a value, such as an address, based 
on a logical result. If the new default 
is used, the logical AND operator may 
be applied to the specified value to 
give the desired result. To apply the 
same idea to the older default, we must 
either perform an arithmetic multipli- 
cation, or first negate the logical result 
before applying the AND function. 

Probably the main argument against 
the proposal is that it is not "compati- 
ble" with some currently written code. 
It will be interesting to see the results 
of the voting on this issue. □ 

Editor's Note; 

Just be/ore this issue went to press, the 
Standards Team voted to adopt this 
proposal. 



proFORTH COMPILER 

8080/8085, Z80 VERSIONS 

• SUPPORTS DEVELOPMENT FOR DEDICATED APPLICATIONS 

• INTERACTIVELY TEST HEADERLESS CODE 

• IN-PLACE COMPILATION OF ROMABLE TARGET CODE 

• MULTIPLE, PURGABLE DICTIONARIES 

• FORTH-79 SUPERSET 

• AVAILABLE NOW FOR TEKTRONIX DEVELOPMENT SYSTEMS - $2250 



MICROPROCESSOR-BASED PRODUCT DESIGN 

• SOFTWARE ENGINEERING 

• DESIGN STUDIES — COST ANALYSIS 

• ELECTRONICS AND PRINTED CIRCUIT DESIGN 

• PROTOTYPE FABRICATION AND TEST 

• REAL-TIME ASSEMBLY LANGUAGE/proFORTH 

• MULTITASKING 

• DIVERSIFIED STAFF 



MICROSYSTEMS, INC. 

(213) 577-1471 

2500 E. FOOTHILL BLVD., SUITE 102, PASADENA, CALIFORNIA 91107 



FORTH Dimensions 



31 



FORTH -32 

IBM PC 



NOW you can program using the entire IBM® PC 
memory, The FORTH-32 SEGMENT SENSING language 
makes segment boundaries transparent to the pro- 
grammer. 

The FORTH-32™ DEVELOPMENT SYSTEM features inter- 
mixed 16 and 32 bit addressing modes with fig -FORTH 
compatibility, DOS interface, full screen editor, assembler, 
disassembler, graphics and debug. The powerful QUEST 
CASE statement with single, multiple and range labeling 
is also included. 



In addition to FORTH-32™ you will receive the QUEST 
PACKAGE BUILDER UTILITY which transforms user de- 
veloped programs into marketable software packages 
by building on disk a condensed executable image with 
only those FORTH words needed. 

User oriented self-teaching documentation! All software is 
fully backed and updated for one year. 

$100 FORTH-32 (SPECIFY PC-DOS, OR CP/M-86™) 
$50 FLOATING POINT LIBRARY (SOFTWARE OR 8087) 

FORTH-32 AND QUEST ARE TRADEMARKS OF QUEST RESEARCH INC. 
IBM IS A REGISTERED TRADEMARK OF IBM CORPORATION. 
CP/M-86 IS A TRADEMARK OF DIGITAL RESEARCH INC. 



TM 



1 



COD. 



QUEST RESEARCH, INC. 

P.O. BOX 2553 
HUNTSVILLE, AL 35804 



Call Toll Free: 
(800) 558-8088 
In Alabama Call 
(205) 533-9405 



FORTH Dimensions 



32 



Volume IV, No. 4 



Techniques Tutorial 

Choosing Names 



Henry Laxen 



This time I would like to rant and rave 
about one of the most difficult aspects 
of programming in FORTH, that of 
choosing good names for your defini- 
tions. Besides a rational design, this is 
the single most important part of pro- 
gramming in FORTH. 

That's a strong statement, but it is 
absolutely true. The names you give 
your definitions can make the dif- 
ference between understandable, 
modifiable code, and complete gar- 
bage. I will illustrate this by some 
examples and some guidelines of how 
to choose good names. 

First a word on programming tools. 
There has been a great deal of time 
and effort devoted to the topic of pro- 
gramming tools in recent years, and 
FORTH is well equipped with some of 
the most sophisticated tools in the soft- 
ware world. You can find code for 
countless debuggers, decompilers, 
cross reference utilities, glossary 
generators, and online helpers of one 
form or another. These are all wonder- 
ful, but rarely is the most important 
FORTH development tool mentioned, 
yet it is widely available and costs only 
about $20.00. I am of course talking 
about a good dictionary and thesaurus. 
When it comes to choosing a good 
name for a FORTH word, these can be 
invaluable, and should be part of every 
FORTH programmer's tool kit. 

Now then, rule number one in 
choosing good names is: Name the 
what, not the how. Let's take a look 
at some examples of what this means. 
Every FORTH programmer, myself 
included, is guilty of violating this 
rule, and the primary violation is in 
the area of returning booleans or 
truth values. Every piece of code I 
have ever seen has phrases such as the 
following: 

IF DO-SOMETHING 1 ELSE DROP THEN 

This is horrible! Furthermore there is 



a proposal in the 83 Standard to 
change the value of a true boolean 
from 1 to -1. If that happens, many 
many programs will need to be heavi- 
ly modified. What we have in essence 
done in the above example is violate 
our rule on naming clarit\". We have 
named the words TRUE and F.\LSE 
with the how. namely 1 and B. instead 
of the what, namely TRUE and FALS. 
A much better solution, and it is ab- 
solutely trivial to implement, is to 
revise the code as follows: 

1 CONSTANT TRUE 

CONSTANT FALSE 

IF DO-SOMETHING TRUE ELSE 
DROP FALSE THEN 
This is great! First it is absolutely clear 
that we are returning a boolean value, 
and secondly if this was done through- 
out, changing the value of TRUE would 
be little more than redefining the con- 
stant TRUE. The result is clearer, more 
understandable, and more modifiable 
code than before. [Editor's note: Or 
consider using T and F as abbrevia- 
tions. See the code for my QTF article 
on page 21 of this issue.] 

Let's look at another example of 
naming the what and not the how. It 
is often desirable to define some words 
which will set a variable to 1 or 0, TRUE 
or FALSE. Which of the following 
pieces of code have you written, and 
which do you now think is better: 

: 0! ( addr ~ ) SWAP ! ; 
: 1! (addr — ) 1 SWAP I ; 

: SET ( addr — ) TRUE SWAP ! ; 
: RESET ( addr — ) FALSE SWAP ! ; 

Suppose we had a variable called 
ENABLE. Which of the following 
phrases do you think makes more 

S6n,S6! 

ENABLE 0! or ENABLE RESET 

If you ask yourself how am I going to 
disable something, you will come up 
with the 0! name. If you ask yourself 
what am I going to do , the answer will 
be to RESET the ENABLE flag, and you 
will come up with the much superior 
name of RESET instead of 01. 

Always remember to ask yourself 
what you are doing, not how you are 



doing it. If you answer the what ques- 
tion, you will most likely come up with 
a good name. 

Now let's proceed to rule number 
two in how to choose a good name. 
Rule 2 is: 1'' possible. st:ck :: Er.z2.sr. 
Given the choice berivee- gcod :r- 
diiiar>\ pro&aic E'gii^r, =rLC s^-pez 
sophisticaiec coznpsr^sT^se.. ^Trrrs 



Besides a raikmai ^fc'^^c". 
choosing good names is 
the most important port of 

programming in FORTH. 



Let's take a look at an example of 

this rule. What name would you. gire 
to the word that takes a row and col- 
umn position off the stack and moves 
the cursor of your terminal to that 
position? Think about it for a minute 
before you read the next paragraph. 

If you chose a word like GOTOXY or 
XYPOS may you burn in the fires of 
PASCAL forever! These are total com- 
puterese gibberish, and should be 
avoided like the plague. A terrific 
word for this function would be AT, 
since you are positioning the cursor AT 
the values that are on the stack. (This 
name was stolen by me from Kim Har- 
ris who credits Chuck Moore.) Com- 
pare how much more nicely the code 
fragment: 

5 20 AT ." Hello" reads compared to 

5 20 GOTOXY ." Hello" 

Let's take another example, which 
might be sacrosanct to many of you. 
Suppose you wanted to define a word 
which will list all of the words in a par- 
ticular vocabulary on your terminal. 
What would be a good name for such 
a beast? If you said VLIST try again. 
VLIST is another example of com- 
puterese gibberish. If you would like 
to know what the EDITOR WORDS are 
doesn't it make more sense to type 
EDITOR WORDS than EDITOR VLIST? 
WORDS is the perfect name for such a 
function. It names the what, namely 
Continued on page 35 



FORTH Dimensions 



33 



Volume IV, No. 4 



JOIN THE APPLICATION 
MIG RATION! 

• PRODUCE MACHINE TRANSPORTABLE CODE. 

• GENERATE ROMABLE/HEADERLESS CODE. 

• FORWARD REFERENCING ALLOWED. 

• PUT FORTH ON OTHER COMPUTERS. 

• PRODUCE EXECUTABLE IMAGE IN RAM OR ON DISK. 

• PRODUCE ADDRESS MAP OF APPLICATION. 

• NO LICENSE FEE OR ROYALTIES ON APPLICATIONS. 




fig-FORTH CROSS-COMPILERS by NAUTILUS SYSTEMS 

Apple, Atari, TRS-80 Model I, Zenith, and Northstar 

fig-FORTH CROSS-COMPILER by LABORATORY MICROSYSTEMS 

CP/M-80, CP/M-86, IBM P.C., and 68000 (requires LAB FORTH at additional cost) 

79-Standard Systems by MOUNTAIN VIEW PRESS 

CP/M-80 

$300.00 + tax and $5.00 shipping and handling 

Apple is a trademark of Apple Computer, Inc. Atari is a trademark of Atari Computer, TRS-80 is a trademark of 
Tandy, Corp, Zenith iS a trademark of Zenitfi Radio Corporation, Northstar is a trademark of Northstar Computers. 
IBM IS a trademark of International Business Machines, Inc. 



Nautilus Systems 

P.O. Box 1098 SANTA CRUZ, OA 95061 



CCI MegaFORTH for Data General Computers 

* FORTH-79 superset and various utilities 

* Multitasking, Multiuser 

* Cross compiler - can produce ROMable code 

* Cross reference generator 

* Screen and line editors 

* Floating point support 

* Works on NOVA and ECLIPSE computers 
including microNOVA and microECLIPSE 

* Uses ECLIPSE instruction set on ECLIPSEs 

* Runs under DG operating systems 

* Extensive user manual and documentation 



The CCI version of fig-FORTH for the NOVA is available at $90.00 



CAPSTONE COMPUTING, INC. 

5640 Southwyck Blvd., Suite 2E 
Toledo, Ohio 43614 
Tel. (419) 866-5503 



FORTH Dimensions 



34 



Volume IV, No. 4 



Choosing Names (continued from page 33) 



tell me what the WORDS are, not the 
how of Vocabulary LISTing. 

Now let's take a look at the third and 
final rule in choosing a good name. 
Rule number 3 is: AJJ things being 
equal between two names, choose the 
shorter one. Let's try our rules on the 
following problems. Think of a name 
for a word that will clear the screen 
of a video terminal. Some names that 
immediately spring to mind are: 
ERASE, BLANK and CLEAR. Unfortunate- 
ly ERASE and BLANK are already taken, 
and CLEAR seems like a good choice, 
but maybe we can do better. CLEAR 
could apply to other things besides a 
video terminal, so think about words 
that would only apply to visual things. 
Consider the word DARK. This is ideal 
for this function. All things being 
equal between CLEAR and DARK we 
would choose DARK based on rule 3. 
Let's look at one more example. What 
name should I give the word that 
decompiles other FORTH words. The 
syntax I want is 

??? NAME 

where ??? will decompile the FORTH 
word NAME. Think of what we are do- 
ing and come up with some names. 
Rule 2 excludes garbage such as 
DECOMP and DIS. What is it we are do- 
ing? We are exposing the definition of 
NAME. Think of words that mean ex- 
pose. How about the following: EXPOSE 
DISCLOSE REVEAL SEE. They are all good 
English words that describe what is 
going on. 

For a long time I used REVEAL for this 
function, but then later I finally came 
up with SEE, and chose it based on rule 
number 3. I don't see any intrinsic 
value of SEE over REVEAL other than it 
is shorter, and hence easier to type. 
Both SEE QUIT and REVEAL QUIT appeal 
to me. 

As a final example, and perhaps a 
piece of useful code that you can use 
in your applications, let's take a look 
at Fig. 1. This example was motivated 
by a frequent occurrence in many of 
my programs, namely that of return- 
ing a TRUE or FALSE result during 
some kind of searching procedure. 
Furthermore, this returned result must 
be capable of nesting properly. 

For example, suppose we wanted to 
search a string for an occurrence of a 
control character. If you are passed 



the address and length of the string, 
you might wind up with a piece of 
code as shown in Fig. 2. 

It first shoves a behind the address 
and length on the stack. It then runs 
through the string character by 
character and if it finds a control 
character, it throws away the current 
address and the 0, replaces them with 
two 1s, and leaves the loop. After the 
loop, the address is thrown away, leav- 
ing only the boolean result. I think this 
is not only hard to follow, but tricky, 
and should be avoided. 

Now compare it with the piece of 
code in Fig. 3. It starts out by saying 
that the result to be returned is initial- 
ly false. Next it also runs through the 
string character by character, and if it 
finds a control character it simply in- 
dicates that the search was successful 
and leaves. After the loop the address 
is thrown away and the result is 
returned. What could be simpler and 
more readable? 

Now let's examine Fig. 1 in more 
detail. The word INITIALLY is nothing 
more than a push onto a stack pointed 
to by the word BOOLEANS. Similarly 
RESULT is nothing more than a pop 
from the same stack. Notice how com- 
pletely different the names are from 



how they are actually implemented. If 
I had named the how instead of the 
what, I would have wound up with 
names Hke >BOOL and BOOL>. Not 
only would this violate rule number 1, 
but it would be complete computer 
gibberish as well. How many of you 
have implemented stacks with names 
such as > GARBAGE and GARBAGE >? 

Just because something is a stack 
doesn't mean it has to have little 
arrows associated with it. Stacks are 
very useful data structures, and when 
you use them to implement a function, 
be sure to name them according to 
what the function does, not how it 
does it. I have found that using the 
code in Fig. 1 has improved the 
readability of my programming im- 
mensely, at almost zero cost. 

In conclusion, I would like to leave 
you with the immortal words of the 
poet John Keats, from his poem 
ENDYMION. He said something like: 
"A good name is a joy forever." Till 
next time, may the FORTH be with 
you. □ 

©Henry Laxen 1982 



Henry Laxen is an independent 
FORTH consultant based in Berkeley, 
Cahfornia. 



Scr # 1 

\ Fig 1. Boolean Results 11SEP82HHL 

1 CREATE BOOLEANS O , 20 ALLOT ( Space -for the stack ) 

2 : INITIALLY < n — ) 

3 BOOLEANS 2 OVER +• < increment index > 

4 DUP 3+1 ( and store n ), ; 

5 : RESULT ( n — ) 

6 BOOLEANS DUP DUP 3 + 3 < get top o-f stack ) 

7 -2 ROT +f ( and decrement index ) ; 

8 : FAIL ( — ) 

9 RESULT DROP FALSE INITIALLY ; 

10 : SUCCEED ( — ) 

11 RESULT DROP TRUE INITIALLY ; 
12 

13 
14 
15 

Scr # 2 

\ Fig. 2. Poor way to Search a String 11SEP82HHL 

1 : CONTROL? ( addr len — + ) 

2 ROT ROT O DO DUP C3 BL 

3 < IF 2DR0P 1 1 LEAVE THEN 

4 LOOP DROP ; 
5 

6 

'7 \ Fig. 3. Neat way to Search a String 

8 : CONTROL? ( addr len — f > 

9 FALSE INITIALLY O DO DUP C3 BL 

10 < IF SUCCEED LEAVE THEN 

11 LOOP DROP RESULT ; 
12 

13 
14 
15 



FORTH Dimensions 



35 



Volume IV, No. 4 



TAKE 
FORTH 
TO WORK 



NOW YOU CAN RUN 
FORTH ON THE OFFICE 
IBM MAINFRAME. GIVE 
YOURSELF THE FORTH 
ADVANTAGE ON THE 
JOB! 



FORTH/370 

for large IBM and 
equivalent computers 



• IBM 370, 4341, 3033, etc. 

• Based on fig FORTH 

• Program compatible with 
micro FORTH systems 

• Editor and Assembler 

• Runs under VM/GMS or 
MVS/TSO 

• 32 bit word, 64 bit double 
word 

• Files compatible with host 
operating system 



ASK YOUR EMPLOYER 
TO BUY FORTH/370 AND 
START USING FORTH 8 
HOURS PER DAY. 



Introductory Price $1350. 
5% Sales Tax in Maryland 



WARD SYSTEMS GROUP 

8013 Meadowview Drive 
Frederick, Maryland 21701 
(301) 695-8750 



1983 ROCHESTER FORTH 
APPLICATIONS CONFERENCE 
With a Focus on Robotics 



June 7 through June 11, 1983 

University of Rochester 
Rochester, New York 



• The third annual Rochester Forth Conference will be 
hosted by the University of Rochester's Laboratory for 
Laser Energetics and sponsored by the Institute for 
Applied Forth Research, Inc. This year's conference has 
a format similar to that of previous Rochester con- 
ferences with an emphasis on Forth applications focused 
on a special topic. This year's topic Is robotics, which 
embraces many areas Including, but not limited to: 
mechanical and electrical engineering, vision, artificial 
Intelligence, computer networking and automated 
manufacturing. We believe that the nature of Forth and 
Its application to robotics provides a unique opportunity 
to study both disciplines. 

• There Is a call for papers on the following topics: 

1 . Robotics and Forth. 

2. Forth applications. Including, but not limited 
to: real time, business, medical, space-based, 
laboratory and personal systems; and Forth 
microchip applications. 

3. Forth technology, including finite state 
machines, control structures, and defining 
words. 

• Papers will be handled In either oral or poster 
sessions, although oral papers will be refereed In 
accordance with conference direction and paper 
suitability. Please submit a 200 word abstract by April 
15,1 983. Papers for the oral session must be received 
by May 1 5 and for poster sessions by June 1, 1983. 
Papers are limited to a maximum of 10 printed pages 
Including code and figures. If this restriction causes a 
problem, please contact us. 

• For more information, please contact the conference 
chairman: 

Lawrence P. Forsley 
Laboratory for Laser Energetics 
250 East River Road 
Rochester, New York 14623 



FORTH Dimensions 



36 



Volume IV, No. 4 



Fig Chapters 

U.S. 



• ARIZONA 

Phoenix Chapter 

Peter Bates at 602/996-8398 

• CALIFORNIA 

Los Angeles Chapter 

Monthly, 4th Sat., 11 a.m., Allstate 
Savings, 8800 So. Sepulveda Blvd., 
L.A. Philip Wasson 213/649-1428 

Northern California Chapter 

Monthly, 4th Sat., 1 p.m., FORML 
Workshop at 10 a.m. Palo Alto area. 
Contact FIG Hotline 415/962-8653 

Orange County Chapter 

Monthly, 3rd Sat., 12 noon, Fullerton 
Savings, 18020 Brockhorst, Fountain 
Valley. 714/896-2016 

San Diego Chapter 

Weekly, Thurs., 12 noon. Call Guy 
Kelly, 714/268-3100 x4784 

• MASSACHUSETTS 

Boston Chapter 

Monthly, 1st Wed., 7 p.m. Mitre 
Corp. Cafeteria, Bedford, MA. Bob 
Demrow, 617/688-5661 after 5 p.m. 

• MICHIGAN 

Detroit Chapter 

Call Dean Vieau, 313/493-5105 

• MINNESOTA 

MNFIG Chapter 

Monthly, 1st Mon. Call Mark Abbot 
(days) 612/854-8776 or Fred Olson, 
612/588-9532, or write to: MNFIG, 
1156 Lincoln Ave., St. Paul, MN 
55105 

• NEW JERSEY 

New Jersey Chapter 

Call George Lyons, 201/451-2905 eves. 

• NEW YORK 

New York Chapter 

Call Tom Jung, 212/746-4062 

• OKLAHOMA 

Tulsa Chapter 

Monthly, 3rd Tues., 7:30 p.m.. The 
Computer Store, 4343 So. Peoria, 
Tulsa, OK. Call Bob Giles, 
918/599-9304 or Art Gorski, 
918/743-0113 



• OHIO 

Dayton Chapter 

Monthly, 2nd Tues., Datalink 
Computer Center, 4920 Airway Road, 
Dayton, OH 45431. Call Gary Ganger, 
(513) 849-1483. 

• OREGON 

Portland Chapter 

Call Timothy Huang, 9529 Northeast 
Gertz Circle, Portland, OR 97211, 
503/289-9135 

• PENNSYLVANIA 

Philadelphia Chapter 

Call Barry Greebel, Continental Data 
Systems, 1 Bala Plaza, Suite 212, Bala 
Cynwid, PA 19004 

• TEXAS 

Austin Chapter 

Call John Hastings, 512/327-5864 

Dallas/Ft. Worth Chapter 

Monthly, 4th Thurs. 7 p.m.. Software 
Automation, 1005 Business Parkway, 
Richardson, TX. Call Marvin Elder, 
214/231-9142 or Bill Drissel, 
214/264-9680 

• UTAH 

Salt Lake City Chapter 

Call Bill Haygood, 801/942-8000 

• VERMONT 

ACE Fig Chapter 

Monthly, 4th Thur., 7:30 p.m., The 
Isley Library, 3rd Floor Meeting Rm., 
Main St., Middlebury, VT 05753. 
Contact Hal Clark, RD #1 Box 810, 
Starksboro, VT 05487, 802/877-2911 
days; 802/453-4442 eves. 

• VIRGINIA 

Potomac Chapter 

Monthly, 1st Tues. 7p.m., Lee Center, 
Lee Highway at Lexington Street, 
Arlington.'Virginia. Call Joel 
Shprentz, 703/437-9218 eves. 

• WASHINGTON 

Seattle Chapter 

Call Chuck Pliske or Dwight 
Vandenburg, 206/542-7611 
Nevada 

Las Vegas Chapter 

Call Gerald Hasty, 702/737-5670 



FOREIGN 

• AUSTRALIA 

Australia Chapter 

Contact Lance Collins, 65 Martin Rd., 
Glen Iris, Victoria 3146, or phone 
(03) 292600 

• CANADA 

Southern Ontario Chapter 

Contact Dr. N. Solnseff, Unit for 
Computer Science, McMaster 
University, Hamilton, Ontario L8S 
4K1, 416/525-9140 x2065 

Quebec Chapter 

Call Gilles Paillard, 418/871-1960 or 
643-2561 

• ENGLAND 

English Chapter 

Write to FORTH Interest Group, 38 
Worsley Rd., Frimley, Camberley, 
Surrey, GU16 5AU, England 

• JAPAN 

Japanese Chapter 

Contact Masa Tasaki, Baba-Bldg. 8F, 
3-23-8 Nishi-Shimbashi, Minato-ku, 
Tokyo, 105 Japan 

• NETHERLANDS 

HCC-FORTH Interest 
Group Chapter 

Contact F.J. Meijer, Digicos, Aart 
V.D. Neerweg 31, Ouderkerk A.D. 
Amstel, The Netherlands 

• WEST GERMANY 

West German Chapter 

Contact Wolf Gervert, Roter Hahn 29, 
D-2 Hamburg 72, West Germany, 
(040) 644-3985 

SPECIAL GROUPS 

Apple Corps FORTH 
Users Chapter 

Twice monthly, 1st & 3rd Tues., 7:30 
p.m., 1515 Sloat Blvd., #2, San 
Francisco, CA. Call Robert Dudley 
Ackerman, 415/626-6295 

Nova Group Chapter 

Contact Mr. Francis Saint, 2218 Lulu, 
Witchita, KS 67211, 316/261-6280 
(days) 

MMSFORTH Users Chapter 

Monthly, 3rd Wed., 7 p.m., 
Cochituate, MA. Dick Miller, 
617/653-6136 



FORTH Dimensions 



37 



Volume IV, No. 4 



List of FORTH System Vendors 

(e.g., A1 signifies AB Computers, etc.) 



Processors 

1802 Cl, C2, F3, F6, L3 

6502 (AIM, KIM, SYM)... Rl, R2, Si 

6800 F3, F5, Kl, L3, M6, Tl 

6809 F3, F5, L3, M6, Tl 

68000 C4, El 

8080/85 A5, Cl, C2, F4, 15, LI, L3, M3, 

¥4, 13, Kl, U, M2, 

Z8000 13 

8086/88 F2, F3, LI, L3, M6 

9900 E2, L3 



Atari M6, P2, Ql 

Cromemco A5, M2, M6 

DEC PDP/LSI-11 C2, F3, Kl, L2, S3 

Heath-89 M2, M6 

Hewlett-Packard 85 

IBM PC C2, F3, LI, M5, M6 

IBM Other L3 

Micropolis A2, M2, S2 

^^OT\.\vSUi \5,M2,?1,S7 

^dftwmc C^, 01, S6, T2 

OsboTTie 

Pet SWTPC Al, A6, Bl, C3, 01, S6, T2, T5 

TRS-80 I, II, III 15, M5, M6, S4, S5 

TRS-80 Color A3, F5, M4, Tl 



Operating Systems 

CP/M A3, C2, F3, 13, L3, Ml, M2, M6 

Computers 

Alpha Micro P3, S3 

Apple A4, F4, 12, 14, Jl, L4, M2, M6, 

02, 03 



Other Products/Services 

Boards, Machine F3, M3, R2 

Consultation C2, C4, Nl 

Cross Compilers C2, F3, 13, M6, Nl 

Products, Various C2, F3, 15, S8 

Training F3, 13 




Ver. 2 For your APPLE II/II+ 

The complete professional software system, that meets 
ALL provisions of the FORTH-79 Standard (adopted Oct. 

1980). Compare the many advanced features of FORTH— 

79 with the FORTH you are now using, or plan to buy! 

FEATURES OURS OTHERS 

79-Standard system gives source portability. YES 

Professionally written tutorial & user manual 200 PG. 

Screen editor with user-definable controls. YES 

Macro-assembler with local labels. YES 

Virtual memory. YES 

Both 13 & 16-sector format. YES 

Multiple disk drives. YES 

Double-number Standard & String extensions. YES 

Upper/lower case keyboard input. YES 

LO-Res graphics. YES 

80 column display capability YES 

Z-80 CP/M Ver. 2.x & Northstar also available YES 

Affordable! $99.95 

Low cost enhancement opt/on: 

Hi-Res turtle-graphics. YES 

Floating-point mathematics. YES 

Powerful package with own manual , 

50 functions in all, 

AM951 1 compatible. 

FORTH-79 V.2 (requires 48K & 1 disk drive) $ 99.95 
ENHANCEMENT PACKAGE FOR V.2 

Floating point & Hi-Res turtle-graphics $ 49.95 

COMBINATION PACKAGE $139.95 
(CA res. add 6% tax; COD accepted) 



MicroMotion 

12077 Wilshire Blvd. # 506 
L.A.,CA 90025 (213)821-4340 
Specify APPLE, CP/M or Northstar 
Dealer inquiries invited^ 




Version 2 For Z-80, CP/M (1.4 & 2.x), 
& Northstar DOS Users 
The complete professional software system, that meets 
ALL provisions of the FORTH-79 Standard (adopted Oct. 
1980). Compare the many advanced features of FORTH— 
79 with the FORTH you are now using, or plan to buy! 

OURS OTHERS 



FEATURES 



YES 
200 PG. 
YES 
YES 
YES 



79-Standard system gives source portability. 
Professionally written tutorial & user manua 
Screen editor with user-definable controls. 
Macro-assembler with local labels. 
Virtual memory. 
BDOS, BIOS & console control functions (CP/M). YES 
FORTH screen files use standard resident 
file format. 

Double-number Standard & String extensions 
Upper/lower case keyboard input. 
APPLE ll/IK version also available. 
Affordable! 

Low cost enhancement options. 
Floating-point mathematics 
Tutorial reference manual 
50 functions (AM951 1 compatible format) 
Hi-Res turtle-graphics (NoStar Adv. only) 



YES 
YES 
YES 
YES 
$99.95 

YES 



YES 



FORTH-79 V.2 (requires CP/M Ver. 2.x). 
ENHANCEMENT PACKAGE FOR V.2: 

Floating point 
COMBINATION PACKAGE (Base & Floating point) 

(advantage users add $49.95 for Hi-Res) 

(CA. res. add 6% tax; COD & dealer inquiries welcome) 



MicroMotion 

12077 Wilshire Blvd. #506 
L.A.,CA 90025 (213) 821-4340 
Specify APPLE, CP/M or Northstar 
Dealer inquiries invited. 



$99.95 

$ 49.95 
$139.95 




FORTH Dimensions 



38 



Volume IV, No. 4 



FORTH Vendors 

The following vendors offer FORTH systems, applications, or consultation. FIG makes no judgement on any product, and takes no respon- 
sibility for the accuracy of this list. We encourage readers to keep us informed on availability of the products and services listed. Vendors 
may send additions and corrections to the Editor, and must include a copy of sales literature or advertising. 



FORTH Systems 

A 

1. AB Computers 

252 Bethlehem Pike 
Colmar, PA 18915 
215/822-7727 

2. Acropolis 

17453 Via Valencia 
San Lorenzo, CA 94580 
415/276-6050 

3. Advanced Technology Corp. 
P.O. Box 726 

Chnton, IN 37716 

4. Applied Analytics Inc. 
8910 Brookridge Drive, #300 
Upper Marlboro, MD 20870 

5. Aristotelian Logicians 
2631 East Pinchot Avenue 
Phoenix, AZ 85016 

6. Aurora Software Associates 
P.O. Box 99553 
Cleveland, OH 44199 



1. Blue Sky Products 
729 E. Willow 
Signal Hill, CA 90806 



1. CMOSOFT 
P.O. Box 44037 
Sylmar, CA 91342 

2. COMSOL, Ltd. 
Treway House 
Hanworth Lane 
Chertsey, Surrey KT16 9LA 
England 

3. Consumer Computers 
8907 La Mesa Boulevard 
La Mesa, CA 92041 
714/698-8088 

4. Creative Solutions, Inc. 
4801 Randolph Road 
Rockville, MD 20852 



1. Datentec Kukulies 
Heinrichsallee 35 
Aachen, 5100 
West Germany 



1. Emperical Research Group 
P.O. Box 1176 

Milton, WA 98354 
206/631-4855 

2. Engineering Logic 
1252 13th Avenue 
Sacramento, CA 95822 



1. Fantasia Systems, Inc. 

1059 Alameda De Las Pulgas 
Belmont, CA 94002 
415/593-5700 

2. Fillmore Systems 
5227 Highland Road 
Minnetonka, MX 55343 

3. FORTH, Inc. 

2309 Pacific Coast Highway 
Hermosa Beach. CA 90254 
213/372-8493 

4. FORTHWare 

639 Crossridge Terrace 
Orinda, CA 94563 

5. Frank Hogg Laboratory, Inc. 
130 Midtown Plaza 
Syracuse, NY 13210 
315/474-7856 

6. FSS 

P.O. Box 8403 
Austin, TX 78712 
512/477-2207 



1. IDPC Company 
P.O. Box 11594 
Philadelphia, PA 19116 
215/676-3235 

2. lUS (Cap'n Software) 
281 Arlington Avenue 
Berkeley, CA 94704 
415/525-9452 

3. Inner Access 
517K Marine View 
Belmont, CA 94002 
415/591-8295 

4. Insoft 

10175 S.W. Barbur Blvd., #202B 
Portland, OR 97219 
503/244-4181 

5. Interactive Computer 
Systems, Inc. 

6403 Di Marco Road 
Tampa, FL 33614 



1. JPS Microsystems, Inc. 

361 Steelcase Road, West, Unit 1 
Markham, Ontario, 
Canada L3R 3V8 
416/475-2383 



1. Laboratory Microsystems 
4147 Beethoven Street 
Los Angeles, CA 90066 
213/306-7412 

2. Laboratory Software 
Systems, Inc. 

3634 Mandeville Canyon Road 
Los Angeles, CA 90049 
213/472-6995 

3. Lynx 

3301 Ocean Park, #301 
Santa Monica, CA 90405 
213/450-2466 

4. Lyons, George 

280 Henderson Street 
lersey City, NJ 07302 
201/451-2905 

M 

1. M & B Design 

820 Sweetbay Drive 
Sunnyvale, CA 94086 

2. MicroMotion 

12077 Wilshire Boulevard, #506 
Los Angeles, CA 90025 
213/821-4340 

3. Microsystems, Inc. 

2500 E. Foothill Boulevard, #102 
Pasadena, CA 91107 
213/577-1417 

4. Micro Works, The 
P.O. Box 1110 

Del Mar, CA 92014 
714/942-2400 

5. Miller Microcomputer Services 
61 Lake Shore Road 

Natick, MA 01760 
617/653-6136 

6. Mountain View Press 
P.O. Box 4656 
Mountain View, CA 94040 
415/961-4103 

N 

1. Nautilus Systems 
P.O. Box 1098 
Santa Cruz, CA 95061 
408/475-7461 



1. OSI Software & Hardware 
3336 Avondale Court 
Windsor, Ontario 
Canada N9E 1X6 
519/969-2500 

2. Offete Enterprises 
1306 S "B" Street 
San Mateo, CA 94402 



3. On-Going Ideas 
RD #1, Box 810 
Starksboro, VT 05487 
802/453-4442 



1. Perkel Software Systems 
1636 N. Sherman 
Springfield, MO 65803 

2. Pink Noise Studios 
P.O. Box 785 
Crockett, CA 94525 
415/787-1534 

3. Professional Management 
Services 

724 Arastradero Road, #109 
Palo Alto, CA 94306 
408/252-2218 



1. Quality Software 

6660 Reseda Boulevard, #105 
Reseda, CA 91335 



1. Rehnke, Eric C. 

540 S. Ranch View Circle, #61 
Anaheim Hills, CA 92087 

2. Rockwell International 
Microelectronics Devices 
P.O. Box 3669 
Anaheim, CA 92803 
714/632-2862 



1. Saturn Software, Ltd. 
P.O. Box 397 

New Westminister, BC 
V3L 4Y7 Canada 

2. Shaw Labs, Ltd. 
P.O. Box 3471 
Hayward, CA 94540 
415/276-6050 

3. Sierra Computer Co. 
617 Mark NE 
Albuquerque, NM 87123 

4. Sirius Systems 

7528 Oak Ridge Highway 
Knoxville, TN 37921 
615/693-6583 

5. Software Farm, The 
P.O. Box 2304 
Reston, VA 22090 

6. Software Federation 
44 University Drive 
Arlington Heights, IL 60004 
312/259-1355 

7. Software Works, The 
1032 Elwell Court, #210 
Palo Alto, CA 94303 
415/960-1800 

8. Supersoft Associates 
P.O. Box 1628 
Champaign, IL 61820 
217/359-2112 



1. Talbot Microsystems 
1927 Curtis Avenue 
Redondo Beach, GA 90278 

2. Technical Products Co. 
P.O. Box 12983 
Gainsville, FL 32604 
904/372-8439 

3. Timin Engineering Go. 
6044 Erlanger Street 
San Diego, GA 92122 
714/455-9008 

4. Transportable Software, Inc. 
P.O. Box 1049 
Hightstown, NI 08520 
609/448-4175 



1. Zimmer, Tom 
292 Falcato Drive 
Milpitas, CA 95035 



Boards & Machines Only 

see System Vendor Chart for others 

Controlex Corp. 
16005 Sherman Way 
Van Nuys, CA 91406 
213/780-8877 

Datricon 

7911 NE 33rd Drive, #200 
Portland, OR 97211 
503/284-8277 

Golden River Corp. 
7315 Reddfield Court 
Falls Church, CA 22043 

Peopleware Systems Inc. 
5190 West 76th Street 
Minneapolis, MN 55435 
612/831-0872 

Zendex Corp. 

6398 Dougherty Road 

Dublin, CA 94566 



Application Packages Only 

see System Vendor Chart for others 

R. E. Curry & Associates 
P.O. Box 11324 
Palo Alto. CA 94306 

InnoSys 

2150 Shattuck Avenue 
Berkeley, CA 94704 
415/843-8114 



Consultation & Training Only 

see System Vendor Chart for others 

Boulton, Dave 

581 Oakridge Drive 

Redwood City, CA 94062 

Brodie, Leo 

9720 Baden Avenue 

Chatsworth, CA 91311 

213/998-8302 

Girton, George 

1753 FrankUn 

Santa Monica, GA 90404 

213/829-1074 

Go FORTH 

504 Lakemead Way 

Redwood City, CA 94062 

415/366-6124 

Harris, Kim R. 
Forthright Enterprises 
P.O. Box 50911 
Palo Alto, CA 94303 
415/858-0933 

Laxen, Henry H. 
1259 Cornell Avenue 
Berkeley, CA 94706 
415/525-8582 

Petri, Martin B. 
15508 Lull Street 
Van Nuys, CA 91406 
213/908-0160 

Redding Co. 
P.O. Box 498 
Georgetown, CT 06829 
203/938-9381 

Schleisiek, Klaus 
do ]. Buettuer 
Eppeudorfer Landstr. 16 
D 2 Hamburg 20 
W. Germany 

Schrenk, Dr. Walter 
Postfach 904 
7500 Krlsruhe-41 
W. Germany 

Software Engineering 
317 W. 39th Terrace 
Kansas City, MO 64111 
816/531-5950 

Technology Management, Inc. 

1520 S. Lyon 

Santa Ana, CA 92705 



FORTH Dimensions 



39 



Voiume IV, No. 4 



FORTH INTEREST GROUP MAIL ORDER 



□ Membership in FORTH INTEREST GROUP and Volume IV of 
FORTH DIMENSIONS (6 issues) 

□ Volume ni of FORTH DIMENSIONS (6 issues) 

□ Volume II of FORTH DIMENSIONS (6 issues) 

□ Volume I of FORTH DIMENSIONS (6 issues) 

□ fig-FORTH Installation Manual, containing the language model of 
fig-FORTH, a complete glossary, memory map and installation instructions 

□ Assembly Language Source Listing of fig-FORTH for specific CPU's 
and machines. The above manual is required for installation. 
Check appropriate boxes. Price per each. 

□ 1802 □ 6502 □ 6800 □ 6809 

Q 8080 D 8086/8088 □ 9900 □ APPLE II 

□ PACE O NOVA O PDP-11 O ALPHA MICRO 

□ "Starting FORTH" by Brodie. BEST book on FORTH. (Paperback) 

□ "Starting FORTH" by Brodie. (Hard Cover) 

O PROCEEDINGS 1980 FORML (FORTH Modification Lab) Conference 

□ PROCEEDINGS 1981 FORTH University of Rochester Conference 

□ PROCEEDINGS 1981 FORML Conference, Both Volumes 

□ Volume I, Language Structure 

□ Volume n, Systems and Applications 

□ FORTH-79 Standard, a publication of the FORTH Standards Team 

□ Kitt Peak Primer, by Stevens. An indepth self -study primer 

O BYTE Magazine Reprints of FORTH articles, 8/80 to 4/81 

□ FIG T-shirts: □ Small □ Medium □ Large □ X-Large 

□ Poster, Aug. 1980 BYTE cover, 16 x 22" 

□ FORTH Programmer Reference Card. If ordered separately, send a 
stamped, addressed envelope. 

TOTAL 



FOREIGN 
USA AIR 

$15 $27 



15 
15 
15 
15 



18 
18 
18 
18 



15 

16 
20 

25 

25 

40 

25 
25 

15 

25 

5 
10 
3 



18 

20 
25 

35 

35 

55 

35 
35 

18 

35 

10 
12 
5 



FREE 



NAME 



MAIL STOP/ APT 



ORGANIZATION_ 

ADDRESS 

CITY 

VISA // 



_(if company address) 



STATE 



ZIP 



COUNTRY 



MASTERCARD # 



EXPIRATION DATE 



(Minimum of $10.00 on charge cards) 



Make check or money order in US Funds on US bank, payable to: FIG. All prices include 
postage. No purchase orders without check. California residents add sales tax. 

ORDER PHONE NUMBER: (415)962-8653 
FORTH INTEREST GROUP PO BOX 1105 SAN CARLOS, OA 94070 



FORTH iNTEREST GROUP 

RO. Box 1105 

San Carios, CA 94070 



BULK RATE 
U.S. POSTAGE 

PAID 
Permit No. 261 

Mt. View, CA 



J 5 3 2 S 
R L Sf^ITH 

ESL SU3SIDIAR OF TRW 
PO BOX 510 
SUNNYVALE/ CA 94086 



Address Correction Requested