Fig-Forth 8080 Ver 11

Download as pdf or txt
Download as pdf or txt
You are on page 1of 84

fig -FORTH FOR 8080

ASSEMBLY SOURCE LISTING

RELEASE 1.1

WITH COMPILER SECURITY

AND

VARIABLE LENGTH NAMES

September 1979

This public domain publication is provided through the courtesy of


the Forth Interest Group, P,O, Box 1105, San Carlos, CA 94070.

Further distribution must include this notice,


79 SEP 15
8080 fig-FORTH Release 1.1

This release of 8080 fig-FORTH has been integrated with the CP/M
operating system. This is a convenience to users, but NOT a requirement of
Forth. The previous FIGreleaseoperated in 'native mode' with a
Northstar disk. Non-CP/M users may patch the terminal inlout and
disk word R/W per the Installation Manual.

Release 1.1 is significantly improved from 1.0. The following is


a summary of the changes:

1) fig-FORTH may run in memory above address 8000H.

2) Code routines are re-entrant; e.g. use of the 'N' scratch


area has been eliminated. However, the systems is not ROMable
as some parameters in the dictionary are altered during
execution.

3) LOOP and +LOOP now work according to the glossary, i.e. indexes
may be negative and +LOOPS increment may be negative.

4) EMIT increments OUT for output formatting. VLIST uses this


property.

5) CMOVE and FILL store nothing if the number of bytes input


parameter is zero.

6) U* and U/ are several times faster and the code is shorter!

7) Several definitions have been added:


RP@ 2DUP D@ D! NOOP C/L U< P@ @!

8) < now works correctly even of the difference between the compared
values is greater than 32,767.

9) The stack pointer SP now gets initialized in CLD on a COLD start.

10) This disc interface now matches the FIG model. As listed, i t uses
CP/M BDOS service routines for single and double density 8" diskettes.
It is properly parameterized so that the #Bytes/Sector, buffer size,
and number of screens may be changed with assembly equates.

11) All nontrivial CODE words (in assembly language) are now commented.
A list of assembly language labels is included. If you have entered
8080 fig-FORTH Release 1.0, this list will serve as a check list for your
updating. In this list, 'fixed' means an error was corrected. 'changed'
means some improvement was made. Changes preceeded bv '*' are manditorv.

2
FORTH INTEREST GROUP PO. BOX 1105 * - * e * San Carlos, Ca. 94070
INSTALLATION INSTRUCTIONS

Memory c o n f i g u r a t i o n :

S e t ORG ( b e f o r e ORIG) t o t h e l o w e s t memory a d d r e s s FORTH w i l l u s e .


S e t EM t o t h e h i g h e s t memory a d d r e s s + l .
A minimum of 10,000 b y t e s i s r e q u i r e d t o run.
S e t NSCR t o t h e number of 1023 b y t e s c r e e n s f o r e d i t i n g and d i s c b u f f e r s .
Also s e t KBBUF e q u a l t o number of d a t a b y t e s p e r b u f f e r ; t h i s
s h o u l d be a m u l t i p l e of 128. There must be 2 o r more d i s c b u f f e r s
(NBUF> 1) .
S e t RSlN and BSOlJT t o your t e r m i n a l s backspace c h a r a c t e r s .
Modify t h e t e r m i n a l d r i v e r s (RDTECH, WTTECH) a s needed f o r y o u r
installation.

The above i s t h e minimun needed t o b r i n g up t h i s program w i t h o u t


d i s c 1-0. To b r i n g up t h e d i s c 1-0 s e c t i o n ( l a b e l s DRIVE t o LOAD), s e t
BPS t o t h e number of b y t e s p e r d i s c s e c t o r and MXDRV t o t h e number of
d r i v e s you have. Check t h e d i s c c a p a c i t y e q u a t e s (SPTn and TRKSn). Modify
o r r e l a c e t h e CP/M i n t e r f a c e r o u t i n e s .

S u b s t i t u t e e r a l t e r IOS, SETIO, SETDRV, DISKR, DISKW and TSCALC


i f not u s i n g CP/M.

Assemble and l o a d t h e program.


Type i n (compile) t h e t e x t e d i t o r i n s c r e e n s 87 through 9 2 of t h e
fig-FORTH model (from t h e I n s t a l l a t i o n Manual) ommitting FLUSH,
(which i s a l r e a d p r e s e n t ) . The s t r i n g e d t i n g p o r t i o n r e q u i r e s
MATCH t o be w r i t t e n i n h i g h - l e v e l o r assembly language.

Using t h e EDITOR, e d i t t h e e r r o r messages g i v e n i n t h e Model S c r e e n s


4 and 5 o n t o y o u r s c r e e n s 4 and 5 , o n t o a f r e s h (!!) d i s k . S e t t h e
c o l d s t a r t v a l u e s of WARNING t o 1 t o now u s e t h e s e e r r o r messages
by typing: HEX 1 1A +ORIGIN !

If you c a n SAVE a memory copy of t h e s y s t e m u s i n g your o p e r a t i n g system,


on d i s k f o r l a t e r l o a d i n g , t h e n you may i n c l u d e t h e e d i t o r and
any o t h e r a d d i t i o n s by t y p i n g i n t h e l i n e s 10 t h r u 15 of
S c r e e n 1/97 of t h e model. T h i s r e - c o n f i g u r e s t h e boot l o a d t o
i n c l u d e your a d d i t i o n s . You need SAVE o n l y memory from ORIG
up t h r u HERE.

FORTH l NTEREST GROUP e


. PO. Box San Carlos, Ca.
ADDENDA t o G l o s s a r y f o r
8080 fig-FORTH R e l e a s e 1.1

--- n
A c o n s t a n t r e t u r n i n g t h e number of d i s k b u f f e r s a l l o c a t e d .
For
t h e d i s k 1-0 r o u t i n e s t o work c o r r e c t l y #BUF must b e g r e a t e r t h a n 1.

P r i n t s t h e p r o c e s s o r name ( i . e . 8080) f r o m ORIG+22H encoded a s a


3 2 b i t , b a s e 36 i n t e g e r .

nlow n h i g h a d d r ---
32 b i t s t o r e . n h i g h i s s t o r e d a t a d d r ; nlow i s s t o r e d a t addr+2.

a d d r --- nlow n h l g h
32 b i t f e t c h . nhigh is f e t c h e d from addr; nlow i s f e t c h e d f r o m
addr+2.

22 nl --- n2 n l n2 n l
D u p l i c a t e s t h e t o p two v a l u e s on t h e s t a c k . E q u i v a l e n t t o OVER OVER.

--- n
C o n s t a n t l e a v i n g t h e number of c h a r a c t e r s p e r l i n e ; u s e d by t h e
editor.

DSNSITY --- a d d r
A v a r i a b l e u s e d by t h e d i s k i n t e r f a c e .
0 = single density; 1 = double density.

D I SK-ERROR --- a d d r
A v a r i a b l e u s e d by t h e d i s k i n t e r f a c e , c o n t a i n i n g t h e d i s k s t a t u s
f o r the l a s t s e c t o r read o r written. 0 means no e r r o r .

DRIVE - -- a d d r
A v a r i a b l e u s e d by d i s k i n t e r f a c e , c o n t a i n i n g t h e d i s k d r i v e
number ( 0 t o MXDRV) u s e d o n t h e l a s t s e c t o r r e a d o r w r i t t e n .

FLUSH
W r i t e a l l UPDATEd d i s k b u f f e r s t o d i s k . Should b e u s e d a f t e r
e d i t i n g , b e f o r e d i s m o u n t i n g a d i s k , o r b e f o r e e x i t i n g FORTH.

A F o r t h 'no o p e r a t i o n ' .

b port# ---
8080 o r 2-80 1-0 p o r t s t o r e . Outputs b y t e b t o port#.

port# --- b
8080 o r 2-80 1-0 p o r t f e t c h . I n p u t s b y t e b from p o r t # .

--- addr
Leaves t h e c u r r e n t v a l u e i n t h e r e t u r n s t a c k p o i n t e r r e g i s t e r .

--- addr
A v a r i a b l e u s e d by t h e d i s k i n t e r f a c e , c o n t a i n i n g t h e s e c t o r number
last r e a d o r w r i t t e n r e l a t i v e t o t h e l a s t d r i v e used.

FORTH l NTEREST GROUP . 0 " D .


F?O. Box San Carlos, Ca. 94070
SEC-READ
Reads a d i s c s e c t o r (BPS b y t e s ) i n t o memory. A l l p a r a m e t e r s must
have b e e n s e t by SET-DRIVE and SET-10. The s t a t u s on c o n l p l e t i o n
i s s t o r e d i n DISK-ERROR.

SEC-WRITE
W r i t e s a d i s k - s e c t o r (BPS b y t e s ) f r o m memory. A l l p a r a m e t e r s must
h a v e ' b e e n s e t by SET-DRIVE and SET-10. The s t a t u s on c o m p l e t i o n
i s s t o r e d i n DISK-ERROR.

SET-DRIVE
A CP/?f s e r v i c e c a l l which makes s u b s e q u e n t d i s k r e a d s and w r i t e s u s e

t h e d r i v e d e s i g n a t e d i n DRIVE. T&SCALC i s u s u a l l y u s e d t o s e t
DRIVE and ca1.l SET-DRIVE. 0 = f i r s t d r i v i t o MXDRV

SET-10
A CP/M s e r v i c e c a l l which makes s u b s e q u e n t d i s c r e a d s and w r i t e s
u s e t h e d r i v e l a s t s e t by SET-DRIVE, t h e memory a d d r e s s i n v a r i a b l e
USE, t h e s e c t o r number i n SEC, and t h e t r a c k number i n TRACK.
T6SCALC i s u s u a l l y u s e d t o set t h e s e v a r i a b l e s .

T&SCALC II ---
T r a c k & Sccror and d r i v e c a l c u l a t i o n f o r d i s k 1 0 . n i s t h e
t o t n i s e c t o r d i s p a c e m e n t from t h e f i r s t l o g i c a l d r i v e t o t h e
desired sector.
n = ( b l o c k / / + OFFSET) * SEC/BLK
The c o r r e s p o n d i n g d r i v e , t r a c k , and s e c t o r numbers a r e c a l c u l a t e d .
I f Lhe d r i v c number i s d i f f e r e n t from t h e c o n t e n t s of D R I V E , t h e new
d r i v e rlumser i s s t o r e d i n D R I V E and SET-DRIVE i s e x e c u t e d .

The t r a c k number i s s t o r e d i n TRACK; t h e s e c t o r number i s s t o r e d


i n SEC. TSSCALC i s u s u a l l y e x e c u t e d b e f o r e SET-DRIVE.

TRACK -- - addr
A v a r i a b l e u s e d by d i s k 1-0. C o n t a i n s t h e t r a c k number i a s t
read or w r l t t e n r e l a t i v e t o t h e c u r r e n t drive.

u l u2 --- f
Leave t h e b o o l e a n v a l u e of a n u n s i g n e d l e s s - t h a n comparison. Leaves
f = 1 f o r u l < u2; o t h e r w i s e l e a v e s 0. T h i s f u n c t i o n must be
u s e d when comparing memory a d d r e s s e s . u l and u2 a r e u n s i g n e d
16 bit i n t e g e r s .

FORTH iNTEREST GROUP e m . . *


PO. Box San Carlos, Ca.
CHANGES I N 8080 FIG-FORTH FROM RELEASE 1.0 TO 1.1:
15SEP79

SEVERAL CHANGES & ADDITIONS MSTAR CHANGED


NSCR = lKBYTE SCREENS * PLINE RELINKED
RTS ENLARGED PTAT ADDED
* O K I G AREA ADDITIONS PTSTO ADDED
\; DELETED * D I S K INTERFACE:
DEBUG SUPPORT ADDED * EQUATES ADDED
NEXT CHANGED * DRIVE ADD ED
WPUSH, HPUSH, NEXT1 ADDED * SEC ADDED
EXEC CHANGED * TRACK ADDED
BRAN CHANGED * USE ADD ED
* XI,OOP FIXED, FASTER * PREV ADDED
" XPLOO CHANGED * SPBLK ADDED
XDO CHANGED * NOBUF ADDED
* T)IC;LT FIXED DENSTY ADDED
FNCL CHANGED * DSKERR ADD ED
* F,*IIT FIXED * PBUF ADD ED
* CXOVE FIXED * UPDAT ADDED
D STAR C W G E D , FASTER * MTBUF ADDED
CSSAS CHANGED, FASTER * DRZER ADDED
* RPAT ADDED * DRONE ADDED
TOR CHANGED * BUFFE ADDED
RR CHANGED * BLOCK ADDED
DPLVS CHANGED 10s ADDED
DMIVU CHANGED SET10 ADD ED
* TDUP ADDED SETDRV ADD ED
* TAT ADDED TSCALC ADDED
* TSTOR ADDED SECRD ADD ED
* COLON FIXED SECWT ADDED
* SEMI FIXED * RSLW ADDED
NOOP ADDED * FLUSH ADDED
* CSLI, ADDED * LOAD FIXED
FIRST CHANGED * ARROW RELINKED
BBUF CHANGED TERMINAL & PRINTER INTERFACE:
BSCR CHANGED CSTAT ADDED
SUBR CHANGED CI N ADDED
* LESS FIXED COUT ADDED
* ULESS ADDED POUT ADDED
* RBRAC FIXED CPOUT ADDED
* PSCOD FIXED PQTER CHANGED
SEMIC CHANGED PKEY CHANGED
* DOES FIXED PEMIT CHANGED
EXPEC CHANGED PCR CHANGED
* FILL FIXED * ELSEE FIXED
ERROR CHANGED * EDIGS FIXED
* CREAT FIXED * VLIST FIXED
* QSTAC FIXED BYE ADDED
* ABORT FIXED * LIST ADDED
* WRM ADDED * INDEX ADDED
* WARM FIXED * TRIAD ADDED
* CLD ADDED * DOTCPU ADDED
* COLD FIXED * TASK RELXNKED
PiIN CHANGED
MAX CHANGED CHANGES m D BY * ARE MANDATORY*

FORTH INTEREST GROUP a - e e - PO. Box 1105 e e = o * San Carlos, Ca. 94070
C P / H MACRO ASSEM 2.0 #001 8080 FIG-FORTH 1.1 VERSION A 0 1 5 S E P 7 9
TITL.~! '8080 FIG-FORT11 1.1 VERSION A0 15SEP79'
FIG-FORTH RELEASE 1.1 FOR THE 8080 PROCESSOR

ALL PUBLICATIONS O F THE FORTH INTEREST GROUP


ARE P U B L I C DOMAIN. THEY MAY BE FURTHER
DISTRIBUTED BY THE INCLUSION O F T H I S CREDIT
NOTICE:

T H I S PUBLICATION HAS BEEN MADE AVAILABLE BY THE


FORTH I N T E R E S T GROUP
P. 0. BOX 1105
S h N CARLOS, CA 5 $070

IMPLEMENTATION BY:
J O 9 N CASSADY
339 1 5 T H STREET
OAKLAND,CA 94612
ON 790528
MODIFIED BY:
KTM HARRIS
ACKNOWLEDGEMENTS :
GEORGE FLAMMER
BOBT. D . VILLWOCK
7
-.----.--11--1.1----1-------1--------.-----------------------

9 LABELS USED WHICH D I F F E R FRO?! FIG-FORTH PUBLISHED


9 8060 L I S T I N G 1.0:
a

REL 1.1 REL 1.0


-------
9

3
.".------
9 ANDD AND
9 CSPP CSP
9 ELSEE ELSE
3 E13111) END
9 END I F F END I F
s EUSEE ERASE
J T DO 1
7 1FE; I F
9 INPI' IN
3 MODD MOD
)I om OR
I OI!Z'r OUT
t Rk 13
> RPP RP
Y SUUB SUB
5 XORR XOR

LEE ALSO:
KELKASE & VERSION NIIMBERS
A S C I I ClL4RACTER EQUATES
MEMORY ALLOCATION
D I S K INTERFACE
CONSOLE & P R I N T E R INTERFACE
CP/!.? m C R @ ASSEM 2 - 0 f002 8080 FIG-FORTH 1.1 VERSION A0 15SEP79

.----------------------------------------------------------
9

P RELEASE & VERSION NUMBERS


,
FIGREL EQU 1 ; FIG RELEASE #
FIGREV EQU 1 ; FIG REVISION #
USRVER EQU 0 ; USER VERSION #
9

9 ASCII CHARACTERS USED


3
iJ(l2C = ABL EQU 2 OH ; SPACE
OOCD = ACR EQU ODH ; CARRIAGE RETURN
0(,2E: = ADOT EQU 02EH ; PERIOD
Ot.131 = BELL EQU 0 7H ; (-GI
007F = BSIN EQU 7FH ; INPUT BACKSPACE CHR = RUBOUT
6908 = BSOUT EQU 08H ; OUTPUT BACKSPACE (-H)
0010 = DLE EQU 1 OH ;
OUOA = LF EQU OAH ; LINE FEED
OOCC = FF EQU OCH ; FORM FEED (^L)
9

, MEMORY ALLOCATION
7

EM EQU 4000H ; TOP OF MEMORY + 1 = LIMIT


NSCK EQU 1 ; NUMBER OF 1024 BYTE SCREENS
KBBUF EQU 128 ; DATA BYTES PER DISK BUFFER
uS EQU 4OH ; USER VARIABLES SPACE
RTS EQU OAOH ; RETURN STACK & TERM BUFF SPACE
9

co KBBUF+4 ; DISK BUFFER + 2 HEADER + 2 TAIL


NBUF NSCR*400H/KBBUF ; NUMBER OF BUFFERS
BUF 1 EM-CO*NBUF ; ADDR FIRST DISK BUFFER
INITRO BUF 1-US ; (RO)
INITSO INITRO-RTS ; (so)
f

PAGE
CP/M MACRO ASSEM 2.0 8080 FIG-FORTH 191 VERSIOE A0 15SEP79

0100 ORG l OOH


0100 00 ORIG NOP
0101 C38F10 JMP CLD ; VECTOR TO COLD START
0104 00 NOP
0105 C37A10 JMP WRM ; VECTOR TO WARM START
0108 01 DB F I G R E L ; F I G RELEASE #
0109 01 DB FIGREV ; F I G REVISION
OlOA 00 DB USRVER ; USER VEPFION
OlOB OE DB OEH ; IMPLEMENTATION ATTRIBUTES
OlOC 7D1A DW TASK-7 ; TOPMOST WORD I N FORTH VOCABULARY
OlOE 7F00 DW BSIN ; BKSPACE CHARACTER
0110 A03B DW I N I T R O ; I N I T (UP)
;<<<<<< FOLLOWING USED BY COLD;
9 MUST BE I N SAME ORDER A S USER VARIABLES
0112 003B DW I N I T S O ; I N I T (SO)
0114 A03B DW I N I T R O ; I N I T (ROf
0116 003B DW INITSO ; I N I T (TIB)
0118 2688, \PO0 DW IVH ; I N I T (WIDTH)
OllA 0000 DW 0 ; I N I T (WARNING)
OllC 881A DW INITDP ; I N I T (FENCE)
OllE 881A DW INITDP ; :NIT (DP)
0120 %3Q& FAOF DW F O R T W $. S ; I N I T (VOC-LINK)
; t < < < < < END DATA USED BY COLD
0122 050020B3 DW 5H, O B 3 2 0 H ; CPU NAME ( HW,LW
Y ( 3 2 B I T , BASE 36 INTEGER )
9

3 TMPLEMENTATION
9 ATTRIBUTES
9

9 I I I I +-- PROCESSOR ADDR =


9 1 1 1 1 [ 0 BYTE \ 1 WORD ]
3 I I I +---- HIGH BYTE AT
9 X I 1 [ 0 LOW ADDK \
I I I 1 HIGH ADDR ]
I I I------- ADDR MUST BE EVEN
I I [ 0 YES \ 1 NO 1
I +------- INTERPRETER I S
I [ 0 P R E \ 1 POST I
I INCREMENTINE
+---------- [ 0 ABOVE S U F F I C I E N T
\ 1 OTHER D I F F E R -
ENCES E X I S T ]

PAGE
CP/M MACRO ASSEM 2 . 0 #004 8080 FIG-FORTH 1.1 VERSION A 0 1 5 S E P 7 9

.------------------------------------------------------
9

*
Y FORTH REGISTERS
9

FORTH 8080 FORTH PRESERVATION RULES


9

9
----- ---- ........................
9 IP BC SHOULD BE PRESERVED ACROSS
9 FORTH WORDS
9 W DE SOMETIMES OUTPUT FROM NEXT
9 MAY B E ALTERED BEFORE JMP'ING TO NEXT
3 I N P U T ONLY WHEN 'DPUSH' CALLED
9 SP SP SHOULD BE USED ONLY A S DATA STACK
9 ACROSS FORTH WORDS
9 MAY B E USED WITHIN FORTH WORDS
* IF RESTORED BEFORE 'NEXT'
9 NEVER OUTPUT FROM NEXT
9 I N P U T ONLY WHEN 'HPUSH' CALLED
*
UP DW INITRO ; USER AREA POINTER
RPP DW INITRO ; RETURN STACK POINTER
9
.------------------------------------------------------
9

9 COMMENT CONVENTIONS:

MEANS "IS EQUAL TO"


MEANS ASSIGNMENT

NAME = ADDRESS O F NAME


(NAME) = CONTENTS AT NAME
( (NAME) )= I N D I R E C T CONTENTS

CFA = ADDRESS O F CODE F I E L D


LFA e ADDRESS OF LINK FIELD
NFA = ADDR O F START O F NAME F I E L D
P FA P ADDR O F START O F PARAMETER F I E L D

S1 ADDR O F 1 S T W O O O F PARAMETER STACK


-
I

S2 ADDR O F 2ND WORD O F PARAMETER STACK


R1 = ADDR O F 1 S T WORD O F RETURN STACK
R2 0 ADDR O F 2ND WORD O F RETURN STACK
( ABOVE STACK P O S I T I O N S VALID BEFORE & AFTER EXECUTION
O F ANY WORD, NOT DURING. )

LSB = LEAST SIGNIFICANT B I T


MSB I MOST S I G N I F I C A N T B I T
LB = LOW BYTE
HB il HIGH BYTE
LW P LOW WORD
HW e H I G H WORD
( MAY BE USED A S S U F F I X TO ABOVE NAMES )

PAGE
CP/M MACRO ASSEM 2.0 /I005 8080 FIG-FORTH 1.1 VERSION A 0 1 5 S E P 7 9

.---------------------------------------------------
Y

7 DEBUG SUPPORT
7

Y TO USE:
s (1) SET 'BIP' TO IP VALUE TO ‘UT, CANNOT BE CFA
9 (2) S E T MONITOR'S BREAKPOINT PC TO 'BREAK'
7 OR PATCH 'HLT' INSTR. THERE
7 (3 PATCH A .'TMP TNEXT' AT 'NEXT'
Y WHEN ( I P ) = ( B I P ) CPU WILL HALT
Y

BIP DW 0 ; BREAKPOINT ON I P VALUE


Y

TNEXT LXI HyBIP


MOV A7M
CMP C
JNZ TNEXT 1
INX H
MO V A7M ; HB
CMP B
JNZ TNEXT 1
BREAK NOP ; PLACE BREAKPOINT HERE
NOP
NOP
TNEXTl LDAX B
INX B
MOV L, A
JMP NEXT+ 3

...................................................
Y

3 NEXT, THE FORTH ADDRESS INTERPRETER


Y ( POST INCREMENTING VERSION )
,
DPUSH PUSH D
HPUSH PUSH B
NEXT LDAX B ;(W) <- ( ( I P I )
INX B ;( I P ) <- ( I P ) + 2
MOV LsA
LDAX B
INX B
MOV H7A ; (HL) <- CFA
NEXT1: MOV E7M ; ( P C > <- ((W!)
INX H
MOV D7M
XCHG
PCHL ; NOTE: (DE) = CFA+l

PAGE
CP/M MACRO ASSEM 2 . 0 #006 8080 FIG-FORTH 1.1 VERSION A 0 1 5 S E P 7 9

FORTH DICTIONARY

9 DICTIONARY FORMAT:
9

9 BYTE
* ADDRESS NAME CONTENTS
* ------- ----
9 ( MSB=1
9 ( PrPRECEDENCE B I T
9 ( S=SMUDGE BIT
9 NFA NAME F I E L D < NAME LENGTH
Y MSB=O, NAME'S I S T CHAR
9

9 MSB=l, NAME'S LAST CHR


Y LFA LINK FIELD = PREVIOUS WORD'S NFA
*
;LABEL: CFA CODE F I E L D = ADDR CPU CODE
9

Y PFA PARAMETER 1 S T PARAMETER BYTE


9 FIELD
9

9
0150 83 DPO: DB 83H ; LIT
0151 4 C 4 9 DB 'LI'
0153 D 4 DB 'T0+80H
0154 OGOO DW 0 ; (LFA)=O MARKS END O F DICTIONARY
0156 5801 LIT DW $+2 ; ( S l ) <- ( ( I P ) )
0158 OA LDAX B ; (HL) <- ( ( I P ) ) = LITERAL
0159 03 INX B ; ( I P ) <- ( I P ) + 2
015A 6F MOV LYA ; LB
015H OA LDAX B ; HB
015C: 03 INX B
015D 67 MOV H9A
015E C 3 4 4 0 1 JMP HPUSH ; ( S l ) <- (HL)

0161 8 7 DB 8M ; EXECUTE
0162 4 5 5 8 4 5 4 3 5 5 DB 'EXECUT'
9168 C 5 DB 'E'+80H
0169 5001 DW LIT-6
016B 6D01 EXEC DW $+2
016n E l POP H ; (HL) <- ( S l ) = CFA
016E C34B01 JMP NEXT 1

DB 86H ; BRANCH
DB 'BRANC'
DB 'H0+80H
DW EXEC-om
BRAN DW $+2 ; ( I P ) <- ( 1 P ) + ( ( I P ) )
BRAN1 MOV HYB ; (HL) <- (IP)
MOV L, c
MOV E,M ; (DE) <- ( ( I P ) ) BRANCH OFFSET
CP/M MACRO ASSEM 2 . 0 8007 8080 FIG-FORTH 1.1 VERSION A 0 1 5 S E P 7 9
0 1 7 F 23 INX H
0 1 8 0 56 MOV D,M
0181 2 B DCX H
0182 1 9 DAB D ; (HL) <- (HL) + ( ( I P ) )
0183 4D MOV C,L ; ( I F ) <- (HL)
0184 44 MOV 13 ,H
0185 C 3 4 5 0 1 JMP NEXT
9

0188 87 D3 87H ; OBRANCH


0189 304252414E DR 'OBRANC'
018F C8 DB 'H'+80H
0190 7101 DW BRAN- 9
0192 9401 ZBRAN DW $+2
0194 El POP H
0195 7D MOV A,L
0196 B4 ORA H
0197 CA7COl JZ BRAN1 ; I F ( S l ) = ( j TEEN ERANCH
019A 03 INX B ; E L S E S K I P BRANCK O F F S E T
019B 03 INX B
019C C34501 JILLP NEXT
9
0 1 9 F 86 DB 86H ; (LOOP)
OlAO 2 8 4 C 4 F 4 P 5 0 DB '(LOOP'
OIA5 A9 DB ') '+80H
0 1 A 6 8801 DW Z BRAN-OAH
O l A 8 AAOl XLOOP DW $4-2
OlAA 110100 L,XT D, 1 ; (DE) <- INCREMENT
OlAD 2 A 2 8 0 1 XLOOl 1.1-ILD RPP ; ( ( H L ) ) = INDEX
i!!HC) 7 E MOV A,M ; INDEX <- TNDEX + INCR
0 1 8 1 83 ADD E
OIB? 77 MOV M,A
01B3 5F MOV E,A
OiB4 2 3 INX H
0 1 B 5 7E MOV A,M
0 1 B 6 8A ADC D
0 1 B 7 77 MOV M,A
O l B 8 23 INX H ; ((HL) ) = L I M I T
01B9 1 4 INR D
O l B A 15 DCR D
O l B B 57 MOV D, A ; (DE) <- NEW INDEX
OlBC FAC701 a.1 XL002 ; I F INCR > 0
O l B F 7B EIOV A,E
OlCO 96 SUB M ; THEN (A) <- INDEX - LIMIT
O i C l 7A NOV A ,D
0 1 C 2 23 INX H
0 1 C 3 9E S BB M
0 1 C 4 C3CCO1 JMP XI003
0 1 C 7 7E MOV A,M ; E L S E (A) <- L I M I T - INDEX
O1C8 93 SliB
01C9 2 3 LNX H
O l C A 7E MOV A,M
0 l C B 9A SBB D
; I F (A) < 0
O l C C FA7CO1 JM BRAN1 ; THEN LOOP AGAIN
O l C F 23 TNX H ; E L S E DONE
OlDO 2 2 2 8 0 1 SHLD WP ; DISCARD R1 h R 2
CP/M MACRO ASSEM 2 . 0 #008 8080 FIG-FORTH 1.1 VERSION A 0 1 5 S E P 7 9
011~5 03 INX B ; S K I P BRANCH O F F S E T
0 ! D 4 03 INX B
0i1lrj C34501 JMP NEXT

DB 8 7H ; (+LOOP)
DB ' (+LOOP'
DB ') '+80H
DW XLOOP-9
DW $+2
POP D ; (DE) <- I N C R
JMP no01

OLE8 8 4 DB 84H ; (DO)


O! EQ 7 8 4 4 4 F DB ' (DO'
O l F C A9 DB ' ) '+80H
O1E.D D801 DW XPLOO- OAH
OIEF F l O l XDO DW $+2
OlFl 2A2801 LHLD RPP ; ( R P ) <- (RP) - 4
01F4 2 B DCX H
(!IF5 213 DCX H
0 1 F 6 2B DCX H
o i F 7 2B DCX H
OiF8 2 2 2 8 0 1 SHLD RPP
OlFR Dl POP D ; ( R 1 ) <- ( S l ) = I N I T INDEX
OlFC 7 3 MOV M,E
liiT*ij 2 3 INX H
OLFE 7 2 MOV M,D
31F'F D l POP D ; ( R 2 ) <- (S2) = L I M I T
G200 2 3 INX H
0 x 1 73 MOV M,E
0202 23 INX H
0 2 0 3 72 MOV MtD
\?l'04C34501 JMP NEXT

DB 81H ; I
DB 'I '+80H
DW XDO- 7
DW $+2 ;(Sl) <- ( R 1 ) , (Rl) UNCHANGED
LHLD RPP
MOV E,M ; (DE) <- ( R 1 )
INX H
MOV D,M
PUSH D ; (SI) <- (DE)
JMP NEXT

DB 85H ; DIGIT
DB 'DIGI'
DB 'T'+80H
DW IDO-4
DIGIT DW $+2
POP H ; (L) <- ( S 1 ) L B = A S C I I CHR TO BE
t CONVERTED
POP ; (DE) <- (S2) = BASE VALUE
MOV
SUI ; I F CHR > "0"
m
CP/M MACRO ASSEM 2.0 to09 8080 FIG-FORTH 1.1 V E R S I O E A 0 1 5 S E P 7 9
0 2 2 9 FEOA CPI OAH ; AND I F CHR > "9"
02LB FA3502 JM DIG11
022E D607 SUI 7
0 2 3 0 FEOA CP I OAH ; AND I F CHR >= "A,"
0 2 3 2 FA4002 JM DIG12
9 ; THEN V A L I D NUMERIC OR ALPHA CHR
0 2 3 5 BD D I G 11 CMP L ; I F < BASE VALUE
0236 F24002 JP DIG12
Y ; THEN V A L I D D I G I T CHR
0239 5F MOV E,A ; ( S 2 ) <- ( D E ) = CONVERTED D I G I T
023A 210100 LXI H, 1 ; ( S 1 ) <- TRUE
023D C34301 JMP DPUSH
9 ; E L S E I N V A L I D D I G I T CHR
0 2 4 0 6C DIG12 MOV L,B ; (HL) <- F A L S E
0241 C34401 JMP HPUSH ; ( S l ) C- F A L S E
3

0244 86 DB 86H ; (FIND) (2-1 )FAILURE


0245 2846494E44 DB '(FIND' ; (2-3)SUCCESS
024A A9 I38 ' ) '+80H
024B 1702 DW DIGIT-8
024D 4F02 DW $+2
324F Dl POP D ; (DE) <- NFA
0250 El POP H ; ( H L ) <- S T R I N G ADDR
9251 E5 PUSH H ; SAVE S T R I N G ADDR FOR NEXT I T E R A T I O N
0252 1A LDAX D
0253 AE XRA M ; CHECK LENGTHS & SMUDGE B I T
025b E 0 3 F AN I 3F H
0 2 5 6 C27B02 J NZ PFIN4 ; LENGTHS DIFFERENT
9 ; LENGTHS MATCH, CHECK EACH CHR
3259 2 3 PFIN2 INX H ; ( H L ) <- ADDR NEXT CHR I N S T R I N G
O2;A 1 3 INX D ; ( D E ) c- ADDR NEST CHR I N NF
0 2 5 B 1A LDAX D
0 2 5 C AE XRA M ; IGNORE MSB
0 2 5 D 87 ADD A
025E C27802 JNZ PFIN3 ; NO MATCH
0201 D25902 mc PF1N2 ; MATCH S O FAR, LOOP AGAIN
0 2 6 4 210500 LXI H,5 ; S T R I N G MATCHES
0267 1 9 DAD D ; ( ( S P ) ) <- PFA
0.268 E 3 XTHL
; BACK UP T O LENGTH BYTE O F N F = NFA
DCX D
LDAX D
O W A
JP PFIN6 ; I F MSB = 1 THEN ( D E ) = NFA
MOV E,A ; ( D E ) <- LEKGTH BYTE
MVI D,O
14x1 11, 1 ; (HL,) <- TRUE
JEfP DPUSH ; RETURN, N F FOUND
ABOVE N F NOT A MATCH, TRY ANOTHER
JC PFINS ; I F NOT END O F NF
INX D ; THEN F I N D END OF N F
L n u D
O M A
<JI' PFIN4
INX D ; ( D E ) <- L F A
XC WG
CP/M MACRO ASSEM 2 . 0 #OlO 8080 FIG-FORTH 1.1 VERSION A 0 1 5 S E P 7 9
0283 5E MOV E,M ; (DE) <- (LFA)
0284 23 INX H
0285 56 MOV D, M
0286 7A MOV A ,D
0287 B3 ORA E ; I F (LFA) o 0
0288 C25002 JNZ PFINl ; THEN TRY PREVIOUS DICT. DEF.
9 ; ELSE END O F DICTIONARY
028B E l POP H ; DISCARD STRING ADDR
028C 2 1 0 0 0 0 LXI H,O ; (HL) <- FALSE
028F C34401 JMP HPUSH ; RETURN, NO MATCH FOUND
9

0292 87 DB 87H ; ENCLOSE


0293 454E434C4F DB 'ENCLOS'
0299 C5 DB 'E'+80H
029A 4402 DW PFIND-9
029C 9E02 ENCL DW $+2
029E Dl POP D ; (DE) <- ( S l ) = DELIMITER CHAR
029F El POP H ; (HL) <- ( S 2 ) = ADDR TEXT TO SCAN
02AO E5 PUSH H ; ( S 4 ) <- ADDR
02AI 7E MOV A,E
02A2 57 MOV DsA ; (D) <- DELIM CHR
02A3 lEFF MVI E,-1 ; I N I T I A L I Z E CHR OFFSET COUNTER
02~15 2 3 DCX H ; (HL) <- ADDR-1
9 ; S K I P OVER LEADING DELIMITER CHRS
ENCL 1 INX H
INR E
CMP M ; I F TEXT CHR = DELIM CHR
JZ ENCL 1 ; THEN LOOP AGAIN
; ELSE NON-DELIM CHR FOUND
MVI D,O ; ( S 3 ) <- (E) = OFFSET TO 1 S T NON-DELIM
PUSH D
MOV D,A ; (D) <- DELIM CHR
MOV A,M ; I F 1 S T NON-DELIM = NULL
ANA A
JNZ ENCL2
MVI DSO ; THEN ( S 2 ) <- OFFSET TO BYTE
INR E ; FOLLOWING NULL
PUSH D
DCR E ; ( S l ) <- OFFSET TO NULL
PUSH D
JMP NEXT
* ; E L S E TEXT CONTAINS NON-DELIM &
, NON-NULL CHR
ENCL2 MOV ; (A) <- DELIM CHR
INX ; (HL) <- ADDR NEXT CHR
INR ; ( E ) <- OFFSET TO NEXT CHR
CMP ; I F NEXT CHR o DELIM CHR
JZ
MOV ; AND I F NEXT CHR <> NULL
ANA
JNZ ; THEN CONTINUE SCAN
9 ; E L S E CHR = NULL
ENCL3 En1 DSO ; ( S 2 ) <- OFFSET TO NULL
PUSH D
PUSH D ; ( S l ) <- OFFSET TO NULL
JMP NEXT
CP/M MACRO ASSEM 2 . 0 8080 FIG-FORTH 1.1 VERSION A0 1 5 S E P 7 9
* ; ELSE CHR = DELfM CUR
0 2 D 1 1600 ENCL4 D, 0 ; ( S 2 ) <- OFFSET TO BYTE
FOLLOWING TEXT
PUSH D
INR E ; ( S l ) <- OFFSET TO 2 BYTES AFTER
END OF WORD
PUSH D
JMP NEXT

84H ; EMIT
EMI'
'T'f 8 0 H
ENCL-OAH
DOCOL
PEMIT
ONE, OUTT
PSTOR, SEMIS

DB 83H ; KEY
02F;D 4I?lt5 DB 'KE'
02EF D 9 DB 'Y0+80H
02F0 9902 DW EM1T- 7
02F2 F402 KEY DW $+2
0 2 F 4 C38616 JMP PKEY
,
C 2 F 7 89 DB 8 9H ; ?TERMINAL
02F8 3F5445524D DB ?TERMINA'
9300 CC DB 'L8+80H
O301 EC02 DW KEY-6
0303 0503 QTERM DW $+2
0305 210000 LXI H,O
d308 C 3 7 8 1 6 &IY PQTER

DB 82H ; CK
DB 'C'
DB 'R0+80H
DW QTERM-OCH
DW $+2
JMP PCR

DB 85H ; CMOVE
DB 'CMOV'
DB 'E'+80H
DW CR-5
CMOVE DW $+2
MOV L, c ; (HL) <- ( I P )
MOV H,3
POP B ; (BC) <- ( S l ) = WCHRS
POP D ; (DE) <- ( S 2 ) = DEST ADDR
XTHL ; (HL) <- ( S 3 ) = SOURCE ADDR
3 ; ( S l ) <- ( I P )
0374 C32C03 JMP ; RETURN I F #CHRS = 0
0327 7E CMOV 1 MOV ; ( ( D E ) ) <- ( ( H L ) j
0328 2 3 INX ; I N C SOURCE ADDR
0329 1 2 STAX
032A 1 3 INX ; I N C DEST ADDR
CP/M MACRO ASSEM 2 . 0 /I012 8080 FIG-FORTH 1.1 VERSION A 0 1 5 S E P 7 9
0 3 2 B OB DCX B ; DEC //CHRS
032C 7 8 CMOV2 MOV A, B
032D B1 ORA C
032E C22703 J NZ CMOV 1 ; REPEAT IF ~ICHRS o o
0331 C 1 POP B ; RESTORE ( I P ) FROM ( S l )
0332 C34501 JMP NEXT

DB 8 2H ; U* 16x16 UNSIGNED MULTIPLY


DB 'U ' ; AVG EXECUTION TIME = 9 9 4 CYCLES
DB '*'+80H
DW WVE-8
USTAR DW $+2
POP D ; (DE) <- M P L I E R
POP H ; (HL) <- MPCAND
PUSH B ; SAVE I P
MOV B,H
MOV A,L ; (BA) <- MPCAND
CALL MPYX ; ( A H L ) l <- MPCAND.LB * M P L I E R
1 S T PARTIAL PRODUCT
PUSH H ; SAVE (HL) 1
MOV H,A
MOV A, B
MOV B ,H ; SAVE ( A ) 1
CALL MPYX ; ( A H L ) 2 <- MPCAND-HB MPLIER *
2ND PARTIAL PRODUCT
POP D ; (DE) <- (HL) 1
MOV C ,D ; (BC) <- ( A H ) l
FORM SUM O F PARTIALS:
(AHL) 1
+
(AHL) 2
--------
(AHLE )
0 3 4 D 09 DAD B ; (HL) <- ( H L ) 2 + ( A H ) l
0 3 4 E CEOO AC I 0 ; (AHLE) <- (BA) *
(DE)
0350 55 MOV D, L
0351 6 C MOV L,H
0352 6 7 MOV H,A ; (HLDE) C- M P L I E R *
MPCAND
0353 C 1 POP B ; RESTORE IP
0354 D5 PUSH D ; ( S 2 ) <- PRODUCT.LW
0355 C 3 4 4 0 1 JMP HPUSH ; ( S l ) <- PRODUCT.HW
9

9 MULTIPLY P R I M I T I V E
? (AHL) C- (A) * (DE)
9 #BITS = 2 4 8 16
0358 210000 MPYX LXI H, 0 ; (HL) C- 0 = PARTIAL PRODUCT.LW
035B OE08 MVI C, 8 ; LOOP COUNTER
035D 29 MPYXl DAD H ; LEFT S H I F T (AHL) 2 4 B I T S
035E 17 RAL
035F D 2 6 5 0 3 JNC MPYX2 ; I F NEXT M P L I E R B I T = 1
0362 19 DAD D ; THEN ADD MPCAND
0363 CEOO ACI 0
0365 OD DCR C ; I F NOT L A S T M P L I E R B I T
0366 C25D03 JNZ MPYXl ; THEN LOOP AGAIN
0369 C9 RET ; E L S E DONE
CP/M MACRO ASSEM 2 . 0 KO13 8080 FIG-FORTH 1.1 VERSION A 0 1 5 S E P 7 9
036B 55 DB 'u '
036C AF DB ' /'+80H
036D 3503 DW U STAR- 5
036F 7103 USLAS DW $+2
0371 210400 LXI H, 4
0374 39 DAD SP ; ( (HL) ) <- NUMERATOR.LW
0375 5E MOV E,M ; (DE) <- NUMER.LW
0376 71 MOV M,C ; SAVE I P ON STACK
0377 23 INX H
0378 56 MOV D,M
0379 70 MOY M,B
037A C1 POP B ; (BC) <- DENOMINATOR
037B El POP H ; (HL) <- NLKR.HW
037C 7D MOV A,L
037D 91 SUB C ; I F NUMER >= DENOM
037E 7C MOV A,H
037F 98 S BB B
0380 DA8C03 JC USLAl
0383 21FFFF LXI H, OFFFFH ; THEN OVERFLOW
0386 llFFFF LXI D ,OFFFFH ; S E T REM & QUOT TO MAX
0389 C3B703 JMP USLA7
038C 3E10 USLAl MY1 A, 16 ; LOOP COUNTER
038E 29 USLA2 DAD H ; L E F T S H I F T (HLDE) THRU CARRY
038F 17 RAL
0390 EB XCHG
0391 29 DAD
0392 D29703 JNC
0 3 9 5 13 INX
0 3 9 6 A7 ANA
0 3 9 7 EB XCHG ; S H I F T DONE
0398 1 F RAR ; RESTORE 1 S T CARRY
0399 F5 PUSH PSW ; SAVE COUNTER
039A D2A603 JNC USLA4 ; I F CARRY = 1
0 3 9 D 7D MOV A ,L ; THEN (HL) <- ( H L ) - (BC)
0 3 9 E 91 SUB C
039F 6F MOV L,A
0 3 A 0 7C MOV A,H
03Al 9 8 SBB B
03A2 6 7 MO V H, A
03A3 C3B103 JMP USLA5
03A6 7D MOV A,L ; E L S E TRY (HL) <- (HL) - (BC)
03A7 9 1 SUB c
03A8 6 F MOV L, A
0 3 A 9 7C MOV A,H
03AA 9 8 SBB B ; (HL) <- PARTIAL REMAINDER
03AB 67 MOV H9A
03AC D 2 B 1 0 3 JNC USLAS
03AF 0 9 DAD B ; UNDERFLOW, RESTORE
03B0 1B DCX D
0 3 B 1 13 INX D ; I N C QUOT
03B2 F 1 POP PSW ; RESTORE COUNTER
0 3 B 3 3D DCR A ; I F COUNTER > 0
03B4 C28E03 JNZ USLA2 ; THEN LOOP AGAIN
03137 C 1 POP B ; E L S E DONE, RESTORE I P
0 3 B 8 E5 PUSH H ; ( S 2 ) <- REMAINDER
03B9 D5 PUSH D ; ( S l ) <- QUOTIENT
#014 8080 FIG-FORTH 1.1 VERSION A0 1 5 S E P 7 9
JMP NEXT

DB 83H ; !LND
DB 'AN'
DB 'D8+80H
DW USLAS-5
ANDD DW $+2 ; ( S I ) <- ( S l ) AND ( S 2 )
POP D
POP H
MOV AYE
ANA L
MOV LYA
MOV A YD
ANA H
MOV H, A
JMP HPUSH

03DO 82 DB 8 2H ; OR
03D1 4F DB '0'
03D2 D2 DB 'R'+80H
0303 BD03 DW ANDD-6
03D5 D703 ORR DW $+2 ; (S1) <- ( S l ) OR ( S 2 )
03D7 Dl POP D
03D8 El POP H
0399 7B MOV A,E
OSDA B5 ORA L
03DB 6F MOV LYA
03DC 7A MOV A ,D
03DD B4 ORA H
03DE 67 MOV HYA
03DF C34401 m HPUSH
Y

03E2 83 DB 83H ; XOR


03E3 584F DB 'XO'
03E5 D2 DB 'R8+80H
03E6 DO03 DW ORR-5
03E8 EA03 XORR DW $+2 ; ( S l ) <- ( S l ) XOR ( S 2 )
O3EA Dl POP D
03EB El POP H
03EC 7B MOV A*E
03ED AD XRA L
03EE 6F MOV L*A
03EF 7A MOV A*D
03F0 AC XRA H
03F1 67 MOV HsA
03F2 C34401 J't'4F' HPUSH
Y
03F5 83 DB 83 H ; SP@
03F6 5350 DB 'SP'
03F8 CO DB '@'+80H
03F9 E203 DW XORR-6
03FB FD03 SPAT DW $+2 ;(Sl) <- (SP)
03FD 210000 LXI Hs 0
0400 39 DAD SP ; (HL) <- (SP)
0401 C34401 JMP HPUSH ; (Sl) C- (HL)
CP/M MACRO ASSEM 2 . 0 NO15 8080 FIG-FORTH 1.1 VERSION A 0 1 5 S E P 7 9
0 4 0 4 83 DB 83H ; STACK POINTER STORE
0 4 0 5 5350 DB 'SP'
0407 A 1 DB ' !'+8OH
0408 F503 DW SPAT-6
C40A OC04 SPSTO DW $+2 ; ( S P ) C- (SO) ( USER VARIABLE )
040C 2A2601 LHLD UP ; (HL) <- USER VAR BASE ADDR
0 4 0 F 110600 LXI D,6
0412 19 DAD D ; (HL) c- SO
0413 5E MOV E,M ; (DE) C- (SO)
0414 23 INX H
0415 56 MOV D, M
0416 EB XCHG
0417 F9 SPHL ; ( S P ) c- (SO)
0418 C34501 JMP NEXT

DB 83H ; RP@
DB 'RP'
DB '@'+80H
DW SPSTO-6
RPAT DW $+2 ;( S l ) <- (RP)
LHLD W P
JMP HPUSK

0429 83 DB 83H ; RETURN STACK POINTER STORE


0 4 2 A 5250 DB 'RP'
042C A1 DB ' !'+80H
042n 1 ~ 0 4 DW RPAT- 6
042F 3104 RPSTO DW $+2 ;(RP) <- (RO) ( USER VARIABLE )
0 4 3 1 2A2601 LHLD UP ; (HL) <- USER VARIABLE BASE ADDR
0 4 3 4 110800 LXI D, 8
0 4 3 7 19 DAD D ; (HL) <- RO
0438 5E MOV E,M ; (DE) <- (RO)
0439 23 INX H
043.4 56 MOV D,M
0 4 3 B EB XCHG
043C 2 2 2 8 0 1 SHLD RPP ; (RP) <- (RO)
043F C34501 JMP NEXT

DB 82H ; ;s
DB ' - 8

DB 'S'+80H
DW RPSTO-6
SEMIS DW $+2 ;(IP) <- ( R l )
LHLD RPP
MOV C ,M ; (BC) <- ( R l )
LNX H
MOV B ,M
INX H
SHLD RPP ; (RP) <- (RP) +2
JMP NEXT

85H ; LEAVE
'L EAV'
'E8+80H
SEMIS-5
LEAVE $+2 ; L I M I T <- INDEX
/I016 8080 FIG-FORTH 1.1 VERSION A 0 1 5 S E P 7 9
LHLD R PP
MOV E, M ; (DE) <- ( R 1 ) = INDEX
INX H
MOV D, M
INX H
MOV M,E ; ( R 2 ) <- (DE) = L I M I T
INX H
MOV MYD
JMP NEXT

DB 8 2H ; >R
DR '>*
DB '~'+80H
DW LEAVE- 8
TOR DW $+2 ; ( R l ) <- ( S l )
POP D ; (DE) <- ( S l )
LHLD RPP
DCX H ; ( R P ) <- (RP) - 2
DCX H
SHLD RPP
MOV M, E
INX H
MOV M ,D
JMP NEXT

DB 8 2H
DB 'R'
DB '>'+80H
DW TOR-5
FROMR DW $+2 ;(Sl) <- ( R l )
LHLD W P
MOV E,M ; (DE) <- ( R l )
INX H
MOV D,M
INX H
S HLD RPP ; ( R P ) <- ( R P ) +2
PUSH D ; ( S l ) <- (DE)
.JMP NEXT

81H ;R
'R0+80H
FROMR- 5
IDW2

DB 82H
DB '0'
DB '='+80H
DW RR-4
ZEQU DW $+2
POP H ; (HL) <- ( S 1 )
MOV A9L
ORA H ; I F (HL) = 0
LXI H, 0 ; THEN (HL) <- FALSE
JNZ ZEQUl
INX H ; E L S E (HL) <- TRUE
ZEQUl JMP HPUSX ; ( S l ) <- (HL)
CP/M MACRO ASSEM 2.0 8080 FIG-FORTH 1.1 VERSION A0 15SEP79
Y
0 4 A 2 82 DB 82H
04B3 30 DB '0'
0 4 8 4 BC DB '<'+80H
04B5 9 E 0 4 DW ZEQU- 5
04B7 B 9 0 4 ZLESS DW $+2
04B5 E l POP H ; (HL) <- ( S l )
OLBA 29 DAD H ; I F (HL) >- 0
O4EB 210000 LXI HYO ; THEN (HL) <- FALSE
OSBE 0 2 C 2 0 4 JNC ZLESl
04C1 23 INX H ; ELSE (HL) <- TRUE
04C2 C 3 4 4 0 1 ZLESl JMP HPUSH ; (Sl) <- (HT.)

DB 8 1H ; +
DB '+'+80H
DW ZLESS-5
PLUS DW $+2 ;(S1) <- ( S l ) + (S2)
POP D
POP H
DAD D
JMP HPUSH

DB 82H ;D+ (4-2)


DB 'D' ; XLW XHW YLW YHW --- SLW SHW
DB '+'+80H ; S4 S3 S2 S1 S2 S i
DW PLUS-4
DPLUS DW $+2
LXI H, 6
DAD SP ; ((HL) ) = XLW
MOV E,M ; (DE) = XL.W
MOV M,C ; SAVE I P ON STACK
INX H
MOV D,M
MOV M,B
POP B ; (BC) <- YHW
POP K ; (HL) <- YLW
DAD D
XCHG ; (DE) <- YLW + XLW = SUM.LW
PO P H ; (HL) <- XHW
MOV AYL
ADC C
MOV L,A ; (HL) <- YHW f XHW + CARRY
MOV A,H
mc B
MOV HYA
POP B ; RESTORE I P
PUSH D ; ( S 2 ) <- SUM-LW
JMP HPUSH ; (Sl) <- SUM-HW

DB 85H ; MINUS
DB 'MINU'
DB 'S'+80H
DW DPLUS-5
MINUS DW $+2 1 ) - - 1 ( 2's COMPLEMENT )
POP H
MOV A,L
C P / M MACRO ASSEM /I018 8080 FIG-FORTH 1.1 VERSION A 0 1 5 S E P 7 9
04i:P 21; CMA
0+'. i;?: 6hf: MOV
!)&F'F 7(: MOV
O5ii)O 2F CMA
0501 6 7 MOV H,A
OSQ2 23 INX H
050'3 C34401 JMP HPUSH

DB 86H ; DMINUS
DB 'DMINU'
DB 'S8+80H
DW MINUS-8
DMINlj DW $+2
POP H ; (HL) <- HW
POP D ; (DE) <- LW
SUB A
SUB E ; (DE) <- 0 - (DE)
MOV E,A
MVI A, 0
SBB D
MOV D,A
MV I A,O
SBB L ; (HL) <- 0 - (HL)
MOV L, A
MVI A,O
S BB H
MOV H,A
PUSH D ; ( S 2 ) <- LW
JMP HPUSH ; ( S l ) <- HW

'i15:?6 84 DB 84H ; OVER


-
K, <: -'7 7 4'7L 764.5 DB 'OVE'
0?,2A I!?. DB 'R'+~OH
0523 0605 DW DMINU- 9
052'3 2FG5 OVER DW $+2
052F Dl POP D
r3:,3.9 El POP H
0531 B5 PUSH H
0532 C34301 JMP DPUSH
>
0435 84 DB 84H ; DROP
0136 4452,4F DB 'DRO'
0539 DO DB 'P'+80H
053A 2605 DW OVER-7
043C 3E05 DROP DW $+2
0 3 EEl POP H
053E C 3 4 5 0 1 JMP NEXT

DB 84H ; SWAP
DB 'S WA'
DB 'P'+80H
DW DROP- 7
SWAP DW $+2
POP H
XTHL
.TMP HPUSH
CP/M MACRO ASSEM 2.0 8080 FIG-FORTH 1.1 VERSION A 0 15SEP79
I

0550 8 3 DB 8 3H ; DUP
3551 4 4 5 5 DB 'DU'
05'53 DO DB 'P0+80H
3554 4 2 0 5 DW SWAP- 7
0556 5 8 0 5 DUP DW $+2
rJ558 E l POP H
0559 E 5 PUSH H
355A C344Ol JHP HPUSH

DB 84H ; 2DUP
DB '2DU0
DB 'P'+80H
DW DUP-6
TDUP DW $+2
POP H
POP D
PUSH D
PUSH H
JMP DPUSH

DB 82H ; PLUS STORE


DB '+'
DB ' !'+80H
DW TDUP- 7
PSTOR DW $+2 ; ( ( S l ) ) <- ( ( S l ) ) + ( S 2 )
POP H ; (HL) <- ( S 1 ) = ADDK
POP D ; (DE) <- ( S 2 ) = INCR
MOV A,M ; ( ( H L ) ) <- ( ( H L ) ) + (DE)
ADD E
MOV M,A
INX H
MOV A,M
ADC D
MOV M,A
mP NEXT

DB 86H ; TOGGLE
DP, 'TOGGL'
DB 'E0+80H
DW PSTOR-5
TOGGL DW $+2 ;((S2)) C- ( ( S 2 ) ) XOR ( S 1 ) L B
POP D ; ( E ) <- BYTE MASK
POP H ; (HL) <- ADDR
MOV A ,M
XRA E
MOV M,A ; (ADDR) <- (ADDR) XQR (E)
JMP NEXT

DB 81H ;@
DB '@'+80H
DW TOGGL-9
DW $+2 ; ( S l ) <- ( ( S l ) )
POP H ; (HL) <- ADDR
MOV E ,M ; (DE) <- (ADDR)
TNX H
CPiM %CKO ASSEM 2 . 0 #020 8080 FIG-FORTH 1.1 VERSION A 0 15SEP79
0531: 56 MOV D*M
0593 D 5 PUSH D ; ( S l ) <- (DE)
059E C 3 4 5 0 1 JMP NEXT

0 5 A l 82 DB 82H ; C@
05.42 4 3 DB 'C'
0 5 A 3 CO DB '@'+80H
05A4 9 3 0 5 DW AT-4
OSA6 A 8 0 5 CAT DW $+2 ; ( S 1 ) <- ( ( S I ) ) L B
0568 El. POP H ; (HL) <- ADDR
05A9 6E MOV L,M ; (HL) <- (ADDR)LB
O%L\ 2500 MVI H, 0
OSrIC C 3 4 4 0 1 JMP HPUSH

DB 8 2H ; 2@
DB '2'
DB '@'+80H
DW CAT-5
TAT DW $+2
POP H ; (HL) <- ADDR HW
LXI D.2
DAD D ; (HL) <- ADDR LW
MOV E,M ; (DE) <- LW
INX H
MOV D9M
PUSH D ; ( S 2 ) <- LW
LXI D,-3 ; (HL) <- ADDR HW
DAD D
MOV EsM ; (DE) <- HW
I NX H
MOV D,M
PUSH D ; ( S l ) <- HW
JMP NEXT

DB 8 1H ; STORE
DB ' ! '+80H
DW TAT- 5
STORE DW $+2 ; ( ( S l ) ) <- ( S 2 )
POP H ; (HL) <- ( S l ) = ADDR
POP D ; (DE) <- ( S 2 ) = VALUE
MOV M, E ; ((HL) <- (DE)
INX W
MOV M,D
JMP NEXT

DB 82H ; C STORE
DB 'C'
DB ' !'+80H
DW STORE-4
CSTOR DW $+2 ;( ( S 1 ) ) L B <- ( S 2 ) L B
POP H ; (HL) <- ( S 1) = ADDR
POP D ; (DE) <- ( S 2 ) = BYTE
MOV M,E ; ( ( H L ) )LB <- ( E l
JMP NEXT

82H ; 2 STORE
CP/M MACRO ASSEM 2.0 #021 8080 FIG-FORTH 1.1 VERSION A0 1 5 S E P 7 9
(15156 32 I)B
0iE7 A1 DB ' !'+80H
05E8 D805 DW CSTOR-5
05EA EC05 TSTOR DW $+2
i)5i.:C El POP H ; (HL) <- ADDR
OSED Dl POP D ; (DE) <- HW
05EE 73 MOV M,E ; (ADDR) <- HW
05EF 23 INX H
05PO 72 MOV M¶D
O5Fl 2 3 INX H ; (HL) <- ADDR LW
05F2 Dl POP D ; (DE) <- LW
05F3 73 MOV M¶E ; (ADDR+2) <- LW
05F.i 23 INX H
05F5 72 MOV M,D
05F6 C34501 JMP NEXT

03F9 C l DB OClH ; :
D5FA BA DB ' :'+80H
CSFB E505 DW TSTOR-5
iI>FD 1106 COLON DW DOCOL
O5FF AA09 DW QEXEC
0601 6509 DW SCSP
0603 9D07 DW CURR
C605 9705 DW AT
0607 9007 DW CONT
0609 CEO5 DW STORE
0609 7FOE DW CREAT
060i) LFOA DW RBRAC
060F 820A DW PSCOD
0611 2A2801 DOCOL LHLD RPP
0614 2H DCX H ; ( R l ) c- (IP)
0515 70 MOV M,B
0615 2B D CX H ; (RP) <- (RP) - 2
G517 71 MOV M,C
0618 222801 SHLD RPP
OS1H 13 TNX D ; (DE) <- CFA+2 = (W)
061C 4B MOV C,E ; (IP) <- (DE) = (W)
OOlD 42 MOV B ,D
061E C34501 JMP NEXT

0621. C1 OClH ; ;
O622 BB ' ;'-t80H
0 6 2 3 F905 COLON-4
0625 1106 SEMI DOCOL
0 6 2 7 D409 QCSP
0 6 2 9 OBOA COW
0628 4 7 0 4 S EM1 S
O 6 2 D 440A SMUDG
Ob2F 210A LBRAC
Ob31 4 7 0 4 SEMIS

84H ; NOOP
'NOO'
'P'+80H
SEMI-&
NOOP DOCOL
CP/M MACRO ASSEM 2 . 0 8080 FIG-FORTH 1.1 VERSION A 0 1 5 S E P 7 9
Oh3C 4 7 0 4 SEMIS
9

0b3F 88 DB 88H ; CONSTANT


063F 434F4E535h DB 'CONSTAN'
0546 D-6 DB 'T8+80H
Oh47 3306 DW NOOP-7
0 6 4 9 1106 CON DW DOCOL
O64B 7F0C DW CREAT
O6iD 440'5. DW SMUDG
064F lF08 DW COMMA
Ohi! 820A DW PSCOD
0653 1 3 I NX D ; (DE) <- P F A
3 h 5 L EH XCHG
3655 5E MOV E,M ; (DE) <- ( P F A )
065b 23 I NX H
0657 56 MOV D,M
06s i i 115 PUSH D
0659 2 3 4 5 3 1 JMP NEXT
>
Oh5C 88 DB 88H ; VARIABLE
Oh5D 5641524941 DB 'VARIABL '
056h C5 DB '~"+80H
l ~ f ) i5 3COO DW CON-OBH
0567 1106 VAR DW DOCOL
0669 4906 DW CON
ObhB 820A DW PSCOD
OhhD 13 DOVAR INX D ; (DE) <- P F A
OhhE D 5 PUSH D ; ( S l ) <- P F A
066F C34501 JMP NEXT
9

DB 84H ; USER
DB 'USE'
DB '~'+80H
DW VAR-OBH
USER DW DOCOL
DW CON
DW PSCOD
DOUSE INX D ; (DE) <- P F A
XCHG
MOV E,M ; (DE) <- USER VARIABLE O F F S E T
MV I D9 Q
LHLD UP ; (HL) <- USER VARIABLE BASE ADDR
DAD D ; (HL) <- (HL) + (DE)
JMP HPUSH ; ( S l ) <- BASE +
OFFSET

0 6 8 B 81 81 H ;0
068C BO '0'+80H
068D 7 2 0 6 USER- 7
068F 4306 ZERO DOCON
0691 0000 0
>
0693 81 81 H ; 1
0694 B1 ' 1'+80H
6695 8B06 ZERO-4
0697 5306 ONE DOCON
0699 0100 1
8080 FIG-FORTH 1.1 VERSION A0 15SEP79

81H ;2
'Z8+80H
ONE-4
TWO DOCON
2
f

81H ;3
'3'+80H
TWO-4
THREE DOCON
3
Y

82H ; BL
'B'
'L8+80H
THREE-4
DOCON
2OH

83H ; C/L ( CHARACTERS/LINE )


#c/'
'L'+80H
BL-5
CSLL DOCON
64
*
85H ; FIRST
'FIRS'
'T8+80H
CSLL-6
FIRST DOCON
BUF 1

85H ; LIMIT
'LIMI'
'T8+80H
FZRST-8
LIMIT DOCON
EM

85H ; B/BUF ( BYTES/BUFFER )


'B/BU'
'F'+80H
LIMIT-8
DOCON
KBBUF
85H ; B/SCR ( BUFFERS/SCREEN )
'B/SC'
'~'+80H
BBUF-8
BSCR DOCON
400H/KBBUF
C P / Y MACRO ASSEM 2 . 0 8080 FIG-FORTH 1.1 VERSION A0 1 5 S E P 7 9
056P 2 0 4 F 5 2 4 9 4 7 'MRIGI'
0 6 F 5 CE 'N8+80H
06F6 E206 BSCR-8
06F8 1 l o b PORIG DOCOL
0 6 7 A 5601 LIT
0 6 F C 0001 ORIG
06FE L904 PLUS
0 7 0 0 470(+ S EM1 S

USER VARIABLES

82H ; SO
'S '
'0 8 + 8 0 H
PORIG-OAH
SZERO DOUSE
6

8 2H ; RO
'R'
'O8+80H
SZERO-5
RL EKO DOUSE
8
9

83H ;TIB
'TI'
'B8+80H
RZERO-5
TIB DOUSE
OAH
9

071D 85 8 5H ; WIDTH
@7!E 57494454 'WIDT'
0722 C8 'H ' OH
0723 1407 TIB-6
0/25 7F06 WIDTH DOUSE
0727 01: OCH
>
0728 87 8 7H ; WARNING
0729 5741524349 'WARNIN'
072F C7 'G0+8OH
0730 1D07 WIDTH- 8
0732 7F06 WARN DOUSE
0734 OE OEH

85H ; FENCE
'FENC'
'E'+80H
WARN-OAH
FENCE DOUSE
1 OH
CP/M MkCRO ASSEM 2.0 8080 FIG-FORTH 1.1 VERSION A 0 15SEP79
0?43 3507 FENCE-8
0 7 4 5 7F06 DP DOUSE
0767 1 2 1 2H
*
UlSt! b8 88H ; VOC-LINK
0749 564F432D4C 'VOC-L IN'
0750 CB 'K0+80H
0751 OOi37 DP- 5
0353 7F06 VOCL DOUSE
0755 1400 14H
9

0 3 5 7 83 838 ; BLK
0751i: 4 2 4 C 'BL'
075A CB 'K'+80H
075B 4807 VOCL-OBH
075D 7FOb BLK DOUSE
G75F 16 16H
9

8 2H ; IN
'1'
'N8+80H
BLK-6
DOUSE
1 8H

83H ; OUT
'OU'
'T'+80H
INN-5
OUTT DOUSE
1AH
7

8 3H ; SCR
'SC'
'R'+80H
OUTT-6
SCR DOUSE
1CH

8 6B ; OFFSET
'OFFSE'
'T'+80H
SCR-6
DOUSE
1EH

87H ; CONTEXT
CONTEX'
'T'+80H
OFSET-9
CONT DOUSE
2OH

87H ; CURRENT
'CURREN*
'T'+80H
CP/M MACRO ASSEM 2 . 0 8080 FIG-FORTH 1.1 VERSION A0 1 5 S E P 7 9
079B 8 6 0 7 CONT-OAH
079D 7F06 CURR DOUSE
0 7 9 F 22 2 2H
Y

07AO 85 85H ; STATE


0781 53544154 'STAT'
07A5 C5 'E8+80H
07A6 9307 CURR-OAH
07.48 7F06 STATE DOUSE
07AA 24 2 4H
Y

DB 84H ; BASE
DB 'BAS '
DB '~'+80H
DW STATE-8
BASE DW DOUSE
DB 2 6H
9

83H ; DPL
'DP'
'L8+80H
BASE- 7
DPL DOUSE
2 8H
9

8 3H ; FLD
'FL'
'D0+80H
DPL-6
FLD DOUSE
2AH

83H ; CSP
'CS'
'P8+80H
FLD- 6
CSPP DOUSE
2CH
9

82H ; R#
'R'
'#'+80H
CSPP-6
DOUSE
2 EH

83H ; HLD
'HL'
'D8+80H
RNUM-5
HLD DOUSE
3OH

END O F USER VARIABLES


CP/M MACRO ASSEM 2.0 #027 8080 FIG-FORTH 1.1 VERSION A 0 1 5 S E P 7 9
07E3 31 DB '1'
07E4 AB DB '+'+80H
07E5 D807 DW HLD- 6
07E7 1106 ONEP DW DOCOL
OiE9 9706 DW ONE
07EB C904 DW PLUS
07ED 4704 DW SEMIS

82H ; 2+
'2'
'+'+80H
ONEP-5
DOCOL
TWO
PLUS
SEMIS

DB 84H ; HERE
DB 'HER'
DB 'E8+80N
DW TWOP-5
HERE DW DOCOL
DW DP
DW AT
DW SEMIS

DB 85H ; ALLOT
DB 'ALLO'
DB 'T8+80H
DW HERE-7
ALLOT DW DOCOL
DW DP
DW PSTOR
DW SEMIS

DB 8 1H 9 s
DB ','+80H
DW ALLOT- 8
COMMA DW DOCOL
DW HERE
DW STORE
DW TWO
DW ALLOT
DW SEMIS

DB 82H ; C.
DB 'C'
DB ' ,'+80H
DW COMMA-4
CCOMM DW DOCOL
DW HERE
DW CSTOR
DW ONE
DW ALLOT
DW SEMIS
CP/M MACRO ASSEM 2 . 0 6028 8080 FIG-FORTH 1.1 VERSION A 0 1 5 S E P 7 9
9 SUBROUTINE USED BY -
AND <
Y ; (HL) <- ( H L ) -
(DE)
0 8 3 C 7D SSUB MOV A,L ; LB
083D 9 3 SUB E
0 8 3 E 6F MOV L,A
0831: 7C MOV A,H
0840 9A SBB D
0 8 4 1 67 MOV H9A
0842 C9 RET

DB 8 1H .-
DB '-*+80H
DW CCOMM-5
SUBB DW $+2
POP D ; (DE) <- (Sl) = Y
POP H ; (HL) <- (S2) = X
CALL SSUB
JMP HPUSH ; (S1) <- X -Y
81H =
'='+80H
SUBB-4
EQUAL DOCOL
SUEB
ZEQU
SEMIS

DB 8 1H ; <
DB '<'+80H ; X < Y
DW EQUAL-4 ; S2 S1
LESS DW $+2
POP D ; (DE) <- ( S l ) Y
POP H ; (HL) <- ( S 2 ) = X
MOV APD ; I F X t Y HAVE SAME SIGNS
XRA H
JM LES 1
CALL SSUB ; (HL) <- X -Y
1NR H ; I F (HL) >= 0
DCR H
JM LES2
LX I H, 0 ; THEN X >= Y
JMP HPUSH ; ( S l ) <- FALSE
LXI Hs 1 ; ELSE X < Y
JMP HPUSH ; ( S l ) C- TRUE

087E 8 2 82H ; UC ( UNSIGNED < !


0 8 7 F 55 'U'
0880 BC '<'+80H
0881 5 D 0 8 LESS-4
0883 1 1 0 6 6 4 0 5 ULESS DOCOL,TDUP
0887 E803B704 XORR,ZLESS
088B 92010C00 ZBRANsULES1-$ ; IF
088F 3C05B704 DROP, ZLESS
0 8 9 3 A304 ZEQU
0895 7 A 0 1 0 6 0 0 BRAN,uLES~-$
0899 4 7 0 8 B 7 0 4 ULESl SUBB,ZLESS ; ELSE
8080 FIG-FORTH 1.1 VERSION A0 15SEP79
SEMIS ; ENDIF

81H ; >
'>'+80H
ULESS-5
GREAT DOCOL
SWAP
LESS
SEMIS
DB 83H ; ROT
DB 'RO'
DB 'T8+80H
DW GREAT-4
ROT DW $+2
POP D
POP H
XTHL
JMP DPUSH

85H ; SPACE
'SPAC'
'E8+8OH
ROT-6
SPACE DOCOL
BL
EMIT
SEM1 S
OEC9 84 84H ; -DUP
08CA 2D4455 '-DU'
08CD DO 'P'+80H
08CE B908 SPACE-8
08DO 1106 DDUP DOCOL
08D2 5605 DUP
08D4 9201 ZBRAN ; IF
08D6 0400 DDUPI-$
08D8 5605 DUP ; ENDIF
08DA 4704 DDUP1 SEM1S
9
08DC 88 88H ; TRAVERSE
08DD 5452415645 'TRAVERS '
OBE4 C5 'E'+80K
08E5 C908 DDUP- 7
08E7 1106 TRAV DOCOL
08E9 4905 SWAP
08EB 2D05 TRAV 1 OVER ; BEGIN
08ED C904 PLUS
08EF 5601 LIT
08Fl 7F00 7FH
08F3 2D05 OVER
08F5 A605 CAT
08F7 6108 LESS
08F9 9201 ZBRAN ; UNTIL
08FB FOFF TRAVI-$
O8FD 4905 SWAP
8080 FIG-FORTH 1.1 VERSION A 0 1 5 S E P 7 9
DROP
SEMIS

86H 9 LATEST
'LATES'
'T8+80H
TRAV-OBH
DOCOL
CURR
AT
AT
SEMIS

8 3H ; LFA
'LF'
'A'+80H
LATES-9
LFA DOCOL
LIT
4
SUBB
SEMI S

83H ; CFA
'CF'
'A'+80H
LFA-6
CFA DOCOL
TKO
SUBB
S EM1 S

0934 83 DB 8 3H ; NFA
0935 4E46 DB 'NF'
0937 C1 DB 'A'+80H
0938 2609 DW CFA-6
093il 1106 NFA DW DOCOL
093C 5601 DW LIT
093E 0500 DW 5
0940 4708 DW SUBB
0942 5601 DW LIT
0944
0946
FFFF
E708
DW -1
DW TRAV
0948 4704 DW SEMIS

83H ; PFA
'PF'
'A8+80H
NFA-6
PFA DOCOL
ONE
TRAV
LIT
5
PLUS
SEMIS
CP/M MACRO ASSEM 2 . 0 8080 FIG-FORTH 1.1 VERSION A 0 1 5 S E P 7 9
9

095E 8 4 84H ; STORE C S P


0 9 5 F 214353 ' !CS*
0462 DO 'P'+80H
0963 4A09 PFA- 6
0965 1106 SCSP DOCOL
0957 FB03 SPAT
0 9 6 9 CD07 CSPP
0 9 6 B CEO5 STORE
0963 4 7 0 4 SEMIS

DB 86H ; ?ERROR
DB ' ?ERRO'
DB 'R'+80H
DW SCSP-7
QERR DW DOCOL
DW SWAP
DW ZBRAN ; IF
DW QERRI-$
DW ERROR
DW BRAN ; ELSE
DW QERR2-$
QERRl DW DROP ; ENDIF
QERR2 DW SEMIS
P

DB 85H ; ?COMP
DB '?C0M0
DB 'P'+80H
DW QERR- 9
QCOMP DW DOCOL
DW STATE
DW AT
DW ZEQU
DW LIT
DW 11H
DW QERR
DW SEMIS

DB 85H ; ?EXEC
DB '?EXE'
DB 'C8+80H
DW QCOMP-8
QEXEC DW DOCOL
DW STATE
DW AT
DW LIT
DW 12H
DW QERR
DW SEMIS

DB 86H ; ?PAIRS
DB '?PAIR'
DB 'S8+808
DW QEXEC-8
QPAIH DW DOCOL
DW SUBB
CP/M MACRO ASSEM 2 . 0 8080 FIG-FORTH 1.1 VERSION A 0 1 5 S E P 7 9
09C5 5601 LIT
09C7 1300 13H
09C9 7809 Q ERR
09CB 4704 SEMIS

84H ; ?CSP
'? C S O
'P0+80H
QPAIR-9
DOCOL
SPAT
CSPP
AT
SUBB
LIT
14H
QERR
S EM1 S

88 H ; ?LOADING
09E7 3F4C4F4144 ' ?LOADIN'
09EE C 7 'G0+80H
09CF C D 0 9 QCSP-7
09F1 1106 DOCOL
C9F3 5D07 BLK
09F5 9705 AT
09F7 A304 ZEQU
09F9 5601 LIT
0 9 F B 1600 16H
09FD 7 8 0 9 QERR
C19FF 4 7 0 4 SEMIS
9

OAOl 87 8 7H ; COMPILE
0A02 434F4D5049 'COMPIL'
@A08 C5 'E'+80H
OAO9 E609 QLOAD-OBH
OAOB 1106 DOCOL
OAOD 9209 QCOMP
OAOF 8804 FROMR
OAll 5605 DUP
OA13 F407 TWOP
OA15 7204 TOR
OA17 9705 AT
OA19 1F08 COMMA
OAlB 4704 SEMIS

OAlD C1 DB OClH ; [
OAlE DR DB ' [ '+80H
OAlF OlOA DW corn- OAH
OA21 1106 LBRAC DW DOCOL
OA23 8F06 DW ZERO
OA25 A807 DW STATE
OA27 CEO5 DW STORE
OA29 4704 DW SEMIS
CP/M MACRO ASSEM 2 . 0 8080 FIG-FORTH 1.1 VERSION A 0 1 5 S E P 7 9
OA2C DD ' ] '+80H
OA2D lDOA LBRAC-4
OA2F 1106 RBRAC DOCOL
OA31 5 6 0 1 C 0 0 0 L I T , OCOH
0.435 A 8 0 7 C E 0 5 STATE, STORE
OA75 4 7 0 4 SEMIS
*
OA3B 86 86H ; SMUDGE
OA3C 534D554447 'SMUDG'
OA41 CS 'E'+80H
OA42 2BOA RBRAC-4
Oh44 1106 SMUDG DOCOL
OA46 OC09 LATES
C A 4 8 5601 LIT
OA4A 2000 2 OH
CA4G 8905 TOGGL
OA4E 4 7 0 4 SEMIS

3A50 83 83H ; HEX


OA5L 4845 'HE*
OA53 D8 'X'+8OH
OA54 3BOA SMUDG-9
OA56 1106 HEX DOCOL
OA58 5501 LIT
3fi5A LO00 1OH
OA5C B207 BASE
OA>E CEO5 STORE
L'ii69 4 7 0 4 S EM1 S
9

OA62 87 8 7H ; DECIMAL
UA63 4 4 4 5 4 3 4 9 4 D 'DECIMA'
OA69 CC 'L0+80H
OA6A 5 0 0 A HEX-6
OA6C 1106 DEC DOCOL
OA6E 5601 LIT
0 A 7 0 OAOO OAH
0 A 7 2 I3207 BASE
ok74 CEO5 STORE
On16 4 7 0 4 S EM1S

87H ; (;CODE)
' ( ;CODE'
' ) '+80H
D EC- OAH
PSCOD DOCOL
FROMR
LATES
PFA
CFA
STORE
SEMIS

OC5H ; ;CODE
' ;COD0
'E0+80H
P SCOD-OAH
CP/M MACRO ASSEM 2 . 0 8080 FIG-FORTH 1.1 VERSION A 0 1 5 S E P 7 9
OA98 1 1 0 6 SEMIC DOCOL
O A ~ AD 4 0 9 QCSP
OA9C OBOA corn
OA9E 8 2 0 A PSCOD
!)AX0 2 1 0 A LBRAC
O M 2 3A06 SEMI 1 NOoP ; ( ASSEMBLER )
OAA4 4 7 0 4 SEMIS
9

OAh6 87 87H ; <BUILDS


OAA7 3C4255494C '<BUILD'
OAAD D3 'S'+80H
Oh\E YOOA SEMIC-8
OAR0 1106 BUILD DOCOL
OAB2 8F06 ZERO
OAB4 4906 CON
OAB6 4704 SEMIS

OAB8 85 DB 85H ; DOES>


OAB9 444F4553 DB 'DOES'
OABD BE DB '>'+80H
OABE A60A DW BU ILD-OAH
OAC9 1106 DOES DW DOCOL
OAC2 8804 DW FROMR
OAC4 OC09 DW LATES
9AC6 5009 DW PFA
OAC8 CEO5 DW STORE
CACA 820A DW PSCOD
OACC 2A2801 DODOE LHLD RPP ; (HL) <- ( R P )
OXCF 2B DCX H
OADO 70 MOV MsB ; ( R l ) <- ( I P ) I P F A = [SUBSTITUTE CFA)
0AD1 2B DCX H
DAD2 71 MOV M,C
OAD3
OAD6
222801
13
SHLD
INX
RPP ; ( R P ) <- ( R P ) -2
D ; (DE) <- P F A a (SUBSTITUTE CFA)
0-7 EB XCHG
0AD8 4E MOV C ,M ; ( I P ) <- (SUBSTITUTE CFA)
OAD9 23 INX H
OADA 46 MOV B ,M
OADB 23 INX H
OADC C34401 JMP HPUSH ; ( S l ) <- PFA+2.= SUBSTITUTE P F A

OADF 85 8 5H ; COUNT
OAEO 434F554E 'COUN'
OAE4 D4 'T8+80H
OAE5 B80A DOES-8
OAE7 1106 COUNT DOCOL
OAE9 5605 DUP
OAEB E707 ONEP
OAED 4905 SWAP
OAEF A605 CAT
OAF1 4704 SEMIS

OAF3 84 84H ; TYPE


OAF4 545950 'TYP'
OAF7 C5 'E8+80H
OAF8 DFOA COUNT-8
CP/M MACRO ASSEM 2.0 8080 FIG-FORTH 1.1 VERSION A 0 1 5 S E P 7 9
OAFA 1106 TYPE DOCOL
OAFC DO08 DDUP
OAFE 9 2 0 1 ZBRAN ; IF
OBOC 1800 TYPE1-$
OB02 2 D 0 5 OVER
OB04 C 9 0 4 PLUS
OB06 4 9 0 5 SWAP
OB08 E F O l XDO ; DO
OBOA OB02 ID0
OBOC A 6 0 5 CAT
OBOE E 0 0 2 EMIT
OBlO A S 0 1 XLOOP ; LOOP
0812 F8FF TYPE2-$
O B 1 4 7A01 BRAN ; ELSE
OBI6 Oh00 TYPE3-$
OBI8 3C05 TYPE1 DROP ; ENDIF
DBlA 4 7 0 4 TYPE3 SEMI S
9

OdiC, 8 9 8 9H ; -TRAILING
OWlD 2D5h524149 *-TRAILIN'
OB25 C7 'G'+80~
OB26 F30A TYPE- 7
OR28 11116 DTRAl DOCOL
OHLA 5605 DUP
OU2C 8h0h ZERO
2B2E EPOl XDO ; DO
OH3d 2D05 DTRAl OVER
;I332 2D05 OVER
OH34 C904 PLUS
OB36 9706 ONE
OB38 4708 SUBB
0B3A A605 CAT
OB3C E006 BL
OB3E 4708 SUBB
0840 9201 ZBRAN ; IF
OB4L 080U DTRA2-$
OB44 5EO4 LEAVE
0546 7A01 BRAN ; ELSE
OB48 0600 DTRA3-$
OH4A o706 ONE
0H4C 4708 SUBB ; ENDIF
OUhE A8121 XLOOP ; LOOP
OB5C EOFF DTRAl-$
OB52 $704 S EM1 S

(="'
' ) '+80H
DTKAI-OCH
DOCOL
KR
COUNT
DUP
ONEP
FROM.
PLUS
C P / M MACRO ASSEM 2 . 0 8080 FIG-FORTH 1.1 V E R S I O N A 0 1 5 S E P 7 9
OBh9 7 2 0 4 TOR
OB6B FAOA TYPE
OB6D 4 7 0 4 SEMIS

OB6F C 2 OC2H ; a 1 '


' I
O B 7 0 2E
O R 7 1 A2 '"'+80H
OR72 5 4 0 8 PDOTQ- 7
O B 7 4 1106 DOTQ DOCOL
0 8 7 6 5601 LIT
OB78 2 2 0 9 2 2H
05 7A A 8 0 7 STATE
OB7C 9 7 0 5 AT
OR7E 9 2 0 1 ZBRAN ; IF
OB80 1 4 0 0 DOTQ1-$
O B 8 2 OBOA corn
OB84 5B0B PDOTQ
OB86 E50C WORD
O B 8 8 0308 HERE
OB8A A 6 0 5 CAT
OB8C E 7 0 1 ONEP
OB8E 1308 ALLOT
O R 3 0 7AOI BRAN ; ELSE
O B 9 2 OAOO DOTQ2-$
OE94 E50C DOTQ 1 WORD
9B96 0 3 0 8 HERE
O E 9 8 E7OA COUNT
OB9A FAOA TYPE ; ENDIF
OIi9C 4 7 0 4 DOTQ2 SEMI S
3

OB9E 86 86H ; EXPECT


OB9F 4558504543 'EXPEC'
ORX4 D4 'T'+80H
0BA5 6FOB DOTQ-5
OBA7 1106 EXPEC DOCOL
IlSA9 2005 OVER
OBAB C904 PLUS
OEAD 2D05 OVER
OBAF EFOl XDO ; DO
OBBl F202 EXPEl KEY
OBB3 5605 DUP
OBB5 5601 LIT
ORB7 OEOO OEH
OBB9 F806 PORIG
OBBB 9705 AT
OBBD 5508 EQUAL
OBBF 9201 ZBRAN ; IF
OBCl 2A00 EXPE2-$
OBC3 3C05 DROP
OBC5 5605 DUP
OBC7 OB02 ID0
OBC9 5508 EQUAL
OBCB 5605 DUP
OBCD 8804 FROMR
OBCF 9F06 TWO
OBDl 4708 SUBB
CP/M MACRO ASSEM 2 . 0 8080 FIG-FORTH 1.1 VERSION A0 1 5 S E P 7 9
OBD3 C 9 0 4 PLUS
OBU5 7 2 0 4 TOR
OBD7 9 2 0 1 %BRAN ; IF
OBD9 OAOO EXPEG-$
OBDB 5 6 2 1 LIT
OBDD 0 7 0 0 BELL
GBDF 7 A O l BRAN ; ELSE
O B E l 0600 EXPE 7-$
OBE3 5 6 0 1 EXPE 6 LIT
OBE5 0800 BSOUT ; ENDIF
OSE7 7AO1 EXPE7 BRAN ; ELSE
OBE9 2 8 0 0 EXPE3-$
OBE3 50U5 EXPE2 DUP
OBED 560i LIT
OBEF OD00 ODH
O B F l 5508 EQUAL
0RF3 9 2 0 1 ZBRAN ; IF
DBF5 OEOO EXPE4-$
OBF7 5 E 0 4 LEAVE
OUF9 3C05 I)IIO P
ORFH BOO6 BL
OBFU 8 F 0 6 ZERO
OBPF 7 A G l BRAN ; ELSE
OCOl 0 4 0 0 EXPE5-$
OCO3 5 6 0 5 DUP ; ENDIF
C C 0 5 OB02 ID0
0CO7 DDO5 CSTOR
9 C 0 9 SF06 ZERO
OCOB O n 0 2 ID0
OCOD E 7 G 7 ONEP
OCOF CEO5 STORE ; ENDIF
OCll E002 EYIT
OC13 ~'801 XLOOP ; LOOP
O C 1 5 BCFF EXPE 1-$
0C17 3C05 DROP
OC19 4 7 0 4 SEM1 S

O C l H 85 85H ; QUERY
OCJC 51554552 'QUER'
OC20 n9 "r"+80H
OC21 9EOB EXPEC- 9
OC23 11'36 DOCOL
OC25 1A07 TI8
0C27 9705 AT
OC29 5691 LIT
OC2B 5008 SOH
OC2D A70B EXPEC
OC2F 8F0b ZERO
OC31 6507 INN
OC33 CEO5 STORE
OC35 4704 SEMIS

OClH ; 0 (NULL)
80H
QUERY-8
DOCOL
CP/M MACRO ASSEM 2.0 038 8 0 8 0 FIG-FORTH 1.1 VERSION A0 15SEP79
OC3D 5D07 DW BLK
Or:3F 9705 DW AT
OC41 9.201 DW ZBRAN ; IF
OC43 2A00 DW NlJLL 1-$
OC45 9/36 DW ONE
CC47 5rO7 DW BLK
OC49 7205 DW PSTOR
O C 4 P 8F06 DW ZERO
OC4D 6 5 0 7 DW INN
OC4F CEO5 DW STORE
OC51 TiY'q7 nw BLK
OC53 9705 DW AT
OC55 LAO6 DW BSCR
Or57 9 0 b DW ONE
OC59 14 138 DW SUBB
OC5B C 3 0 3 DW ANDD
OC5D A304 DW ZEQU
9C5F 9201 DW ZBRAN ; IF
O C 6 1 ObOO DW NULL2-$
OC63 AA09 DW QEXEC
OC65 8 8 0 4 DW FROMR
OC67 3r05 DW DROP ; ENDIF
OC69 7101 DW BRAN ; ELSE
OChB OoOO DW NULL3-$
?COD 81104 DW FROMR
OC6F 1C05 DW DROP ; ENDIF
oc71 4 7 q 4 DW SEMIS

DB 84H ; FILL
DB 'FIL'
DB 'L'+80H
DW NULL-4
FILL DW $+2
MOV L,C
MOV H, B
POP D
POP B
XTHL
XCHG
MOV A, B ; BEGIN
ORA C
Jz FILL2 ; WHILE
MOV A,L
STAX D
INX D
DCX B
JMP FILLl ; REPEAT
POP B
JMP NEXT

8 5H ; ERASE
'ERAS '
'E8+80H
FILL- 7
DOCOL
ZERO
CP/M MACRO ASSEM 2 . 0 8080 FIG-FORTH 1.1 VERSION AO 1 5 S E P 7 9
OC9E 7AOC E'ILL
OCAO 4 7 0 4 SEMIS
Y

OCA2 86 86H ; BLANKS


OCA3 424C414E4B 'BLANK'
OCA8 D3 'S'+80H
OCA9 920C ERASEE- 8
OCAB 1106 BLANK DOCOL
OCAD BOO6 BL
OCAF 7AOC FILL
OCBl 4704 S EM1 S

OCB3 84 84H ; HOLD


OCB4 484F4C 'HOL'
OCB7 C4 'D'+80H
OCB8 A20C BLANK- 9
OCUA 1 1 0 6 HOLD DOCOL
OCOC 5 6 0 1 LIT
@CUE FFFF -1
OCCS D E 0 7 WT,D
OCC2 7 1 0 5 PSTOR
OCC4 D E 0 7 HLD
OCC6 9705 AT
OCC8 2905 CSTOR
OCCA 4 7 0 4 SEMIS

OCCC 83 8 3H ; PAD
OCCD 5041 'PA'
OCCP C4 'D'+80H
OCDO B30C HOLD- 7
OCD2 1106 PAD DOCOL
OCD4 0308 HERE
OCU6 5601 LIT
OCD8 4400 44H
OCDA 11004 PLUS
OCDC 4704 SEMIS

OCDE 84 84H ; WORD


OCDF 574F52 'WOR'
OCE2 C4 'D'+80H
OCE3 CCOC PAD-6
OCE5 i106 WORD DOCOL
OCE7 5D07 BLK
OC1<9 4705 AT
OCEB 9201 ZBRAN ; IF
OCED OCOO WORDI-$
OCEF 5D07 BLK
OCFl 9705 AT
OCF3 2114 YLOCK
QCFS 7,401 BRAN ; ELSE
OCF7 Go00 wom2-$
OCF9 1A07 WOKD I TIB
OCFB 9705 AT ; ENDIF
OCFD 6507 WORD 2 INN
OCFF 9/05 AT
ODOJ C904 PLUS
CP/M MACRO ASSEM 2 . 0 8080 FIG-FORTH 1.1 VERSION A 0 1 5 S E P 7 9
OD03 4905 SWAP
OD05 9 C 0 2 ENCI,
0 3 0 7 0308 HERE
OD09 5 6 0 1 LIT
OD013 2 2 0 0 2 2H
ODOD ABOC BLANK
ODOF 6 5 0 7 INN
OD11 7 2 0 5 P STOR
OD13 2 D 0 5 OVER
O D 1 5 4708 SUBB
OD1 7 7 2 0 4 TOR
OD19 9 C 0 4 RR
O D l B 0308 HERE
ODlD DD05 CSTOR
ODlF C 9 0 4 PLUS
OD2i 0 3 0 8 HERE
OD23 E ? 0 7 ONEP
OD25 8 8 0 4 FROMR
OD27 I D 0 3 CMOVE
OD29 i 7 0 4 S EM1 S
9

OD20 88 88H ; (NUMBER)


OD2C 284E554D42 * (NUMBER'
OD33 A9 ' ) '+80H
OD34 DEOC WORD- 7
OD36 1106 PNLWB DOCOL
038 E707 PNUMl ONEP ;BEGIN
OD3A 5605 DUP
OD3C 7204 TOR
OD3E Ab05 CAT
3D40 B207 BASE
OD42 9705 AT
OD44 1F02 DIGIT
OD46 9201 ZBRAN ; WHILE
3D48 2C00 PNUM2-$
0D4A 4905 SWAP
OD4C B207 BASE
OD4E 9705 AT
OD50 3A03 USTAR
OD52 3C05 DROP
OD54 B!08 ROT
OD56 B207 BASE
OD58 9705 AT
OD5A 3A03 U STAR
OD5C D604 DPLUS
OD5E BB07 DPL
OD60 9705 AT
OD62 E707 ONEP
OD64 9201 ZBRAN ; IF
!ID66 0800 PNUM3-$
OD68 9706 ONE
OD6A BB07 DPL
OD6C 7205 PSTQR ; ENDIF
OD6E 8804 FROMR
OD70 7A01 BRAN ; REPEAT
OD72 C6FF PNUM1-$
CP/M MACRO ASSEM 2 . 0 8080 FIG-FORTH 1.1 V E R S I O N A 0 1 5 S E P 7 9
8 ~ 7 48804 PNUM2 FROMR
OD76 4 7 0 4 SEMIS
9

O D 7 8 86 DB 86H ; NUMBER
OD79 4 E 5 5 4 D 4 2 4 5 DB 'NUMBE'
OD7E D 2 DB 'R'+80H
OD7F 2BOD DW PNUMB-OBH
O D 8 1 1106 NUMB DW DOCOL
OD83 8 F 0 6 DW ZERO
O D 8 5 8F06 DW ZERO
OD87 B 1 0 8 DW ROT
O D 8 9 5605 DW DUP
OD8E E 7 0 7 D'W ONEP
OD8D A 6 0 5 DW CAT
OD8F 5601 DW LIT
OD91 2 D 0 0 DW 2DH
O D 9 3 5508 DW EQUAL
OD95 5 6 0 5 DW DUP
OD97 7 2 0 4 DW TOR
OD99 C 9 0 4 DW PLUS
OD9B 5 6 0 1 DW LIT
OD9D F F F F DW - 1
OD9F BB0 7 NUMB 1 DW DPL ; BEGIN
ODAl C E O 5 DW STORE
ODA3 3 6 0 D DW PNUMB
ODA5 5605 DW DUP
ODA7 A605 DW CAT
ODA9 BOO6 DW BL
DDAB 4 7 0 8 DW SUBB
ODAD 9 2 0 1 Dw ZBRAN ; WHILE
ODAF 1 6 0 0 DW NUMB2-$
ODBl 5605 DW DUP
ODB3 A 6 0 5 DW CAT
ODB5 5 6 0 1 nw LIT
ODB7 2 E 0 0 DW 2EH
ODB9 4 7 0 8 DW SUBB
ODBB 8 F O 4 DW ZERO
ODBD 7 8 0 9 I)W QERR
ODBF 8F06 DW ZERO
ODCl 7 A 0 l DW BRAN ; REPEAT
ODC3 D C F F DW NUMB1-$
ODC5 3 C 0 5 NUMB 2 DW DROP
ODC7 8804 DW FROMR
ODC9 9 2 0 1 DW ZBRAN ; IF
ODCB 0 4 0 0 I)W NUMB3-$
ODCD O F 0 5 DW DMINU ; ENDIF
ODCF 4 7 0 4 DW SEMIS

9DD1 85 ; - F I N D (0-3) S U C C E S S
ODD2 2D46494E ; (0-1) F A I L U R E
ODD6 C4
ODD7 780D NUMB- 9
ODD9 1106 DOCOL
ODDS ROO6 BL
ODDD E50C WORD
ODDF 0308 HERE
C P / M MACRO ASSEM 2 . 0 8080 FIG-FORTH 1.1 VERSION A0 1 5 S E P 7 9
ODE1 9 0 0 7 CONT
ODE3 9 7 0 5 AT
ODE5 9 7 0 5 AT
ODE7 4D02 PFIND
GDE9 5 6 0 5 DUP
ODEB A 3 0 4 ZEQU
ODED 9201 ZBRAN ; IF
ODEF OkOO DFINI-$
ODFl 3C05 DROP
ODE3 0 3 0 8 HERE
ODFS CC09 LATES
O D F 41102
~ PFIND ; ENDIF
ODF9 4 7 0 4 DFIN l SEMIS
9

ODFB 87 8 7H ; (ABORT)
ODFC 2 3 4 14 2 4 F 5 2 ' /ABORT'
OEO? A9 ' ) '+80H
OE03 DlOD DFIND-8
OE05 1106 PABOR DOCOL
OE07 5810 ABORT
OE09 4704 S EM1 S

OEOB 85 DB 85H ; ERROR*


OEOC 4552524F DB 'ERRO'
OElO D2 DB 'R0+80H
OEll FBOD DW PABOR-OAH
OE13 1106 ERROR DW DOCOL
OE15 3207 DW WARN
OE17 9705 DW AT
OE19 B704 DW ZLESS
OElB 9201 DW ZBRAN ; IF
OElD 0400 DW ERR0 1-$
OElP 050E DW PABOR ; ENDIF
OE21 0308 ERRO 1 DW HERE
OE23 EiOA DW COUNT
OE25 FAOA DW TYPE
OE27 5BOB DW PDOTQ
OE29 02 DB 2
OE2A 3F20 DB *? l

OE2C 7012 DW MESS


OE2E OA04 DW SPSTO
Y CHANGE FROM F I G MODEL
9 DW INN,AT,BLK,AT
OE30 5D079705 DW BLK, AT
OE34 DO08 DW DDUP
OE36 92010800 DW ZBRAN,ERROP-$ ; IF
OE3A 65079705 DW I N N , AT
OE3E 4905 DW SWAP ; ENDIF
OE40 2310 DW QUIT

OE42 63 83H ; ID.


OE43 4944 'ID8
OE45 AE .
' '+80H
ERROR-8
OE46 OBOE
OE48 1106 IDDOT DOCOL
OE4A D20C PAD
CP/M MACRO ASSEM 2 . 0 8080 FIG-FORTH 1.1 VERSION A0 1 5 S E P 7 9
OE4C 5601 LIT
OE4E 2 0 0 0 2 OH
O E 5 0 5601 LIT
OE52 5 F 0 0 5FH
O E 5 4 7AOC FILL
O E 5 6 5605 DUP
O E 5 8 5009 PFA
OE5A 1 C 0 9 LFA
OE5C 2 D 0 5 OVER
OE5E 4 7 0 8 SUBB
O E 6 0 D20C PAD
OE62 4 9 0 5 SWAP
OE64 I D 0 3 CMOVE
O E 6 6 D20C PAD
OE68 E70A COUNT
OE6A 5601 LIT
OE6C lFOO 1FH
OE6E C 3 0 3 ANDD
O E 7 0 FAOA TYPE
OE72 C 1 0 8 SPACE
OE74 4 7 0 4 SEMIS
9
OE76 8 6 8 6H ; CREATE
OE77 4 3 5 2 4 5 4 1 5 4 'CREAT l
OE7C C 5 'E8+80H
OE7D 4 2 0 E IDDOT-6
O E 7 P 1106 CREAT DOCOL
OE8! D90D DFIND
OE83 9 2 0 1 ZBRAN ; IF
O E 8 5 1000 CREAL-$
OE87 3 C 0 5 DROP
OE89 3A09 NFA
OE8B 4 8 0 E IDDOT
OE8D 5601 LIT
0E8F 0400 4
OE91 7 0 1 2 MESS
OE93 C 1 0 8 SPACE ; ENDIF
O E 9 5 0308 HERE
O E 9 7 5605 DUP
OE99 A605 CAT
OE9B 2 5 0 7 WIDTH
OE9D 9 7 0 5 AT
OE9F 4 9 1 1 MIN
OEAl E 7 0 7 ONEP
OEA3 1308 ALLOT
OEA5 5605 DUP
OEA7 5601 LIT
OEA9 A 0 0 0 OAOH
OEAB 8905 TOGGL
OEAU 0308 HERE
OEAF 9 7 0 6 ONE
OEBl 4 7 0 8 SUBB
OEB3 5601 LIT
OEB5 8000 8OH
OEB7 8905 TOGGL
OER9 O C 0 9 LATES
C P / M MACRO ASSEM 2.0 8 0 8 0 FIG-FORTH 1. 1 VERSION A0 15SEP79
OEBB 1F08 COMMA
OEBG 9D07 CURR
OEBF 9705 AT
OECl CEO5 STORE
OEC3 0308 HERE
OECS F407 TWOP
O E C 7 1F08 COMMA
OEC9 4704 S EM1S
9

OECR (19 OC9H ; [COMPILE]


OECC 5B434F4D50 [COMPILE'
OED4 DD 'I '+80H
OED5 760E CREAT-9
OED7 1106 BCOMP DOCOL
3ED9 b90D . DFIND
OEDB A304 ZEQU
5EDD 8F06 ZERO
OEDF 7309 QERR
OEEl 3C05 DROP
GEE3 2C09 CFA
OEE5 lF08 COMMA
OEE,7 L704 SEMIS
>
OEE9 C7 OC7H ; LITERAL
OEEA 4C49544552 'LITERA'
OEFO CC 'L'+80H
OEFl CBOE BCOMP-OCH
OEF3 !1 0 6 LITER DOCOL
OEF5 A807 STATE
OEF7 9705 AT
OEF9 3201 ZBRAN ; IF
OEFB 0800 LITEI-$
OEFII OBOA COMP
OEPF 5601 LIT
OF01 IF08 COMMA ; ENDIF
OF03 4704 LITE 1 SEMIS
Y

OF05 C8 OC8H ; DLITERAL


OF06 444C495445 'DLITERA'
OFOD CC 'L'f 80H
@FOE E90E L ITER-OAH
OF10 1 1 0 6 DLITE DOCOL
OF12 A807 STATE
OF14 9 7 0 5 AT
OF16 9 2 0 1 ZBRAN ; IF
OF18 0 8 0 0 DLIT1-$
O F l A 4905 SWAP
OFlC F30E LITER
OFlE F30E LITER ; ENDIF
OF20 4 7 0 4 DLIT1 SEMIS
9

OF22 86 86H ; ?STACK


OF23 3F53544143 '?STAC8
OF28 CB 'K8+80H
OF29 050F DLITE-OBH
OF2B 1106 QSTAC DOCOL
CP/M MACRO ASSEM 2.0 8 0 8 0 FIG-FORTH 1.1 VERSION A0 15SEP79
OF2D FRO3 SPAT
OF2F 0707 SZERO
OF31 9705 AT
OF33 4905 SWAP
OF35 8308 ULESS
OF37 9706 ONE
OF39 7809 QERR
OF3B FB03 SPAT
OF3D 0308 HERE
OF3F 5601 LIT
OF41 8000 8OH
OF43 C904 PLUS
OF45 8308 ULESS
OF47 5601 LIT
OF49 0700 7
OF4B 7809 QERR
OF4D 4704 SEMIS
7
OF4F 8 9 89H ; INTERPRET
OF50 4945544552 'INTERPRE'
OF58 D4 'T8+80H
OF59 220F QSTAC-9
OF5B 1106 INTER DOCOL
OFSD 59OD INTEl DFLND ; BEGIN
OF5F 9201 ZBRAN ; IF
OF61 lEOO INTE2-$
OF63 A807 STATE
OF65 9705 AT
OF67 6108 LESS
OF69 9201 ZBRAN ;IF
OF6B 0.400 INTE3-$
OF6D 2C09 CFA
OF6F 1FG8 COMMA
OF71 7A01 BRAN ; ELSE
OF73 0600 INTE4-$
OF75 2C09 INTE3 CFA
OF77 6B01 EXEC ; ENDIF
OF79 2BOF INTE4 QSTAC
OF7B 7A01 BRAN ; ELSE
OF7D lCOO INTE5-$
OF7F 0 3 0 8 HERE
OF81 810D NUMB
OF83 BB07 DPL
OF85 9705 AT
OF87 E707 ONEP
OF89 9201 ZBRAN ; IF
OP8B 0 8 0 0 INTE6-$
OF8D lOOF DLITE
OFSF 7A01 BRAN ; ELSE
OF91 0600 INTE7-$
OF93 3C05 DROP
OF95 F30E LITER ; ENDIF
OF97 2BOF QSTAC ; ENDIF
OF99 7k01 BRAN ; AGAIN
OF93 C2FF INTE1-$
C P / N MACRO ASSEM 2 . 0 C046 8080 FIG-FORTH 1.1 V E R S I O N A 0 1 5 S E P 7 9
OFYD 89 DB 89H ; IMMEDIATE
OF9E 494114D4544 DB 'ZMMED ZAT '
OFAb C5 DB 'E8-i-80H
OFA7 4FOF DW I WTER-0CH
OFAY 1106 IMMED DW DOCOL
OE'AB OC09 DW LATE S
OFAD 5601 DW LIT
UFAF 40'30 DW 4 OH
OFHl 8905 DW TOGGL
OFB3 4104 DW S EM1 S
3

OFH5 8A DB 8AK ; VOCABULARY


OF56 564F434142 DB 'VOCABULAR'
OFBF D9 DB 'Y8+80H
OFCO 9DOF DW IMMED-OCH
OFC2 1106 VOCAB DW DQCOL
OFCL BOOA DW BU LLD
OFC6 5601 DW LIT
OFC8 81AO DW OA081H
OFCA 1FG8 DW COMMA
OFCC 9 D 3 7 DW cum
OFCf7 9 i n 5 DW AT
OF!)rJ 2 C 3 9 UW CFA
OFD2 IF08 DW COMMA
OFD4 0308 DW HERE
OFD6 5307 DW VOCL
OFD8 9705 DW AT
OFDA 1FU8 DW COMMA
OFDC 5307 DW VOCL
OFDE CEO5 DW STORE
OFEO COOA DW DOES
OFE2 F407 DOVOC DW TWOP
OFE4 9007 DW CONT
OFE6 CEO5 DW STORE
OFE8 4704 DW S EM1 S

OFEh C5 DB OC5H ; FORTH


GFEB 4 0 4 F 5 2 5 4 DB 'FORT '
O F E F C8 DB 'N"+~OH
OFF0 B50F DW VOCAB-ODH
O F F 2 CCOA FORTH DW DODOE
OFF4 E 2 0 F DW DOVOC
O F F 6 81.40 DW 08081H
O F F 8 7D1A DW TASK-7 ; COLD START VALUE ONLY
CHANGED EACH T I M E A D E F I S APPENDED
T O T H E FORTH VOCABULARY
; END O F VOCABULARY L I S T
Y

OFFC 8R DB 8BH ; DEFINITIONS


OFFD 444546494E DB 'DEFINITION'
1007 D3 DB "S '980H
1008 EAOF DW FORTH-8
lOOA 1105 DEFIN DW DOCOL
lOOC 9007 DW CONT
lOOE 9705 DW AT
1010 9G07 DW CLRR
CP/M MACRO ASSEM 2.0 8080 FIG-FORTH 1.1 VERSION A0 15SEP79
1612 CEO5 STORE
1014 4704 SEMIS
1016 C1 OClH ; (
1017 A8 '( '+8OH
1018 FCOF DEFIN-OEH
l0lA 1106 DOCOL
lOlC 5601 LIT
l O l E 2900 29H
1020 E50C WORD
1022 4704 SEMIS

84H ; QUIT
'QUI'
'T8+80H
PAREN-4
QUIT DOCOL
ZERO
BLK
STORE
LBRAC
RPSTO ; BEGIN
CR
QUERY
INTER
STATE
AT
ZEQU
ZBRAN ; IF
QUITS-$
PDOTQ
2
'OK' ; ENDIF
BRAN ; AGAIN
QUIT1-$

85H ; ABORT
'ABOR'
'T8+80H
QUIT-7
ABORT DOCOL
SPSTO
DEC
QSTAC
CR
DOTCPU
PDOTQ
ODH
'FIG-FORTH '
FIGREL+30H,ADOT,FIGREV+30H
FORTH
DEFIN
QUIT

LXI B ,WRMl
3MP NEXT
CP/M MACRO ASSEM 2.0 8080 FIG-FORTH 1.1 VERSION A0 15SEP79
1080 8910 WRMl w m
84H ; WARM
'WAR'
'~'980~
ABORT-8
WARM DOCOL
MTBUF
ABORT
I

CLD LXI
LHLD
SPHL
JMP NEXT
CLD 1 DW COLD
>
84N ; COLD
'COL'
'D8+80H
w m -7
COLD DOCOL
MTBUF
ZER0,DENSTY
STORE
LIT,BUFl
USE,STORE
LIT,BUF1
PREV,STORE
DRZER
LIT,0
LIT,EPRINT
STORE

LIT
ORIGi-12H
LIT
UP
AT
LIT
6
PLUS
LIT
1OH
CMOVE
LIT
ORIG+OCN
AT
LIT
FORTH+6
STORE
ABORT

8 4H ; S->D
'S->'
'D'+~oH
COLD- 7
CP/M MACRO ASSEM 2.0 U049 8080 FIG-FORTH 1.1 VERSION A0 1 5 S E P 7 9
10F3 FSlO STOD DW $4-2
10F5 Dl POP D
10F6 210000 LXI H, 0
10F9 7A MOV A,D
lOFA E680 AN1 80H
lOFC CAOOll JZ STOD 1
lOFF 2B DCX H
1100 C34301 STOD 1 SMP DPUSH
f
DB 82H ; -I--
DB ' +'
DB '-'+80H
DW STOD-7
DW DOCOL
DW ZLESS
DW ZBRAN ; IF
DW PMI-$
DW MINUS ; ENDIF
DIJ S EM1 S

Dl3 83H ; Di-


DII '0+'
DB ' -'+$OH
DW PM-5
DPM DW DOCOL
DU ZLESS
DW ZBRAN ; IF
DW DPMI-$
DW DMINU ; ENDIF
DPMl DW SEMIS
f

DB 8 3H ; ABS
DB 'AB'
DB 'S8+80H
DW DPM-6
ABS DW DOCOL
DW DUP
nw PM
DW S EM1 S

DB 84H ; DABS
DB 'DAB'
DR 'S '+80H
DW ABS-6
DABS DW DOCOL
DW DUP
DW D PM
DW SEMIS

1143 83 DB 83H ; MIN


1144 4949 DB 'MI'
1145 CE DB 'N'+~oH
1147 3411 DW DABS- 7
1149 11066405 MIN DW DOCOL,TDUP
114D A308 DW GREAT
114F 9 2 0 1 i)W ZBRAN ; IF
C P / M MACRO ASSEM 2.0 8080 FIG-FORTH 1.1 VERSION A0 15SEP79
1151 0400 MINI=-$
1 i5'3 4905 SWAP ; ENDIF
11 15 3CCi5 MIN 1 DROP
1 1 5 1 4734 SEMIS

1159 83 83H ; MAX


1 i 5A 4D41 'MA'
115C D 8 'X'J-80H
115D 4 3 1 1 MZN-6
? 15F 11066405 MAX DOCOL,TDUP
1163 6108 LESS
1165 9201 ZBRAN ; IF
1167 0400 MAXI-$
1169 4905 SWAP ; ENDIF
116B 3C:15 MAX 1 DROP
!!6D ~~704 S EM1S

l l 6 F 82 82H ; M*
1170 4D 'M'
1172 AA ' *'+80H
1112 5911 MAX-6
1174 11066405 MSTAR DOCOL,TDUP
1178 E803 XORR
117A 7204 TOR
117C 2Cll AB S
117E 4905 SWAP
1180 2Cll AB S
1182 3A03 USTAR
1184 8804 FROMR
1186 1 A l l DPM
1188 4704 SEMIS

82H ; M/
" M'
'/'+80H
MSTAR-5
MSLAS DOCOL
OVER
TOR
TOR
DABS
RR
AB S
USLAS
FROMR
RR
XORR
PM
SWAP
FROMR
PM
SWAP
SEMIS
CP/H MACRO ASSEM 2.0 8080 FIG-FORTH 1.1 VERSION A0 15SEP79
l l B 3 8All MSLAS-5
llB5 1106 STAR DOCOL
llB7 7411 MSTAR
llB9 3C05 DROP
llBB 4704 SEM1S
84H ; /MOD
'/MO'
'D0+80H
STAR-4
SLMOD DOCOL
TOR
STOD
FROMR
MSLAS
SEMIS

8 1H ; /
'/'+80H
SLMOD- 7
SLASH DOCOL
SLMOD
SWAP
DROP
SEMIS
llDE 83 83H ; MOD
llDF hD4F 'MO '
llEl C4 'D0+80H
llE2 DO11 SLASH-4
llE4 1106 MODD DOCOL
llE6 C411 SLMOD
llE8 3C05 DROP
llEA 4704 SEMIS
9

11EC 85
llED 2A2F4D4F
llFl C4
llF2 DEll MODD-6
llF4 1106 SSMOD DOCOL
llF6 7204 TOR
llF8 7411 MSTAR
llFA 8804 FROMR
1lFC 8Fll MSLAS
llFE 4704 SEM1 S

82H ; */
'*0

'/'+80H
SSMOD-8
SSLA DOCOL
SSMOD
SWAP
DROP
SEMIS
8080 FIG-FORTH 1.1 VERSION A0 1 5 S E P 7 9
8 5H ; MIMOD
'M/MO'
'~'+80H
SSLA-5
MSMOD DOCOL
TOR
ZERO
RR
USLAS
FROMR
SWAP
TOR
USLAS
FROMR
SEMIS

BLOCK MOVED DOWN 2 PAGES

DB 86H ; (LINE)
DB ' (LINE'
DB ' ) '+80H
DW MSMOD-8
PLINE DW DOCOL
DW TOR
nw LIT
DW 4 OH
DW BBUF
DW S SMOD
DW FROMR
DW BSCR
DW STAR
DW PLUS
DW BLOCK
DW PLUS
DW LIT
DW 4 OH
DW SEMIS

DB 85H ; .LINE
1255 2E4C494E DB ' .LIN'
i259 C5 DB 'E'+80H
125A 2D12 DW PLINE-9
125C 1106 DLINE DW DOCOL
125E 3612 DW PLINE
1260 280B DW DTRAI
1262 FAOA DW TYPE
1264 4704 DW SEM1S
9

1266 87 87H ; MESSAGE


l267 4D45535341 'MESSAG'
126D C5 'E8+80H
126E 5412 DLINE-8
1270 1106 MESS DOCOL
1272 3207 WARN
1274 9705 AT
CP/M FlACRO ASSEM 2.0 /I053 8080 FIG-FORTH 1.1 VERSION A0 15SEP79
1276 9201 Dti Z B m ; IF
1278 lEOO DW MESSl-$
127A DO08 DW DDUP
127C 9201 DW ZBRAN ; IF
127E 1400 DW MESS2-$
1280 5601 DW LIT
1282 0400 DW 4
1284 8307 DW OFSET
1286 9705 DW AT
1288 EA06 DW BSCR
128A D411 DW SLASH
128C 4708 DW SUBB
128E 5C12 DW DLINE
1290 C108 DW SPACE ; ENDIF
1292 7A01 MESS2 DW BRAN ; ELSE
1294 OD00 DW MESS3-$
1296 5BOB MESS 1 DW PDOTQ
1298 06 DB 6
1299 4D53472023 DB 'MSG d '
129F 1A19 DW DOT ; ENDIF
i2A1 4704 MESS3 DW SEMIS
PAGE
C P / M MACRO ASSEM 2.0 8 0 8 0 FIG-FORTH 1.1 VERSION A0 1 5 S E P 7 9

.---------------------------I---------.-------
>
,
9 8 0 8 0 PORT FETCH AND STORE
3 ( SELF MODIFYING CODE, NOT REENTRANT )

DB 8 2H ; P@ "PORT @"
DB 'p'
DB "@'+$OH
DW MESS- OAH
PTAT: DW $,+2
POP D ; E <- PORT//
LXI H, $+5
MOV M,E
IN o ;( PORT!/ MODIFIED )
MOV L, A ; L <- (PORT//)
MVT H,0
JMP HPUSH

DB 82H ; "PORT STORE"


DB 'P'
DB ' ! '480H
DW PTAT-5
PTSTO: DW $+2
POP D ;E <- PORT#
LXI H, $+7
MO V M, E
POP H ;H <- CDATA
MOV A, L
OUT 0 ;( PORT# MODIFIED )
.JMP NEXT
PAGE
8080 FIG-FORTH 1.1 VERSION A 0 1 5 S E Y 7 9

9 CP/M D I S K INTERFACE

9 CP/M B I O S CALLS USED


( NOTE EQU'S ARE 3 LOWER THAN DOCUMENTED OFFSETS
9 BECAUSE BASE ADDR I S BIOS+3 )
Y

0027 = RITSEC EQU


0024 = RDSEC EQU
0021 = S ETDMA EQU
OOlE = SETSEC EQU
OOlB = SETTRK EQU
0018 = SETD S K EQU
,
9 DOUBLE DENSITY 8" FLOPPY C A P A C I T I E S
SPT2 EQU 52 ; SECTORS PER TRACK
TRKS 2 EQU 77 ; NUMBER OF TRACKS
SPDRV2 EQU SPT2*TRKS2 ; SECTORS/DRIVE
Y SINGLE DENSITY 8" FLOPPY C A P A C I T I E S
OOlA = SPT1 EQU 26 ; SECTORS/TRACK
004D = TRKS 1 EQU 77 ; # TRACKS
07D2 = SPDRVl EQU SPT 1*TRKS 1 ; SECTORS/DRIVE
,
BPS ; BYTES PER SECTOR
MXDRV ; MAX # D R I V E S
9

9 FORTH VARIABLES AND CONSTANTS USED I N D I S K INTERFACE


9

12CA 85 85H ; DRIVE ( CURRENT DRIVE /I )


12CB 44524956 'DRIV'
12CF C5 'E'+80H
12D0 B712 PTSTO-5
12D2 6D060000 DRIVE DOVAR, 0

83H ; SEC ( SECTOR #)I


'SE'
'C'+8OH
DRIVE-8
SEC : DOVAR
0
,
DB 85H ; TRACK ( TRACK #
DB 'TRAC'
DB 'K'+80H
DW SEC-6
TRACK: DW DOVAR ,0
Y
DB 8 3H ; USE ( ADDR O F NEXT BUFFER TO USE )
DB 'US'
DB 'E8+80H
DW TRACK-8
USE: DW DOVAR
DW BUF 1
Y

; PREV
8080 FIG-FORTH 1.1 VERSION A 0 1 5 S E P 7 9
( ADDR O F PREVIOUSLY USED BUFFER )
'PRE'
'V'+80H
USE-6
PREV DOVAR
BUF 1

87H ; SEC/BLK ( # SECTORS/BLOCK )


'SECIBL'
'K'+80H
PREV-7
SPBLK DOCON
KBBUF/BPS

130F 85 8 5H ; #BUFF ( NUMBER O F BUFFERS )


1310 23425546 '~IBUF'
1314 C6 'F0+80H
1315 0113 SPBLK-10
1317 53060800 NOBUF DOCON,NBUF

87H ; DENSITY ( 0 = S I N G L E , 1 = DOUBLE )


'DENSIT'
'Y'+80H
NOBUF-8
DENSTY DOVAR
0
9
1329 8A 8AH ; DISK-ERROR ( D I S K ERROR STATUS )
132A 1449534B2D 'DISK-ERRO'
1333 D2 'R'+80H
1334 1B13 DENSTY- 10
1336 6 D 0 6 0 0 0 0 DSKERR DOVAR ,0
,
D I S K INTERFACE HIGH-LEVEL ROUTINES

133A 84 84H ; +BUF ( ADVANCE BUFFER )


133B 2B4255 '-t-BU'
133E C6 'F'+~oH
133F 2913 DSKERR-13
1341 1106 PBUF DOCOL
1343 56018400 L I T , CO
1347 C9045605 PLUS ,DUP
134B D2065508 LIMIT,EQUAL
134F 92010600 ZBRAN,PBUFl-$
1353 3C05C606 DROP, F I R S T
1357 5605FD12 PBUF1: DUP ,PREV
135B 97054708 AT, SUBB
135F 4704 SEMIS
9

1361 86 86H ; UPDATE


1362 5550444154 'UPDAT'
1 3 6 7 C5 'E'+80H
1368 3 A 1 3 PBUF-7
1 3 6 A 1 1 0 6 F D 1 2 UPDAT DOCOL,PREV
136E 97059705 AT, AT
1 3 7 2 56010080 LIT, 8000H
CP/M MACRO ASSEM 2.0 8080 FIG-FORTH 1.1 VERSION AO 15SEP79
1376 9503 ORR
1378 mi29705 PREV,AT
137C CEO54704 STORE,SEMIS
9
1380 8D 8DH ; EMPTY-BUFFERS
1381 454D505459 'EMPTY-BUFFER'
138D D3 'S'+80H
138E 6113 UPDAT-9
1390 i106C606 MTBUF DOCOL,FIRST
1394 D2062D05 LIMIT,OVER
1398 47089AOC SUBB,ERASEE
139C 4704 SEMIS
9

139E 83 83H ; DRO


139F 4452 'DR'
13A1 BO '0'+80H
13A2 8013 MTBUF- 16
1JA4 11068F06 DRZER DOCOL,ZERO
13A8 8307CE05 OFSET,STORE
13AC 4704 SEMIS
9

13AE 83 83H ; DRl


13AF 4452 'DR'
1381 B 1 ' 1 '+80H
13B2 9E13 DRZER-6
13B4 1106 DRONE DOCOL
13B6 25139705 DENSTY,AT
13BA 92010A00 ZBRAN,DRONl-$
1 3BE 5601A40F LIT,SPDRV2
!3C2 7.401 0600 BRAN,DRON2-$
1 3 C h 560il3207 D R O N l LTT,SPDRVl
13CA 8307CE35 DRON2 OFSET,STORE
13CE 4704 SEMIS
9

13DO 86 DB 86H ; BUFFER


13D1 4255464645 DB 'BUFFE'
13D6 D2 DB 'R'+80H
13D7 AE13 DW DRONE-6
13D4 1106F212 BUFFE: DW DOCOL,USE
13DD 97055605 DW AT ,DUP
13El 7204 DW TOR
13E3 41i3 BUFF? DW PBUF ; WON'T WORK IF SINGLE BUFFER
13E5 9201PCFF DW ZBRAN,BUFFl-$
13E9 F212CE05 DW USE,STORE
13En 9C049705 DL' RK ,AT
13F1. 8701 DW ZLESS
13F3 92011400 DW ZBRAN,BUFF2-$
13F7 9C04F407 DW RR ,TWOP
13FB 9CO49705 DW RR,AT
13FF i401FF7F DW LIT,7FFFH
1403 C3038F06 DW ANDD ,ZERO
1407 8815 DW RSLW
1409 9C04CEO5 RUFF2 DW RR, STORE
140D 9C04FD12 DW RR, PREV
1411 CEO58804 DW STORE,FROMR
1415 F4074704 DW TWOP,SEMIS
CP/M MACRO ASSEM 2.0 8 0 8 0 FIG-FORTH 1.1 VERSION A0 15SEP79
3

1419 8 5 85H ; BLOCK


141A 425C4F43 'BLOC'
141E CB 'K'+80H
1 4 1 F DO13 BUFFE-9
1 4 2 1 1 1 0 6 8 3 0 7 BLOCK DOCOL,OFSET
1 4 2 5 9705C904 AT, PLUS
1 4 2 9 7204FD12 TOR, PREV
142D 9 7 0 5 5 6 0 5 AT, DUP
1 4 3 1 97059C04 AT, RR
1435 4708 SUBB
1 4 3 7 5605C904 DUP ,PLUS
143R 9 2 0 1 3 4 0 0 ZBRAN,BLOCI-$
1 4 3 F 4113A304 BLOC2 PBUF ,ZEQU
1 4 4 3 9201 1 4 0 0 ZBRAN,BLOC3-$
1 4 4 7 3C059C04 DROP, RR
144B D9135605 BUFFE ,DUP
1 4 4 F 9C049706 RR ,ONE
1453 8815 RSLW
1455 9F064708 TWO, SUBB
1 4 5 9 5 6 0 5 9 7 0 5 BLOC3 DUP ,AT
145D 9C044708 RR, SUBB
1 4 6 1 5605C904 DUP ,PLUS
1 4 6 5 A304 ZEQU
1 4 6 7 9201D6FF ZBRAN,BLOC2-$
146R 5605FD12 DUP, PREV
146F CEO5 STORE
1 4 7 1 88043C05 BLOC1 FROMR ,DROP
1475 F4074704 TWOP,SEMIS
9

9 CP/M INTERFACE ROUTINES


9

9 SERVICE REQUEST
9

1 4 7 9 2A0100 IOS LHLD 1 ; (HL) C- BZOS TABLE ADDR+3


147C 1 9 DAD D ; +
SERVICE REQUEST OFFSET
147D E9 PCHL ; EXECUTE REQUEST
9 RET FUNCTION PROVIDED BY CP/M
9

147E 8 6 86H ; SET-I0


9 ( ASSIGN SECTOR, TRACK FOR BDOS )
147F 5345542D49 DB 'SET-I'
1484 CF DB '08+80H
1485 1914 DW BLOCK-8
1487 8914 SETIO: DW $+2
1489 C5 PUSH B ; SAVE ( I P )
148A 2kF412 LBLD USE+2 ; (BC) <- ADDR BUFFER
148D 44 MOV B*H
148E 4D MOV C,L
148F 112100 LXI D,SETDMA ; SEND BUFFER ADDR TO CP/M
1492 CD7914 CALL 10s

1 4 9 5 2ADE12 LHLD SEC+2 ; (BC) <- (SEC) = SECTOR #


1 4 9 8 4D MOV c,L
1499 lllEOO LXI D, SETSEC ; SEND SECTOR # TO CP/M
CP/M MACRO ASSEM 2.0 $059 8080 FIG-FORTH 1.1 VERSION A0 15SEP79
149C CD7914 CALL 10s
9

149F 2AEA12 LHLD TRACK+2 ; (BC) <- (TRACK) a TRACK #


14A2 44 MOV B ,H
14A3 4D MOV c ,L
14A4 lllBOO LXI D ,SETTRK
14A7 CD7914 CALL 10s

14AA C1 POP B ; RESTORE (IP)


14AB C34501 JMP NEXT
9

14AE 89 DB 89H ; SET-DRIV?


14AF 5345542D44 DB 'SET-DRIV'
14B7 C5 DB 'E'+80H
14B8 7E14 DW SETIO-9
14BA BC14 SETDRV: DW $+2
14BC C5 PUSH B ; SAVE (IP)
14BD 3AD412 LDA DRIVE+2 ; (C) C- (DRIVE) = DRIVE #
14C0 4F MOV C ,A
14C1 111800 LXI D,SETDSK ; SEND DRIVE TO CP/M
14C4 CD7914 CALL 10s
14C7 C1 POP B ; RESTORE (IP)
14C8 C34501 JM? NEXT
*
9 T~SCALC ( CALCULATES DRIVEII,TRACK#, c SECTOR# )
9 STACK INPUT: SECTOR-DISPLACEMENT = BLK# * SEC/BLK
s OUTPUT: VARIABLES DRIVE, TRACK, & SEC
3

14CB 87 DB 87H ; T&SCALC


14CC 5426534341 DB 'T&SCAL'
14D2 C3 DB 'C8+80H
14D3 AE14 DW SETDRV-12
14D5 11062513 TSCALC: DW DOCOL,DENSTY
14D9 9705 DW AT
14DB 92013800 DW ZBRAN,TSCALS-$
14DF 5601A40F DW LIT,SPDRV2
14E3 C411 DW SLMOD
14E5 56010200 DW LIT,MXDRV
14E9 4911 DW MIN
14ER 5605D212 DW DUP,DRIVE
14EF 97055508 DW AT,EQUAL
14F3 92010800 DW ZBRAN,TSCALL-$
14F7 3C05 DW DROP
14F9 7A010800 DW BRAN,TSCAL2-$
IftFD D212CE05 TSCALI DW DRIVE,STORE
1501 BA14 DW SETDRV
1503 56013400 TSCAL2 DW LIT,SPT2
1507 C411E812 DW SLMOD,TRACK
150B CE05E707 DW STORE,ONEP
150F DC12CE05 DW SEC,STORE
1513 4704 DW SEM1S
SINGLE
9 DENSITY
1515 5601D207 TSCALS DW LIT,SPDRVl
1519 C411 DW SLMOD
151B 56010200 DW LIT,MXDRV
151F 4911 DW MIN
8080 FIG-FORTH 1.1 VERSION A0 15SEP79
DUP,DRIVE
AT,EQUAL
ZBRAN,TSCAL3-$
DROP
BRAN,TSCAL4-$
DRIVE,STORE
SETDRV
LIT,SPTl
SLMOD,TRACK
STORE,ONEP
SEC,STORE
SEMIS

SEC-RE.AD
( READ A SECTOR SETUP BY 'SET-DRIVE' & 'SETIO' )

DB 88H ; SEC-READ
DB 'SEC-REA'
DB 'D'+80H
DW TSCALC-10
SECRD DW $+2
PUSH B ; SAVE ( I P )
LXI D,RDSEC ; ASK CP/M TO READ SECTOR
CALL 10s
STA DSKERR+2 ; (DSKERR) <- ERROR STATUS
POP B ; RESTORE (IP)
JMP NEXT

SEC-WRITE
( WRITE A SECTOR SETUP BY "SET-DRIVE' c 'SETIO' )

DB 89H ; SEC-WRITE
DB 'sEC-WRIT'
DB 'E8+80H
DW SECRD-11
SECWT DW $+2
PUSH B ; SAVE (I!?)
LXI D,RITSEC ; ASK CP/M TO WRITE SECTOR
CALL 10s
STA DSKERR+2 ; (DSKERR) <- ERROR STATUS
POP B ; RESTORE (IP)
JMP NEXT

1582 83 83H ( :FORTH DISK PRIMATIVE )


1583 522F 'R/'
1585 D7 'W'+80H
1586 6615 SECWT- 12
1588 1106 RSLW DOCOL
158A F2129705 USE,AT
158E 7204 TOR
1590 49050B13 SWAP,SPBLK
1594 B511B108 STAR,ROT
1598 F212CE05 USE,STORE
159C OB138F06 SPBLK,ZERO
15A0 EFOl XDO
15A2 2D052D05 RSLWl OVER,OVER
CP/M MACRO ASSEM 2.0 /I061 8080 FIG-FORTH 1.1 VERSION A0 15SEP79
15A6 D5148714 DW TSCALC,SETIO
15AA 92010800 DW ZBRAN,RSLW2-$
15AE 5615 DW SECRD
15B0 7A016400 DW BRAN,RSLW3-$
15B4 7215 RSLW2 DW SECWT
15B6 E707 RSLW3 DW ONEP
15B8 56018000 DW LIT,80H
15BC F2127205 DW USE,PSTOR
15CO A801EOFF DW XLOOP,RSLW1-$
15C4 3C053C05 IjW DROP,DROP
15C8 8804F212 DW FROMR,USE
15CC CEO54704 DW STORE,SEMIS
.--------------------------------------------------------
>

ALTERNATIVE R/W FOR NO DISK INTERFACE

9
DEI 851-1 ; FLUSH
DEI 'FLUS'
D5 'H0+80H
DW RSLW-6
FLUSH DW DOCOL
DW NOBUF,ONEP
DW ZERO,XDO
FLUS1 DW ZER0,BUFFE
DW DROP
DW XLOOP,FLUS1-$
DW SEM1S

D13 84H ; LOAD


Dl3 'LOA'
D13 'D0+80H
DW FLUSH-8
LOAD Did DOCOL,BLK
DW AT,TOR
DW INN,AT
DW TOR,ZERO
D'rJ INN,STORE
DW BSCR,STAR
DW BLK,STORE ; BLK <- SCR * B/SCR
DW INTER ; INTERPRET FROM OTHER SCREEN
DW FROMR ,INN
DW STORE
DW FROMR,BLK
DW STORE
DW SEM1S

DB
DB
DB '>'+80H
DW LOAD- 7
ARROW DW DOCOL
C P / X MACRO ASSEM 2.0 8080 FIG-FORTH 1.1 VERSION A 0 15SEP79
1679 F 1 0 9 QLOAD
l 6 Z R SF06 ZERO
l h 2 I ) 6507 INN
162F' CE05 STORE
1631 LA06 BSCR
1633 5 D 0 7 BLK
1635 9705 AT
1637 21305 OVER
1639 Eitl 1 FlODD
163B 4708 SUBB
103D 5D07 BLK
163F 7205 PSTOR
1 6 4 1 47@& SEMIS

PAGE
CP/M MACRO ASSEM 2 . 0 8080 FIG-FORTH 1.1 VERSION A 0 1 5 S E P 7 9

CP/M CONSOLE & P R I N T E R INTERFACE

CP/M B I O S CALLS USED


( NOTE: BELOW O F F S E T S ARE 3 LOWER THAN CP/M
9 DOCUMENTATION S I N C E BASE ADDR = B I O S + 3 )

0003 = KC STAT EQU 3 ; CONSOLE STATUS


0006 = KC I N EQU 6 ; CONSOLE INPUT
0009 = KCOUT EQU 9 ; CONSOLE OUTPUT
OOOC = KPOUT EQU OCH ; PRINTEk CUTPUT
*
EPRINT ; ENABLE PRINTER VARIABLE
; 0 = DISABLED, 1 = ENABLED

BELOW B I O S CALLS USE '10s' I N D I S K INTERFACE


*
C STAT PUSH B ; CONSOLE STATUS
LXI D,KCSTAT ; CHECK I F ANY CHR HAS BEEN TYPED
CALL 10s
POP R ; I F CHR TYPED TBEN ( A ) <- OFFH
RE;T ; ELSE ( A ) <- 0
; CHR IGNORED

164E C5 PUSH B ; CONSOLE INPUT


164F 110600 LXI D,KCIN ; WAIT FOR CHR TO BE TYPED
1652 CD7914 CALL 10s ; (A) <- CHR, (MSB) <- 0
1655 C1 POP B
1656 C9 RET
*
1657 E5 COUT PUSH H ; CONSOLE OUTPUT
1658 110900 LXI D,KCOUT ; WAIT UNTIL READY
165B CD7914 CALL 10s ; THEN OUTPUT ( C )
165E El POP H
165F C9 RET
9

1 6 6 0 llOCOO POUT LXI D,KPOUT ; PRINTER OUTPUT


1663 C D 7 9 1 4 CALL 10s ; WAIT UNTIL READY
1666 C 9 R ET ; THEN OUTPUT ( C )
*
CPOUT CALL COUT ; OUTPUT ( C ) TO CONSOLE
XCHG
LXI H, E P R I N T
M.OV A,M ; I F ( E P R I N T ) <> 0
ORA A
JZ CPOU 1
MOV C,E ; THEN OUTPUT ( C ) TO PRINTER
CALL POUT
CPOUl RET
9

> FORTH TO CP/M S E R I A L I0 INTERFACE


*
PQTER CALL CSTAT ; I F CHR TYPED
LXI H, 0
CP/M MACRO ASSEM 2 . 0 to64 8080 FIG-FORTH 1.1 VERSION A 0 1 5 S E P 7 9
1 6 7 E B7 ORA A
l h 7 F CA8316 JZ PQTEl
1 6 8 2 2C LNR L ; THEN ( S l ) <- TRUE
1 6 8 3 C3$401 PQTEl JMP HPUSH ; E L S E ( S l ) <- FALSE
3

1686CD4E16 PKEY CALL CIN ; READ CHR FROM CONSOLE


1 6 8 9 FElO CYI DLE ; I F CHR = (-P)
1 6 8 B 5F MOV E,A
168C C29816 JNZ PKEY 1
168F 214316 LXI H,EPRINT ; THEN TOGGLE (EPRINT)LSB
1692 1E20 MVI E,ABL ; CHR <- BLANK
1 6 9 4 7E MOV A,M
1 6 9 5 EEOl XRI 1
1697 77 MOV M,A
1 6 9 8 6B PKEY 1 MOV L,E
1699 2600 MVI H, 0
l69B C34401 JMP HPUSH ; ( S 1 ) L B <- CHR
9

169E A016 PEMIT DW $+2 ; (EMIT) ORPHAN


16A0 El POP H ; ( L ) <- ( S 1 ) L B = CHR
16A1 C5 PUSH B ; SAVE ( I P )
16A2 4D MOV c ,L
lhA3 CD6716 CALL CPOUT ; OUTPUT CHR TO CONSOLE
; & MAYBE P R I N T E R
POP B ; RESTORE (1:P)
JlYP NEXT

16AA C5 PCR PUSH B ; SAVE ( I P )


16AB OEOD MVI C,ACR ; OUTPUT (CR) TO CONSOLE
16AD 69 MOV L,C
l6AE CD6716 CALL CPOUT ; & MAYBE TO PRINTER
16Bl OEOA MVI C,LF ; OUTPUT ( L F ) TO CONSOLE
16B3 69 MOV L,C
16B4 CD6716 CALL CPOUT ; & MAYBE TO P R I N T E R
16B7 C1 POP B ; RESTORE (ILP)
16B8 C34501 JMP NEXT

9
- -----

PAGE
8080 FIG-FORTH 1.1 VERSION A 0 1 5 S E P 7 9

OClH ( TICK )
OA 7H
ARROW- 6
TICK DOCOL
DFIND
ZEQU
ZERO
QERR
DROP
LITER
SEMIS

86H ; FORGET
'FORGE'
'T'+80H
TICK-4
FORG DOCOL
CURR
AT
CONT
AT
SUBB
LIT
18 H
QERR
TICK
DUP
FENCE
AT
LESS
LIT
15H '

QERR
DUP
NFA
DP
STORE
LFA
AT
CONT
AT
STORE
SEMIS

84H ; BACK
'BAC'
'K'+80H
FORG-9
BACK DOCOL
HERE
SUBB
COMMA
SEMIS
#066 8080 FIG-FORTH 1.1 VERSION A 0 1 5 S E P 7 9
DB OC5H ; BEGIN
DB 'BEGI'
D tl 'N0+80H
DW BACK- 7
BEGIN DW DOCOL
DW QCOMP
DW HERE
DW ONE
DW SEMIS

DB OC5H ; ENDIF
DB 'ENDI'
DB 'F8+80H
DW BEGIN-8
ENDIFF DW DOCOL
DW QCOMP
DW TWO
Dw QPAIR
DW HERE
DW OVER
DW SUBB
DW SWAP
DW STORE
DW SEMIS

OC4H ; THEN
'THE'
'N8+80H
ENDIFF-8
THEN DOCOL
END I F F
SEMIS

175A C2 OC2H ; DO
175B 44 'D'
175C CF 'O0+80H
175D 4D17 THEN- 7
175F 1106 DOCOL
1761 OBOA COMP
1763 SF01 W O
1765 0308 HERE
1767 A706 THREE
1769 4704 SEMIS

176B C4 DB . OC4H ; LOOP


176C 4C4F4F DB 'LOO'
176F DO DB 'P8+80H
1770 5A17 DW DO-5
1772 1106 LOOP DW DOCOL
1774 A706 DW THREE
1776 C109 DW QPAIR
1778 OBOA DW corn .
177A A801 DW XLOOP
177C 1517 DW BACK
177E 4704 DW SEMIS
CP/M MACRO ASSEM 2 . 0 8080 FIG-FORTH 1.1 VERSION A 0 1 5 S E P 7 9
1780 C5 OC5H ; +LOOP
1 7 8 1 2B4C4F4F '+LOO8
1 7 8 5 DO 'P0+8OH
1 7 8 6 6B17 LOOP- 7
1 7 8 8 1106 PLOOP DOCOL
178A A706 THREE
178C C109 QPAIR
1 7 8 E OBOA COMP
1 7 9 0 E201 XPLOO
1792 1517 BACK
1794 4704 SEMIS

1796 C5 OC5H ; UNTIL


1797 554E5449 'UNTI '
179B CC 'L8+80H
179C 8017 PLOOP-8
179E 1106 UNTIL DOCOL
17AO 9706 ONE
17A2 C109 QPAIR
17A4 OBOA COW
17A6 9201 Z B W
17A8 1517 BACK
17AA 4704 SEM1 S

17AC C3 OC 3H ; END
17AD 454E 'EN'
17AF C4 'D8+80H
17BO 9617 UNTIL-8
17B2 1106 ENDD DOCOL
1784 9E17 UNTIL
17136 4704 SEMIS
>
17B8 C5 DB OC5H ; AGAIN
17B9 41474149 DB AGAI '
17BD CE DB 'N8+808
17BE AC17 DW ENDD-6
17CO 1106 AGAIN DW DOCOL
17C2 9706 D'W ONE
17C4 C109 DW QPAIR
17C6 OBOA DW COW
17C8 7A01 DW BRAN
17CA 1517 DW BACK
17CC 4704 DW SEMIS
>
17CE C6 OC6H ; REPEAT
17CF 5245504541 'REPEA'
17D4 D4 'T'+80H
17D5 B817 AGAIN-8
17D7 1106 REPEA DOCOL
17D9 7204 TOR
17DB 7204 TOR
17DD C017 AGAIN
17DF 8804 FROMR
17E1 8804 FROMR
17E3 9F06 TWO
17E5 4708 SUBB
CP/M MACRO ASSEM 2.0 8080 FIG-FORTH 1.1 VERSION A0 15SEP79
17E7 3917 END IFF
17E9 4704 SZMIS

l l E B C2
17EC 49 'I'
17ED C6 'F'f80H
17EF: CEE7 REPEA-9
17FO 1106 IFF DOCOL
17F2 OSOA COW
17F4 9201 ZBRAN
17F6 0308 HERE
17F8 8F06 ZERO
17FA IF08 COMMA
17FC 9F06 TWO
17FE 4704 SEMIS

1800 C4 OC4H ; ELSE


1801 454C53 'ELS'
1804 C5 'E'f80H
1305 EB17 IFF-5
1807 1106 ELSEE DOCOL
1809 9F06 TWO
lacs ~ 1 0 9 QPAIR
160D OBOA COW
180F 7A01 BRAN
1811 0308 HERE
1813 8FO6 ZERO
1815 IF08 COMMA
1817 4905 SWAP
1819 9F06 TWO
181B 3917 END I F F
181D 9F06 TWO
181F 4704 S EM1S

1821 C5 OC5H ; WHILE


1822 5748494C 'WHIL'
1826 C5 'E0+80H
1827 0018 ELSEE-7
1829 1106 WHILE DOCOL
182B F017 IFF
182D F407 TWOP
182F 4704 SEMIS
9

1831 86 86H ; SPACES


1832 5350414345 'SPACE*
1837 D3 'S'+80H
1838 2118 WHILE-8
183A 1106 SPACS DOCOL
183C 8F06 ZERO
183E 5Fll MAX
1840 DO08 DDUP
1842 9201 ZBRAN ;IF
1844 OCOO SPAXI-$
1846 8F06 ZERO
1848 EFOl XDO ; DO
184A C108 SPACE
CP/M MACRO ASSEM 2.0 8080 FIG-FORTH 1.1 VERSION A0 15SEP79
184C A801 XLOOP ; LOOP ENDIF
184E FCFF SPAX2-$
1850 4704 SPAXl SEMIS
*
1852 82 8 2H
1853 3C '<*
1854 A3 '1'+80H
1855 3118 SPACS-9
1857 1106 BDIGS DOCOL
1859 D20C PAD
185B DE07 HLD
185D CEO5 STORE
185F 4704 SEMIS

1861 82 8 2H ; #>
1862 23 '#'
1863 BE '>'+$OH
1864 5218 BDIGS-5
1866 1106 ED IGS DOCOL
1868 3C05 DROP
186A 3C05 DROP
186C DE07 HLD
186E 9705 AT
1870 D20C PAD
1872 2D05 OVER
1874 4708 SUBB
1876 4704 S EM1S

1878 84 84H ; SIGN


1873 534947 'SIG'
187C CE 'N8+80H
187D 6118 EDIGS-5
187F 1106 SIGN DOCOL
1881 B108 ROT
1883 B704 ZLESS
1885 9201 ZBRAN ; IF
1887 0800 SIGN1-$
1889 5601 LIT
188B 2D00 2DH
188D BAOC HOLD ;ENDIF
188F 4704 SEMIS

8 1H ; #
'1/'+80H
SIGN-7
DIG DOCOL
BASE
AT
MSMOD
ROT
LIT
9
OVER
LESS
ZBRAN ; IF
DIG1-$
CP/M MACRO ASSEM 2 . 0 8080 FIG-FORTH 1.1 VERSION A 0 1 5 S E P 7 9
18AB 5601 LIT
18AD 0700 7
18AF C904 PLUS ; ENDIF
18B1 5601 LIT
18B3 3000 30H
1885 C904 PLUS
1887 BAOC HOLD
18B9 4704 SEMIS

82H ; #S
'/I'
's'+80H
DIG-4
DIGS DOCOL
DIGS 1 DIG ; BEGIN
OVER
OVER
ORR
ZEQU
ZBRAN ; UNTIL
DIGSI-$
SEMIS

1SD2 83 83H ; D.R


1SD3 442E 'D.'
18D5 D2 'Re+80H
18D6 BB18 DIGS-5
18D8 1106 DDOTR DOCOL
18DA 7204 TOR
18DC 4905 SWAP
18DE 2D05 OVER
18EO 3Bll DABS
18E2 5718 BDIGS
18E4 C018 DIGS
18E6 7F18 SIGN
18E8 6618 EDIGS
18EA 8804 FROMR
lSEC 2D05 OVER
18EE 4708 SUBB
i8FO 3A18 SPACS
18F2 FAOA TYPE
18F4 4704 SEMIS

82H
# .

'R'+80H
DDOTR-6
DOTR DOCOL
TOR
STOD
FROMR
DDOTR
S EM1S

82H
'D'
8 0 8 0 FIG-FORTH 1 . 1 VERSION A0 15SEP79
CP/M MACRO ASSEM 2.0
1909 AE .
' '+80~
DOTR-5
190A F618
190C 1106 DDOT DOCOL
190E 8F06 ZERO
1910 D818 DDOTR
1912 C108 SPACE
1914 4704 SEMIS

.
8 1H
' '+80H
DDOT-5
9

DOT DOCOL
STOD
DDOT
SEMIS

8 1H ;
'? '+80H
DOT-4
QUES DOCOL
AT
DOT
SEMIS

8 2H ; U.
'U '
.
' '+80H
QUES-4
UDOT DOCOL
ZERO
DDOT
SEMIS

193B 85 85H ; VLIST


193C 564C4953 'VLIS'
1940 D4 'T'+80H
1341 2E19 UDOT- 5
1943 1106 VLIST DOCOL
1945 5601 LIT
1947 8000 80H
1949 6E07 OUTT
194B CEO5 STORE
194D 9007 CONT
194F 9705 AT
1951 9705 AT
1 9 5 3 6E07 VLIS 1 OUTT ; BEGIN
1955 9705 AT
1957 BA06 CSLL
1959 A308 GREAT
195B 9201 ZBRAN ; IF
195D OAOO VLIS2-$
195F 1 0 0 3 CR
1961 8F06 ZERO
1 9 6 3 6E07 OUTT
1965 CEO5 STORE ; ENDIF
1967 5605 DUP
#072 8 0 8 0 FIG-FORTH 1.1 VERSION A0 15SEP79
DW IDDOT
DW SPACE
DW SPACE
DW PFA
DW LFA
DW AT
DW DUP
DW Z EQU
DW QTERM
DW ORR
DW ZBRAN ; UNTIL
DW VLISl-$
DkT DROP
DW SEMIS

------- EXIT CP/M .......................


1985 83 DB 83H ; BYE
1986 4259 DB 'BY'
1988 C5 DB 'E'+80H
1989 3'619 DW VLIST-8
1988 8D19 BYE DW $+2
!98D C30000 JMP 0
- -----------
*
1990 84 DB 84W ; LIST
1991 4C4953 DB 'LIS'
1994 D4 DB 'T8+80H
1995 8519 DW BYE-6
1997 11066COA LIST DW DOCOL ,DEC
199B 10035605 DW CR, DUP
199F 7707CE05 DW SCR, STORE
19A3 550B DW PDOTQ
19A5 0653435220 DB 6,'SCR # '
19AC 1A19 DW DOT
19AE 56011000 DW L I T , 1OH
19B2 8F06EF01 DW ZERO, XDO
19B6 10030B02 LIST1 DW ,
CR I D 0
19BA 56010300 DW LIT, 3
19BE FB18C108 DW DOTR,SPACE
19C2 0B027707 DW IDO, SCR
19C6 97055C12 DW AT, DLINE
19CA 0303 DW QTERM ; ?TERMINAL
19CC 92010400 DW ZBRA.N,LISTZ-$ ;IF
19DO 5E04 DW LEAVE ; LEAVE
19D2 A801E2FF LIST2 DW XLOOP,LISTl-$ ; ENDIF
19D6 10034704 DW CR, SEMIS

DB 858 ; INDEX
DB 'INDE'
DB 'X'+8OH
DW LIST-7
INDEX DW DOCOL
DW LIT,FF
DW EMIT, CR
DW ONEP ,SWAP
CP/M MACRO ASSEM 2.0 8080 FIG-FORTH 1.1 VERSION A0 15SEP79
19FO EFOl D O
19F2 10030B02 INDEl CR,ID0
L9F6 56010300 LIT,3
19FA FB18C108 DOTR,SPACE
19FE 8F060B02 ZERO,ID0
LA02 5C120303 DLINE,QTERM
1A06 92010400 ZBRAN,INDE2-$
lAOA 5E04 LEAVE
lAOC A801B4FF INDE2 XLOOP,INDEl-$
lAlO 4704 SEMIS
,
1A12 85 85H ; TRIAD
1A13 54524941 'TRIA'
IA17 C4 'I)'+80H
1A18 DA19 INDEX-8
lAlA 1106 TRIAD DOCOL
lAlC 56010C00 LIT,FF
1A20 E002 EMIT
1A22 56010300 LIT,3
1A26 D411 SLASH
1A2S 56010300 LIT,3
1A2C B511 STAR
l A 2 F 56010300 LIT,3
IA3XD05C904 OVER,PLUS
1A36 4905EF01 SWAP,XDO
1A3A 10030B02 TRIAl CR,ID0
1A3E 9719 LIST
1A40 0303 QTERM ; ?TERMINAL
iA42 92010400 ZBRAN,TRIA2-$ ; IF
1A46 5E04 LEAVE ; LEAVE
LA48 A8OlFOFF TRIA2 XLOOP,TRIA~-$ ; ENDIF
iA4C 1003 CR
1A4E 56010F00 LIT, 15
1A52 70121003 MESS,CR
1A56 4704 SEM1 S
lA58 84 84H ; .CPU
1A59 2E4350
lA5C D5
.
' CP'
'U8+8OH
1A5D 121A TRIAD-8
1A5F 1106 DOTCPU DOCOL
1A61 B.2079705 BASE,AT
1A65 56012400 LIT,36
1A69 R207CE05 BASE,STORE
1AbD 56012200 LIT,22H
1A71 F806R405 PORIG,TAT
LA75 O C 1 9 DDOT
1A77 B207CE05 BASE,STORE
l A i B 4704 SEM1S

84H ; TASK
'TAS'
'K8+80H
DOTCPU-7
TASK DOCOL
SEMIS
CP/M MACRO ASSEM 2.0 a074 8080 FIG-FORTH 1.1 VERSION A0 15SEP79
3

1A88 INITDP: DS EM-$ ;CONSUME MEMORY TO LIMIT


9

PAGE
CP/M MACRO ASSEM 2.0 8080 FIG-FORTH 1.1 VERSION A0 15SEP79

MEMORY MAP
( THE FOLLOWING EQUATES ARE NOT REFERENCED ELSEWHERE )

LOCATION CONTENTS
Y

9
-------- --------
MCOLD EQU ORIG ;JMP TO COLD START
MWARM EQU ORIGi-4 ;JMP TO W A R M START
MA2 EQU ORIGi-8 ;COLD START PARAMETERS
MUP EQU UP ;USER VARIABLES' BASE 'REG'
MRP EQU RPP ;RETURN STACK 'REGISTER'
;
MBIP EQU BIP ;DEBUG SUPPORT
MDPUSH EQU DPUSH ;ADDRESS INTERPRETER
MHPUSH EQU HPUSH
MNEXT EQU NEXT
I
MDPO EQU DPO ;START FORTH DICTIONARY
MDIO EQU DRIVE ;CP/M DISK INTERFACE
MCIO EQU EPRINT ;CONSOLE 6 PRINTER INTERFACE
MIDP EQU INITDP ;END INITIAL FORTH DICTIONARY
Y

*
9
-
= COLD (DP) VALUE
COLD (FENCE) VALUE
I NEW
9 I DEFINITIONS
7 v

I I DATA
I I STACK
MIS0 EQU ; = COLD (SP) VALUE = (SO)
Y = (TIB)
9 I TERMINAL INPUT
I BUFFER
v

Y I RETURN
9 I STACK
MIRO EQU INITRO ;START USER VARIABLES
7 = COLD (RP) VALUE = (RO)
Y = (UP)
7 ;END USER VARIABLES
MFIRST EQU BUF 1 ;START DISK BUFFERS
Y = FIRST
MEND EQU EM- 1 ;END DISK BUFFERS
MLIMIT EQU EM ;LAST MEMORY LOC USED + 1
7 = LIMIT
Y

END ORIG
0 0 2 0 ABL 1058 ABORT 1 1 2 C ABS OOOD ACR OOZE ADOT
1 7 C O AGAIN 08 1 3 ALLOT 0 3 C 3 ANDD 1 6 2 7 ARROW 0 5 9 7 AT
1 7 1 5 BACK 0 7 B 2 BASE 0 6 D E BBUF OED7 BCOMP 1 8 5 7 BDIGS
1 7 2 7 BEGIN 0 0 0 7 BELL 012A BIP 0 6 B 0 BL OCAB BLANK
0 7 5 D BLK 1 4 7 1 BL,OCl 1 4 3 F BLOC2 1 4 5 9 BLOC3 1 4 2 1 BLOCK
0080 B P S 017A B W 0 1 7 C BRAN1 01 3A BREAK 0 6 E A RSCR
0 0 7 F BSIN 0008 BSOUT 3BE0 BUFl 1 3 E 3 BUFF1 1 4 0 9 BUFF2
1 3 D 9 BUFFE OABO BUILD 1 9 8 B BYE 0 5 A 6 CAT 0830 CCOMM
0 9 2 C CFA 164E CIN 108F CLD 1099 C L D l 0 3 2 7 CMOVl
0 3 2 C CMOV2 0 3 1 D CMOVE 0084 CO 1 0 A 2 COLD 0 5 F D COLON
0 8 1 F COMMA OAOB COMP 0 6 4 9 CON 0 7 9 0 CONT OAE7 COUNT
1 6 5 7 COUT 1 6 7 7 CPOUl 1 6 6 7 CPOUT 0310 CR O E 9 5 CKEAl
O E 7 F CREAT 06BA CSLL 07CD CSPP 1645 CSTAT 0 5 D D CSTOR
0 79D CURR 1 1 3 B DABS 1 8 D 8 DDOTR 1 9 0 C DDOT 0 8 D 0 DDUP
08DA DDUPl OA6C DEC lOOA D E F I N 1 3 2 5 DEKSTY ODF9 D F I N l
OED9 DFIND 18B1 DIG1 0 2 3 5 DIG11 0 2 4 0 DIG12 021F DIGIT
1 8 9 5 DIG 18CO D I G S 18C2 DIGS1 0010 DLE 1 2 5 C DLINE
OF20 DLITl OF10 DLITE 0 5 0 F DMINU 0611 DOCOL 0653 DOCON
OACC DODOE 1 7 5 F DO OACO DOES 1 A 5 F DOTCPU 0 B 7 4 DOTQ
O B 9 4 DOTQl OB9C DOTQ2 1 9 1 A DOT 1 8 F B DOTR 0 6 7 F DOUSE
0 6 6 D DOVAR O F E 2 DOVOC 0150 DPO 07BB DPL 0 4 D 6 DPLUS
0 7 4 5 DP l l l A DPM 11 2 4 DPMl 0 1 4 3 DPUSH 1 2 D 2 DRIVE
1 3 C 6 DRONl 13CA DRON 2 1 3 B 4 DRONE 0 5 3 C DROP 1 3 A 4 DRZER
1 3 3 6 DSKERR O B 3 0 DTRAl OB4A DTRA2 OB4E DTRA3 O B 2 8 DTRAI
0 5 5 6 DUP 1866 E D I G S 1 8 0 7 ELSEE 4 0 0 0 EM 02EO EMIT
0 2 9 C ENCL 0 2 A 6 ENCLl 0 2 B E ENCL2 0 2 C A ENCI,3 0 2 D 1 ENCL4
1 7 3 2 ENDD 1 7 3 9 ENDIFF 1 6 4 3 EPRINT 0855 EQUAL OC9A ERASEE
O E 2 i ERR01 OE40 ERR02 O E 1 3 ERROR 0 1 6 B EXEC OBBl E X P E l
OBEB E X P E 2 OCl 1 EXPE3 O C 0 3 EXPE4 OC05 EXPE5 ORE3 E X P E 6
OBE7 EXPE7 OBA7 EXPEC 0 7 3 0 FENCE OOOC F F 0001 F I G R E L
0001 F I G R E V OC7A F I L L OC82 F I L L 1 OC8E F I L L 2 06C6 FIRST
0 7 C 4 FLD 1 5 E 2 FLUS1 1 5 D 8 FLUSH 1 6 D 8 FORG O F F 2 FORTH
0 4 8 8 FROMR 0 8 A 3 GREAT 0803 HERE OA56 HEX 0 7 D E HLD
OCBA HOLD 0 1 4 4 HPUSH O E 4 8 IDDOT 020B ID0 17FO I F F
OFA9 IMMED 1 9 F 2 INDEl lAOC I N D E Z 1 9 E 2 INDEX iA88 INITDP
3BA0 INITRO 3B00 INITSO 0 7 6 5 INN OF5D I N T E l OF7F INTE2
OF75 INTE3 OF79 INTE4 OF99 INTE5 OF93 INTE6 OF97 INTE7
OF5B INTER 1 4 7 9 10s 0080 KBBUF 0006 K C I N 0009 KCOUT
0003 KCSTAT 0 2 F 2 KEY OOOC KPOUT 0 9 0 C LATES OA21 LBRAC
0 4 5 E LEAVE 086D LESl 0 8 7 8 LES2 0861 L E S S OOOA L F
0 9 1 C LFA 06D2 LIMIT 1997 LIST 19B6 LIST1 19D2 LIST2
0156 LIT OF03 L I T E l OEF3 L I T E R 1 5 F 5 LOAD 1 7 7 2 LOOP
0108 MA2 115F MAX 1 1 6 B MAX1 0 1 2 A MBIP 1643 X C I O
0 100 MCOLD 1 2 D 2 MDIO 0150 MDPO 0143 MDPUSH 3 F F F MEND
1 2 7 0 MESS 1 2 9 6 MESS1 1 2 9 2 MESS2 1 2 A 1 MESS3 3BEO M F I R S T
0 1 4 4 MHPUSH 1 A 8 8 MIDP 1149 M I N 1155 M I N l 04F9 MINUS
3 B A 0 MIRO 3B00 MIS0 4000 M L I M I T 0145 MNEXT 11E 4 MODD
0358 MPYX 0 3 5 D ?-PYX1 0365 MPYX2 0 1 2 8 MRP 118F MSLAS
1 2 1 7 MSMOD 1 1 7 4 MSTAR 1390 MTBUF 0126 MUP 0 1 0 4 MWARM
0 0 0 2 MXDRV 0008 NBUF 0 1 4 5 NEXT 0 1 4 B NEXT1 0 9 3 A NFA
1317 NOBUF 0 6 3 A NOOP 0001 NSCR OC3B NULL OC6D NULL1
O C 6 9 NULL2 OC7 1 NULL3 O D 8 1 NUMB O D 9 F NUMB1 ODC5 NUMB2
ODCF NUMB3 0 7 8 3 OFSET 0 6 9 7 ONE 0 7 E 7 ONEP 0100 O R I G

62

FORTH INTEREST GROUP o e - e * F?O. Box 1105 San Carlos, Ca. 94070
03D5 ORR 076E OUTT 052D OVER OE05 PABOR OCD2 PAD
1 6 1 PAREN
~ 1341 PBUF 1357 PBUFl 16AA P C R OB5B PDOTQ
1 6 9 E PEMIT 0950 PFA 0250 PFINl 0259 PFIN2 0278 PFIN3
027B PFIN4 0281 PFIN5 0269 PFIN6 024D PFIND 1686 PKEY
1 6 9 8 PKEYl 1236 PLINE 1788 PLOOP 04C9 PLUS 1108 PM
1 1 1 2 PM1 OD38 PNUMl OD74 PNUM2 OD6E PNUM3 OD36 PNUMB
0 6 F 8 PORIG 1660 POUT 1683 PQTEl 1678 PQTER 12FD PREV
OA82 PSCOD 0572 PSTOR 12A8 PTAT 12BC PTSTO 0992 QCOMP
09D4 QCSP 0978 QERR 0986 QERRl 0988 QERR2 09AA QEXEC
0 9 F 1 QLOAD 0 9 C l QPAIR OF2B QSTAC 0303 QTERM OC23 QUERY
1 9 2 6 QUES 102B QUIT 1035 QUIT1 104C QUIT2 OA2F RBRAC
0 0 2 4 RDSEC 17D7 REPEA 0027 RITSEC 0 7D5 RNUM 08B1 ROT
0 4 2 1 RPAT 0 1 2 8 RPP 042F RPSTO 049C RR 1588 RSLW
15A2 RSLWl 15B4 RSLW2 15B6 RSLW3 OOAi) RTS 0710 RZERO
0 7 7 7 SCR 0 9 6 5 SCSP 12DC SEC 1556 SECRD 1572 SECWT
0 6 2 5 SEMI OAA2 SEMI1 OA98 SEMIC 0447 SEMIS 0021 SETDMA
14BA SETDRV 0 0 1 8 SETDSK 1487 SET10 OOlE SETSEC OOlB SETTRK
1 8 7 F SIGN 1 8 8 F SIGN1 llD4 SLASH llC4 SLMOD OA44 SMUDG
0 8 C l SPACE 183A SPACS 03FB SPAT 1850 SPAXl 184A SPAX2
130B SPBLK 07D2 SPDRVL OFA4 SPDRV2 040A SPSTO OOlA SPTl
0 0 3 4 SPT2 1 2 0 5 SSLA llF4 SSMOD 083C SSUB llB5 STAR
07A8 STATE 1 0 F 3 STOD 1100 STODl 05CE STORE 0847 SUBB
0 5 4 9 SWAP 0 7 0 7 SZERO 1A84 TASK 05B4 TAT 0564 TDUP
1 7 5 4 THEN 06A7 THREE 071A TIB 16BF TICK 012C TNEXT
0 13D TNEXTl 0 5 8 9 TOGGL 0 4 7 2 TOR 12E8 TRACK 08E7 TRAV
08EB TRAVl 1A3A TRIAl 1A48 TRIA2 lAlA TRIAD 004D TRKSl
004D TRKS2 14FD TSCALl 1 5 0 3 TSCAL2 1533 TSCAL3 1539 TSCAL4
14D5 TSCALC 1 5 1 5 TSCALS 05EA TSTOR 069F TWO 07F4 TWOP
OAFA TYPE OBI8 TYPE1 OBOA TYPE2 OBiA TYPE3 1933 UDOT
0 8 9 9 ULESl 089D ULES2 0 8 8 3 ULESS 179E UNTIL 0126 UP
136A UPDAT 0 0 4 0 US 0 6 7 9 USER 12F2 USE 038C USLAl
0 3 8 E USLA2 0 3 9 7 USLA3 03A6 USLA4 03B1 USLA5 03B2 USLA6
03B7 USLA7 0 3 6 F USLAS 0 0 0 0 USRVER 033A USTAR 0667 VAR
1953 VLISl 1 9 6 7 VLIS2 1 9 4 3 VLIST OFC2 VOCAB 0753 VOCL
1 0 8 9 WARM 0 7 3 2 WARN 1 8 2 9 WHILE 0725 WIDTH OCE5 WORD
OCF9 WORD 1 OCFD WORD2 10 7A WRM 1080 WRMl OlEF XDO
OlAD XLOOl 01C7 Z O O 2 OlCC XL003 01A8 XLOOP 03E8 XORR
0 l E 2 XPLOO 0 1 9 2 ZBRAN 04A3 ZEQU 04AF ZEQUl 068F ZERO
04C2 ZLESl 04B7 ZLESS

FORTH INTEREST GROUP * - = - * P O . Box 1105 --*". San Carlos, Ca. 94070

You might also like