home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 September
/
Simtel20_Sept92.cdr
/
msdos
/
forth
/
fig86.arc
/
FORTH1.DOC
< prev
next >
Wrap
Text File
|
1982-11-18
|
31KB
|
1,002 lines
I. Introduction
II. User's guide
A. System requirements
B. FORTH, calculator style
1. Getting started
2. Compiling definitions
3. Exiting FORTH
C. Using the disk
1. FORTH's view of the disk
a. Blocks
b. Screens
2. Creating and editing new words
3. Compiling source definitions
D. Modifying FORTH
1. Saving new FORTH's
2. Patching
3. Assembly source modification
E. Glossary extension
1. Assembly listing definitions
2. Deleted words
3. High-level extensions
F. FORTH application screens
1. Moving DOS files to FORTH screens
2. Using the screens
III. Technical matters
A. Modifications to fig-FORTH v1.0
1. Boot parameters
2. Machine code definitions
3. High-level utility definitions
4. Installation dependent code
a. Terminal i/o
b. Printer i/o
c. Disk i/o
5. High-level definitions
6. System tools
7. RAM workspace
8. Memory map
III. Future extensions
IV. FORTH sources
1
Thi≤ i≤ ß descriptioε oµ modification≤ to¼á anΣ instruction≤
fo≥ usσ of¼ 808╢ fig-FORT╚ v1.0╗ a≤ modifieΣ fo≥ MS-DO╙ by:
Joe Smith
University of Pennsylvania
Dept. of Chemistry
250 S. 33rd St.
Philadelphia, PA 19104
I. Introduction
Iεá Augus⌠ oµ 1981¼á havinτ aε 8086¼á bu⌠ preciou≤ littlσ t∩
ruεá oεá it¼á ╔á begaε t∩ investigatσá FORT╚á a≤á aεá alternativσ
programminτ language«á Thσ fiτ assembl∙ listinτ fo≥ thσ 808╢ wa≤
editeΣá ont∩ disδ durinτ Apri∞ oµ 1982¼á usinτ thσ mnemonic≤á fo≥
Seattlσáá Compute≥á Product≤á 808╢á assembler«áá Oncσá thσá tex⌠
interprete≥ wa≤ running¼ thσ disδ interfacσ wa≤ re-writteε t∩ ruε
unde≥ SCP'≤ 86-DOS« Iε augus⌠ oµ 1982¼ sligh⌠ modification≤ werσ
madσ t∩ takσ advantagσ oµ feature≤ supporteΣ b∙ MS-DO╙ v1.25.
Thσá origina∞ goa∞ wa≤ t∩ instal∞ ß languagσ fo≥ m∙ owε use«
Tha⌠á i≤á stil∞ m∙ primar∙á interest«á Fo≥á thi≤á reason¼á thi≤
versioεá oµá thσá languagσá i≤ recommendeΣá fo≥á peoplσá wh∩á arσ
familia≥á witΦá thei≥á computer¼á anΣ (somewha⌠á les≤á important⌐
familia≥ witΦ FORTH«á Iµ yo⌡ arσ ne≈ t∩ FORTH¼á yo⌡ wil∞ havσ t∩
diτ fo≥ somσ oµ thσ basiπ information« Whilσ i⌠ i≤ certainl∙ onσ
wa∙ t∩ learn¼ i⌠ i≤ slo≈ anΣ sometime≤ frustrating« Iµ yo⌡ arσ ß
persoε wh∩ enjoy≤ understandinτ anΣ tinkerinτ witΦ thσ mechanism≤
(reaΣ 'hacker')¼á yo⌡ shoulΣ fee∞ righ⌠ a⌠ home«á Iµ yo⌡ arσ aε
experienceΣá FORT╚á user¼á yo⌡ caε tel∞ mσ al∞ thσ thing≤á ╔á diΣ
wrong!
2
II. User's guide
Thi≤á documentatioεá present≤ specifiπ detail≤ necessar∙á t∩
usσ FORT╚ unde≥ MS-DO╙ (e⌠ al.)«á I⌠ i≤ no⌠ mean⌠ t∩ bσ ß user'≤
guide to FORTH in general.
A. System requirements
Minimum: 16K + system, no disks
Maximum║ 64╦ ½ system¼ ▓ disk≤ ╜ standarΣ configuratioε
B. FORTH, calculator style
1. Getting started
Afte≥ executinτ FORT╚ b∙ givinτ COMMAN─ thσ namσ oµ thσ .CO═
prograφ wherσ FORT╚ resides¼ ß banne≥ wil∞ appea≥ t∩ le⌠ yo⌡ kno≈
FORT╚á i≤á read∙á t∩ executσá you≥á commands«á Thi≤á i≤á FORTH'≤
executioε state«á A⌠ thi≤ point¼á typσ ß carriagσ return╗ FORT╚
shoulΣá responΣá witΦá 'ok'«á Iµ i⌠ doesn't¼á theεá yo⌡á havσá ß
problem«
KeyboarΣ entrie≤ arσ handleΣ b∙ thσ FORT╚ worΣ EXPECT¼ whicΦ
onl∙ know≤ abou⌠ tw∩ 'specialº keys║á <BACKSPACE╛ anΣ <CR>«á An∙
othe≥ ke∙ i≤ assumeΣ t∩ bσ ß valiΣ character«á N∩ MS-DO╙ editinτ
function≤ arσ available«á Thσ exac⌠ ke∙ whicΦ EXPEC╘á recognize≤
a≤á <BACKSPACE╛ i≤ se⌠ iε FORTH'≤ colΣ star⌠ parameter≤ t∩ <CTRL-
H╛ ¿ notσ changσ froφ fig¼á wherσ <BACKSPACE╛ ╜ 5╞ he° )« Iµ yo⌡
tr∙á t∩ backspacσ pas⌠ thσ beginninτ oµ thσá line¼á thσá termina∞
shoulΣá bee≡á anΣ leavσ thσ curso≥ a⌠ thσ beginninτ oµ thσá line«
Notσ als∩ tha⌠ thσ backspacσ i≤ destructive¼á anothe≥ changσ froφ
thσ fig-FORT╚ EXPECT.
Othe≥ keyboarΣ function≤ arσ provideΣ b∙á MS-DOS«á <CTRL-S╛
wil∞á pausσ consolσ output╗á <CTRL-P>/<CTRL-N╛ toggle≤á printe≥
echo« <CTRL-C╛ cause≤ executioε oµ thσ FORT╚ worΣ (ABORT)¼ whicΦ
execute≤ ABORT¼á haltinτ an∙ i/o¼á resettinτ thσ tex⌠ interprete≥
anΣ printinτ thσ start-u≡ banner«á ABOR╘ clear≤ thσ stacks¼á bu⌠
doesn'⌠á empt∙ thσ disδ buffers«á T∩ tes⌠ thesσ functions¼á typσ
VLIS╘á <CR>«á VLIS╘á shoulΣá begiεá printinτá thσá entirσá FORT╚
vocabular∙ a⌠ thσ console«á T∩ pausσ thσ listing¼ typσ <CTRL-S>╗
t∩ abor⌠ thσ listing¼ typσ <CTRL-C>.
Notσ tha⌠ (ABORT⌐ ma∙ bσ patcheΣ b∙ FORT╚ t∩ executσ ß user-
defined error handler.
2. Compiling definitions
Therσá i≤ nothinτ peculia≥ abou⌠ enterinτ definition≤ a⌠ thσ
keyboard«á Oncσ yo⌡ typσ ß ':'¼á yo⌡ arσ iε thσ compilinτ state«
N∩á 'okºá i≤ printeΣ unti∞ yo⌡ finisΦ you≥ definitioεá witΦá ';'«
Definition≤ ma∙ havσ u≡ t∩ 8░ character≤ oε ß line¼á anΣ a≤á man∙
line≤ a≤ needed«á However¼á n∩ editinτ i≤ possiblσ oncσ ß linσ i≤
endeΣ b∙ <CR>«á Iµ yo⌡ makσ ß mistake¼á you≥ definitioε mus⌠á bσ
starteΣ over.
3
Try the following definition.
: STAR 42 EMIT ;<CR>
FORT╚ shoulΣ responΣ 'okº afte≥ yo⌡ typσ thσ <CR>«á No≈ tr∙ you≥
definitioεá b∙ typinτ STAR<CR>«á FORT╚ shoulΣ prin⌠á '*ok'«á Iµ
tha⌠ worked¼ tr∙ this:
: MILKY-WAY
BEGIN
STAR SPACE SPACE
?TERMINAL
UNTIL ;
Remembe≥á yo⌡ won'⌠ ge⌠ aε 'okº unti∞ yo⌡ finisΦá thσá definitioε
witΦá thσ semi-colon«á An∙ leadinτ space≤ oε ß linσ arσ ignored«
Tes⌠ you≥ definitioε b∙ typinτ MILKY-WAY<CR>« Wheε yo⌡ ge⌠ tireΣ
oµ sta≥ gazing¼á sto≡ thσ prograφ b∙ hittinτ an∙ key«á Thσá star≤
should stop, and FORTH should say 'ok'.
Iµáá yo⌡á wan⌠á t∩á tr∙á morσá definitions¼áá fee∞á freσá t∩
experiment¼á bu⌠ don'⌠ tr∙ an∙ disδ operations«á A⌠ thi≤á point¼
all you would get is garbage.
3. Exiting FORTH
BY┼á i≤ thσ usua∞ fig-FORT╚ worΣ t∩ exi⌠ FORT╚ anΣ returε t∩
the calling program; COMMAND normally, or DEBUG.
4
D. Using the disk
1. FORTH's view of the disk
a. Blocks
Thσá commoεá FORT╚ mas≤ storagσ devicσ i≤ seeε a≤á ßá simplσ
arra∙á oµá blocks¼á referreΣ t∩ b∙ number¼á froφ zer∩ u≡á t∩á thσ
physica∞ capacit∙ oµ thσ disk«á Thesσ block≤ arσ accesseΣ iε an∙
orde≥á anΣá completel∙á independen⌠ oµ thσá MS-DO╙á filσá system«
Thus¼á FORT╚á canno⌠á acces≤ MS-DO╙ files¼á anΣ FORT╚á disk≤á arσ
nonsensσ t∩ MS-DOS«á Fo≥ thi≤ reason¼á yo⌡ wil∞ neeΣ ßá seperatσ
disk¼á dedicateΣá t∩á FORT╚á screen≤ ONLY«á Thσ disδá shoulΣá bσ
formatteΣá fo≥á single-densit∙á IB═á format«áá Thσá exac⌠áá disδ
parameter≤á caε bσ changeΣ t∩ othe≥ formats¼á bu⌠ yo⌡ shoulΣá usσ
thσá standarΣ one≤ unti∞ yo⌡ kno≈ wha⌠ yo⌡ arσ doing«á Iµá therσ
arσ an∙ file≤ oε thσ disk¼ it'≤ alrigh⌠ becausσ FORT╚ wil∞ ignorσ
them«
b. Screens
Internally¼á FORT╚á see≤á thσá disδ a≤á block-sizeΣá pieces╗
however¼á thσ use≥ i≤ presenteΣ witΦ ßá fixed¼á 1024-byte¼á chunδ
referreΣá t∩ a≤ ß screen«á Notσ tha⌠ ß screeε may¼á o≥ ma∙á not¼
corresponΣá t∩ onσ block«á ┴ FORT╚ screeε appear≤ a≤ 1╢ line≤ oµ
6┤á characters«á Thi≤á i≤ ONL┘ fo≥ appearancσ íá Therσá arσá n∩
physica∞á <CR>/<LF╛á character≤á betweeεá lines¼áá anΣá thσá 63rΣ
characte≥á iεá an∙á linσá i≤á logicall∙á adjacen⌠á t∩á thσá firs⌠
characte≥ iε thσ followinτ line«á Thσ firs⌠ linσ oµ tex⌠ screen≤
i≤ usuall∙ reserveΣ fo≥ ß shor⌠ descriptioε oµ thσ contents.
Usinτá 128-bytσá blocks¼á aε 8ó disδ iε thσ standarΣá forma⌠
hold≤ 187▓ block≤ ¿ 0-187▒ )¼á o≥ 23┤ screen≤ ¿ 0-23│á )«á Blocδ
1872 is the first block on drive 1.
T∩á tes⌠ FORTH'≤ disδ interface¼á tr∙ thσá following«á Star⌠
FORT╚ and¼á afte≥ yo⌡ ge⌠ thσ 'ok'¼ replacσ you≥ systeφ disδ witΦ
ß scratcΦ disδ a≤ describeΣ above« Bσ prepareΣ t∩ LOS┼ AN┘ FILE╙
oεá thi≤ diskíá Checδ thσ curren⌠ screeε b∙ typinτ 'SC╥ ?º «á I⌠
shoulΣ bσ ┤ ¿ whicΦ i≤ thσ initia∞ valuσ fo≥ thσ variablσ SC╥á )«
Iµá i⌠ isn't¼á typσ COLD¼á anΣ repea⌠ thσ abovσá procedure«á Thσ
curren⌠ screeε shoulΣ no≈ bσ 4« Typσ EDITO╥ t∩ selec⌠ thσ edito≥
vocabulary¼á theεá ente≥ 'WIPEº t∩ fil∞ thi≤ screeε witΦá blanks«
Don'⌠ bσ alarmeΣ iµ therσ i≤ n∩ disδ activit∙ a⌠ thi≤ point« No≈
typσ 'Lº t∩ vie≈ thσ screeε - i⌠ shoulΣ bσ al∞ blanks«á No≈ typσ
'FLUSH'«á No≈á therσá shoulΣ bσ somσ disδá activity¼á anΣá FORT╚
shoulΣ returε 'ok'« Iµ therσ seem≤ t∩ bσ somσ problem¼ d∩ ß COL─
start¼á anΣ tr∙ again«á Iµ thσ probleφ persists¼á makσ surσá thσ
scratcΦá disδ i≤ properl∙ formatted¼á anΣ tr∙ again«á Hopefully¼
therσ won'⌠ bσ an∙ hangups¼á anΣ you'l∞ ge⌠ thσ 'ok'«á No≈á typσ
'Lºá again«á FORT╚á shoulΣ g∩ bacδ t∩ thσ disk¼á theεá lis⌠á thσ
blanδá screen«á
5
Ente≥ somσ tex⌠ int∩ linσ zer∩ oµ thσ screeε b∙ typinτ '░ Tº
followeΣá b∙ '╨ ¿ thi≤ i≤ screeε 4¼á linσ ░ )'«á Lis⌠ thσ screeε
agaiε t∩ makσ surσ thσ tex⌠ i≤ properl∙ placed¼á anΣ usσ FLUS╚ t∩
senΣ i⌠ t∩ thσ disk« Wheε yo⌡ typσ 'Lº again¼ thσ tex⌠ shoulΣ bσ
jus⌠ a≤ yo⌡ lef⌠ it.
2. Creating and editing new words
Therσá arσá tw∩ line-orienteΣ editor≤ includeΣ iε thσá FORT╚
screens« Onσ i≤ thσ edito≥ a≤ describeΣ iε "Startinτ FORTH"╗ thσ
othe≥áá i≤á thσá fig-FORT╚á portablσá edito≥á describeΣá iεáá thσ
Installatioεá Manual«á Thσá editor≤ ma∙ bσ useΣ t∩ placσá sourcσ
tex⌠á oε disk¼á wherσ i⌠ caε bσ modifieΣ withou⌠á re-writinτá thσ
wholσá definition«á Thσ edito≥ describeΣ iε "Startinτ FORTHó ha≤
beeε compileΣ anΣ includeΣ iε thσ .CO═ file.
Tr∙á editinτá thσ definition≤ abovσ fo≥ STA╥á anΣá MILKY-WA┘
onto a screen on your scratch disk.
3. Compiling source screens
Wheεá yo⌡ havσ finisheΣ enterinτ thσ definitions¼á usσ FLUS╚
t∩ makσ surσ thσ disδ ha≤ thσ lates⌠ versioε oµ thσ screen¼á theε
typσ '┤ LOAD'« Iµ FORT╚ say≤ 'ok'¼ tes⌠ you≥ ne≈ version≤ oµ thσ
definition≤á t∩ makσ surσ the∙ werσ compileΣ correctly«á Iµá yo⌡
ge⌠á aε erro≥ whilσ loading¼á usσ WHER┼ t∩ seσ thσ linσ wherσ thσ
problem is.
Iµ everythinτ look≤ 'okº u≡ t∩ thi≤ point¼á theε yo⌡ caε usσ
DEBU╟, a≤ describeΣ below anΣ iε thσ termina∞ sessioε listing¼ t∩
movσá thσ MS-DO╙ filσ oµ FORT╚ screen≤ ove≥ t∩ you≥ scratcΦá disδ
where FORTH can use them.
6
E« Modifyinτ FORTH
1. Saving new FORTHs
Onσ oµ thσ nicσ thing≤ abou⌠ FORT╚ i≤ thσ abilit∙ t∩á extenΣ
thσ language«á Iµ yo⌡ definσ ß worΣ whicΦ yo⌡ wan⌠ t∩ usσ often¼
withou⌠ re-compilinτ i⌠ ever∙ time¼ yo⌡ caε savσ thσ change≤ iε ß
ne≈ .CO═ file«á Thσ proces≤ involve≤ usinτ DEBU╟ t∩ loaΣ FORTH'≤ ì
FORT╚ itselµ )¼ executinτ thσ FORT╚ word≤ NE╫ ¿ whicΦ update≤ al∞ ì
thσ COL─ star⌠ parameter≤ ⌐ anΣ SIZE┐á ¿ whicΦ tell≤ yo⌡ ho≈á biτ ì
thσá ne≈ dictionar∙ i≤ )¼á theε exitinτ FORT╚ anΣ usinτ DEBU╟á t∩ ì
writσá thσá ne≈á .CO═ file«á Fo≥ ßá detaileΣá example¼á seσá thσ ì
termina∞ sessioε listing.
FORTH'≤áá .CO═á filσá a≤á distributeΣá wa≤á constructeΣáá b∙
assemblinτ thσ source¼á theε LOADinτ additiona∞ word≤ ¿ includinτ
thσá edito≥ )¼á anΣ savinτ thσ resultinτ dictionar∙ usinτá DEBUG« ì
Thσ FORT╚ screen≤ loadeΣ t∩ producσ FORTH.CO═ caε bσ founΣ iε thσ ì
termina∞ sessioε listing.
2. Patching
Mostá oµ thσ parameter≤ whicΦ affec⌠ thσ operatioε oµá FORT╚
arσ placeΣ iε thσ boot-u≡ paramete≥ areß a⌠ thσ lo≈ enΣ oµ FORTH«
Thesσ ma∙ bσ freel∙ modifieΣ usinτ DEBUG¼á o≥ froφ withiεá FORTH«
Oεá executioεá oµá COLD¼á thσ change≤ wil∞ bσá incorporateΣá int∩
FORTH« Patche≤ sucΦ a≤ thi≤ caε bσ madσ permanen⌠ usinτ DEBUG.
2. Assembly source modification
Change≤á no⌠ possiblσ througΦ thσ othe≥ tw∩ method≤á caεá bσ
incorporateΣá int∩á thσ assembl∙ source«á Yo⌡ caε stud∙ thσá fiτ
listinτ fo≥ detail≤ oε thσ inne≥ working≤ oµ thσ interpreter;á o≥
my listing for details specific to MS-DOS.
Notσá thσá alignmen⌠ requirements«á Thσ ALIG╬ pseudo-o≡á i≤ ì
requireΣá wheεá thσá namσá lengtΦ i≤á even¼á anΣá als∩á wheεá thσ ì
alignmen⌠á ma∙á havσ beeε los⌠ iε thσá previou≤á word«á Thi≤á i≤ ì
s∩ tha⌠ yo⌡ caε calculatσ thσ linδ fielΣ fo≥ thσ followinτ word.
Bσá awarσ oµ tw∩ problem≤ here║á first¼á i⌠ i≤ ver∙ eas∙á t∩
losσáá tracδáá oµá thσá change≤á yo⌡á make¼áá s∩á documen⌠áá EAC╚
modification«á Second¼á morσ change≤ makσ you≥ versioε oµá FORT╚
morσ uniquσ ¿ o≥ maybσ jus⌠ strangσ )¼á anΣ an∙ definition≤ usinτ
tha⌠á uniquσ featurσ les≤ portable«á WeigΦ thesσ factor≤á beforσ
makinτ change≤ t∩ thσ source«á Don'⌠ adΣ bell≤ anΣ whistle≤ jus⌠
to be different.
7
F. Glossary extension
Thσá followinτá i≤á aε extensioε oµ thσá fig-FORT╚á glossar∙
included in the fig Installation manual.
1. Assembly listing additions
Thσá followinτá word≤ werσ addeΣ t∩á thσá assembl∙á listing«
They are all CODE level words.
(2ARR) n1 n2 PFA -- addr
Tw∩á dimensiona∞ arra∙ primitivσ useΣ b∙ 2ARRAY«á Thσ addres≤ oµ
thσ arra∙ elemen⌠ a⌠ ro≈ n1¼á columε n▓ oµ aε arra∙ beginninτá a⌠
PFA+┤á i≤á lef⌠ oε thσ stack«á I⌠ i≤ assumeΣ tha⌠ thσ rowsizσá ¿
i.e.¼á ú column≤ ⌐ i≤ storeΣ a⌠ PFA« Thσ content≤ oµ PFA+▓ woulΣ
normall∙á holΣá thσá numbe≥á oµ rows¼á bu⌠ i≤á no⌠á useΣá iεá thσ
calculation.
(2CARR) n1 n2 PFA -- addr
Tw∩á dimensiona∞á bytσá arra∙ primitivσá useΣá b∙á STRINGS«á Thσ
addres≤á oµá thσ arra∙ elemen⌠ a⌠ ro≈ n1¼á columε n▓ oµ aεá arra∙
beginninτ a⌠ PFA+┤ i≤ lef⌠ oε thσ stack«á I⌠ i≤ assumeΣ tha⌠ thσ
rowsizσá i≤ storeΣ a⌠ PFA«á Thσ content≤ oµ PFA+▓ coulΣ holΣ thσ
numbe≥á oµ row≤ o≥ thσ curren⌠ lengtΦ oµ thσ string╗á i⌠á i≤á no⌠
useΣ iε thσ calculation.
(ARRAY) n PFA -- addr
Intege≥á arra∙ primitivσ useΣ b∙ ARRAY«á Thσ addres≤ oµ thσá ntΦ
elemen⌠ iε thσ arra∙ beginninτ a⌠ PFA+▓ i≤ calculateΣ anΣ lef⌠ oε
the stack. The length of the array is stored at PFA.
(CARR) n PFA -- addr
Bytσá arra∙á primitivσ useΣ b∙ CARRAY«á Thσ addres≤ oµá thσá ntΦ
characte≥ iε thσ arra∙ beginninτ a⌠ PFA+▓ i≤ calculateΣ anΣá lef⌠
oε thσ stack«á Thσ lengtΦ oµ thσ array¼ o≥ curren⌠ lengtΦ oµ thσ
string may be stored at PFA.
(XOF) n1 n2 -- n1 ( no match, n1<>n2 )
n1 n2 -- ( match, n1=n2 )
Contro∞á structurσ primitivσ compileΣ b∙ OF«á Iµ thσ casσá beinτ
scanneΣá fo≥ (n1⌐ matche≤ thσ curren⌠ casσ (n2)¼á thσ taτá n▒á i≤
dropped¼á anΣ thσ FORT╚ word≤ followinτ thσ brancΦ compileΣ b∙ O╞
arσ executed«á Iµ thi≤ i≤ no⌠ thσ casσ selected¼ thσ taτ i≤ lef⌠
oε thσ stack¼ anΣ scanninτ continue≤ witΦ thσ nex⌠ case.
1- n -- n-1
2- n -- n-2
Decrement operators.
8
:! n seg offset --
:@ seg offset -- n
:C! n seg offset --
:C@ seg offset -- n
Fa≥ fetch/storσ operators«á Thesσ arσ simila≥ t∩ thσ usua∞ FORT╚
fetch/storσ words¼á excep⌠ the∙ usσ ß double-worΣ address«á Notσ
that the absolute location accessed is: seg*16 + offset.
BLOCK-READ --
BLOCK-WRITE --
Primitivσá routine≤ responsiblσ fo≥ disδ access«á Thesσ routine≤
usσá thσá FORT╚ variable≤ DRIVE¼á USE¼á SEC/BLK¼á anΣá RECOR─á t∩
transfe≥á thσá appropriatσá numbe≥ oµ disδá record≤á to/froφá thσ
buffe≥á specifieΣá b∙á USE«á Thσ FORT╚á variablσá DISK-ERRO╥á i≤
set/rese⌠á t∩á signa∞á aεá error«á DISK-ERRO╥á i≤á zer∩á iµá thσ
operatioεá wa≤ successful╗á non-zer∩ iµ not«á Thσ erro≥ codσá i≤
tha⌠ returneΣ b∙ thσ MS-DO╙ read/writσ interrupt≤ ¿ 25╚ ª 26╚á )¼
excep⌠ tha⌠ writσ error≤ are negative.
DATE! mon day yr --
DATE@ -- yr day mon
Datσ fetch/storσ operators«á Iµ an∙ oµ thσ parameter≤ arσ ou⌠ oµ
range, no changes are made.
MYSEG -- seg
Thi≤á worΣá return≤ thσ valuσ oµ FORTH'≤ curren⌠á segment«á Thi≤
allow≤á thσá thσ fa≥ fetch/storσ operator≤á t∩á acces≤á location≤
inside FORTH in the usual way.
PRINTER -- addr
┴á variablσ whicΦ cause≤ consolσ i/∩ t∩ bσ echoeΣ t∩ thσ printer«
Iµ PRINTE╥ i≤ non-zero¼á thσ printe≥ i≤ 'on'«á Notσ tha⌠ thi≤ i≤
independen⌠ oµ thσ <CTRL-P>/<CTRL-N╛ ech∩ !
RECORD -- addr
┴á variablσ whicΦ contain≤ thσ numbe≥ oµ thσ las⌠ logica∞á recorΣ
accessed«á RECOR─á i≤ se⌠ b∙ T&SCAL├ anΣ useΣ b∙ BLOCK-REA─á anΣ
BLOCK-WRITE.
TIME! [sec csec] [hr min] --
TIME@ -- [sec csec] [hr min]
Timσá store/fetcΦ operators«á Thesσ routine≤ set/ge⌠ thσá systeφ
time« Iµ an∙ oµ thσ parameter≤ arσ invalid¼ n∩ change≤ arσ made«
Al∞ oµ thσ value≤ arσ bytes¼á bu⌠ arσ packeΣ int∩ ▓ words╗á i.e.¼
thσá lo≈ bytσ oµ thσ to≡ stacδ iteφ hold≤ thσ minutes¼á thσá higΦ
byte holds the hours, and so on.
9
2. Deleted words
Thσá followinτá word≤ appearinτ iε thσ fiτ assembl∙á listinτ
were not used, and therefore deleted.
SEC
TRACK
SET-IO
SET-DRIVE
SECRD
SECWT
3. High-level extensions.
Thσá followinτá word≤ werσ addeΣ b∙ compilinτ FORT╚á screen≤
anΣá savinτá thσ ne≈ versioε oµ FORT╚á usinτá DEBUG«á Thσá FORT╚
sourcσ fo≥ al∞ oµ thesσ word≤ i≤ includeΣ iε thσ screeε file.
ARRAY
2ARRAY
STRING
STRINGS
▒ anΣ ▓ dimensiona∞ arra∙ defininτ words« Seσ thσ sourcσ screen≤
for more comments.
CASE
OF ENDOF
ENDCASE
Thesσá word≤á adΣá ß casσ construc⌠ t∩á FORTH«á The∙á havσá beeε
documenteΣá iεá severa∞ differen⌠ places«á Seσ screeε 2▓ fo≥á aε
example.
DUMP addr -- addr2
Thi≤á worΣá display≤ thσ content≤ oµ locatioεá add≥á t∩á addr2-1╗
addr▓á i≤á lef⌠ oε thσ stacδ s∩ tha⌠ DUM╨ caε bσ entereΣá withou⌠
keepinτ tracδ oµ thσ address«á Thσ dum≡ i≤ iε thσ curren⌠ numbe≥
base«á ┴á variablσ SEGMEN╘ i≤ useΣ a≤ thσ base¼á anΣ add≥ i≤á aε
offset in that segment. SEGMENT is initialized to MYSEG.
NEW --
NE╫ update≤ thσ start-u≡ parameter≤ t∩ reflec⌠ thσ curren⌠á statσ
oµá FORTH«á Thi≤ allow≤ compileΣ definition≤ t∩ bσ retaineΣ wheε
COL─ i≤ executed«á Notσ tha⌠ oncσ NE╫ i≤ executed¼á iµ thσ addeΣ
word≤á arσá deleteΣ b∙ FORGET¼á thσ start-u≡ parameter≤á wil∞á bσ
wrong, and NEW must be done again before a cold start.
SIZE? --
Show≤á thσá curren⌠ sizσ oµ thσ FORT╚ dictionary¼á anΣá thσá freσ
spacσ remaining«á Thi≤ i≤ primaril∙ usefu∞ fo≥ tellinτ DEBU╟ ho≈
biτá ß filσ t∩ creatσ wheε savinτ ß ne≈ versioεá oµá FORTH«á NE╫
must be run before saving a different version.
10
G. FORTH application screens
1. Moving DOS files to FORTH screens
Occasionall∙á i⌠ ma∙ bσ usefu∞ t∩ havσ FORT╚ screen≤á residσ
iε ß DO╙ file« DEBU╟ ma∙ bσ employeΣ t∩ transfe≥ screen≤ betweeε
thσ tw∩ environments«á Bσ careful¼ back-u≡ botΦ disk≤ BEFOR┼ yo⌡
makσ ß mistake« Seσ thσ termina∞ sessioε listing≤ fo≥ ß detaileΣ
example.
2. Using the screens
Sincσá mos⌠á oµ thσ screen≤ arσ simplσ utilties¼á thei≥á usσ
shoulΣ bσ self-evident«á Hopefully¼á iε thσ future¼ morσ comple°
applications can be distributed.
LIFE
Thσá LIF┼á prograφá provideΣ i≤ nicσ t∩ watch¼á bu⌠ i≤á no⌠á ver∙
clearl∙á written«á Yo⌡ wil∞ havσ t∩ writσ you≥ owεá routine≤á t∩
positioε thσ curso≥ oε you≥ terminal« Thσ word≤ oε screeε 3▒ ma∙
servσá a≤ ß model«á Afte≥ loadinτ thσ firs⌠ screeε ¿ 3╡ LOA─á )¼
FORT╚á wil∞á inforφá yo⌡ ho≈ t∩ star⌠ thσ game«á T∩ se⌠á u≡á thσ
board¼á usσá <SPACE╛ » <BACKSPACE╛ t∩ movσ thσ curso≥ righ⌠á anΣ
left¼á anΣ <LINEFEED╛ t∩ movσ down¼á o≥ <CR╛ t∩ movσ dowε anΣá t∩
the beginning of the line. <ESC> starts the activity.
11
III. Technical matters
A. Modifications to fig-FORTH v1.0
Thi≤á sectioε describe≤ specifiπ change≤ t∩ thσ fiτá listinτ
a≤á outlineΣá iεá thσ Installatioε Manual«á Thσá heading≤á belo≈
corresponΣ t∩ thosσ iε thσ manual╗á iµ n∩ change≤ arσá noted¼á n∩
change≤ havσ beeε madσ t∩ tha⌠ par⌠ oµ thσ model.
1. Boot parameters
14 +ORIGIN ( BSIN ) Changed to 08 ( ASCII CTRL-H )
2. Machine code definitions
(FIND⌐ ChangeΣ t∩ accomodatσ word-aligneΣ LFA's« Seσ CREAT┼
below.
3. High-level utility definitions
1+ 2+ Changed to CODE level definitions.
TRAVERSE Modified to handle word-aligned LFA's
PFA Modified to handle word-aligned PFA's
EXPECT Backspace made destructive
ID. Modified to reset MSB of last character
CREAT┼á ModifieΣá t∩ compilσ dictionar∙ entrie≤ witΦá word-
aligneΣá LFA«á Iµá D╨ i≤ odΣ afte≥ compilinτá thσá name¼á D╨á i≤
incremented¼á s∩á tha⌠á thσ res⌠ oµ thσ definitioε fall≤ a⌠á eveε
adresses«á Iµá bytσá value≤á arσ compileΣá int∩á thσá definitioε
subsequently¼á thσ alignmen⌠ ma∙ bσ lost«á Notσ tha⌠ thσá lengtΦ
bytσá a⌠á NF┴ stil∞ give≤ thσ exac⌠ lengtΦ oµ thσ name¼á bu⌠á no⌠
necessaril∙ thσ displacemen⌠ t∩ thσ LFA.
QUIT Prints lower case 'ok'
ABORT Changed to print the user version as well
COLD Sets SCR to 4
4. Installation dependent code
a. Terminal i/o
(KEY) uses MS-DOS function 8
(EMIT) uses MS-DOS function 2
(?TERMINAL) uses MS-DOS function 11
(CR) uses MS-DOS function 2
b. Printer i/o
EPRINT Changed to PRINTER
12
c. Disk i/o
Al∞á disδá parameter≤á werσ moveΣ t∩ thσá beginninτá oµá thσ
listing¼á anΣ al∞ LITERA╠ parameter≤ iε definition≤ werσá changeΣ
t∩ usσ thσ EQ╒ symbols¼á o≥ FORT╚ variable≤ ¿ +BUF¼á R/╫ )« Al∞
disδá i/∩á i≤ donσ througΦ thσ blocδ read/writσá interrupt≤á 25H¼
26H«á Thσá variable≤á DISK¼á RECORD¼á SEC/BL╦ anΣ US┼ servσá t∩
specif∙ thσ disδ record anΣ transfe≥ address.
T&SCAL├ set≤ DIS╦ anΣ RECOR─ froφ thσ blocδ numbe≥ supplieΣ
b∙ R/W.
R/╫ call≤ T&SCALC¼ theε BLOCK-REA─ o≥ BLOCK-WRITE« Iµ DISK-
ERRO╥ i≤ non-zero¼á messagσ #╕ i≤ issueΣ anΣ thσ buffe≥ i≤ markeΣ
a≤á unused«á DISK-ERRO╥ caε bσ examineΣ b∙ thσ use≥ t∩ finΣá thσ
exac⌠á causσ oµ thσ error«á Thσ erro≥ code≤ arσ a≤ specifieΣá iε
thσá MS-DO╙ documentation¼á excep⌠ writσ error≤ arσá returneΣá a≤
negativσá number≤ ¿ e.g«á DISK-ERRO╥ ╜ -▓ fo≥ no⌠ read∙ erro≥á oε
writσ operatioε ).
5. High-level definitions
6. System tools
7. Ram workspace
8. Memory map
Thσá memor∙ ma≡ wa≤ expandeΣ t∩ usσ al∞ 64╦ ¿ LIMI╘ ╜á ░á )¼
and 16 block-buffers.
9. Other
COL─á set≤á thσ <CTRL-C╛ interrup⌠ vecto≥ ¿ MS-DO╙á functioε
25Φ ⌐ t∩ thσ addres≤ oµ ß codσ fragmen⌠ whicΦ vector≤ thσá inter-
prete≥ t∩ (ABORT).
BYE causes execution of interrupt 20h.
13
H. Future extensions
Therσá arσ ß numbe≥ oµ thing≤ ╔ woulΣ likσ t∩ adΣ t∩á FORTH╗
al∞á involvσ ß certaiε amoun⌠ oµ work¼á anΣ somσ arσ no⌠á a⌠á al∞
trivial«á Iµá yo⌡á arσ interesteΣ iε makinτ somσ suggestion≤á o≥
contributinτá an∙ changes¼á ╔ woulΣ certainl∙ enjo∙á talkinτá anΣ
trading. A list of these extensions would include:
Immediate future: High-level character string operators
High-level floating point
Screen editor(s)
Assembler
CommanΣ linσ argument≤ ¿ thi≤ i≤ ßá ver∙
simple possibility, I just haven't
found a good use for it )
Nea≥á future║á Rea∞ MS-DO╙ filσ interfacσ ¿ no⌠á jus⌠
random access )
I/O redirection via execution vectors
CODE level character string functions
??? future: Cross/target compiler
COD┼ leve∞ floating-poin⌠ » 808╖ support
Multi-segmented
Multi-tasking
Tree structured vocabularies/file system
High-level interrupt handling
14
IV« FORT╚ sources
Thσáá followinτáá arσá source≤á oµáá informatioεáá regardinτ
implementatioε anΣ usσ oµ FORTH.
Startinτ FORTH« Le∩ Brodie¼ FORTH¼ Inc« Prentice-Hal∞ 1981
Excellen⌠ introductor∙ material.
Byte¼ vol.╡ no.8¼ Augus⌠ 1980
Languagσá issuσá devoteΣ t∩ FORTH«á GooΣ discussioεá oµá defininτ
word≤ anΣ FORT╚ internals.
Dr« Dobb≤ Journal¼ vol.╢ no.9¼ Septembe≥ 1980
Dr« Dobb≤ Journal¼ vol.╖ no.9¼ Septembe≥ 1981
Issue≤ devoteΣ t∩ FORT╚ topics.
FORT╚ Interes⌠ Group
P.O« Bo° 1105
Saε Carlos¼ C┴ 94070
Publiπ domaiε listings¼ bi-monthl∙ newlette≥ FORT╚ Dimensions.
15
This disk copy was originally provided by "The Public Library",
the software library of the Houston Area League of PC Users.
Programs are available from the Public Library at $2 per disk
on user-provided disks. To get a listing of the disks in the
Public Library, send a self-addressed, stamped envelope to
Nelson Ford, P.O.Box 61565, Houston, TX 77208.