Home
V4N3 - Forth
Contents
1. CLEAR DO 01 C LOOP Suppose that our base is hexadecimal and we wish to clear memory between 2000 and EFFF With the new form of LOOP we could simply type F000 2000 CLEAR and the indicated area would be _ Cleared The routine would only clear one byte with the FORTH 79 or the fig FORTH version of LOOP The new loop considers that the index I lies on a number circle based on the usual 2 s complement arithme FORTH Dimensions tic for 16 bit numbers Thus there is a smooth transition between 1 and 0 and between 7FFF and 8000 hex 32767 and 32768 decimal There are a variety of ways to imple ment the new loop some of which re main to be discovered There are two parts to the problem One is to find a method of calculating the exit condi tions and the other is to allow LEAVE to work properly The fastest method of determining the exit conditions re quires that the actual value of be calculated by an addition or subtrac tion The items stored on the return stack or elsewhere are related to the limit and the index but are not necessarily the same For machines with a testable overflow bit the sug gested technique is to modify the limit and initial index so that the transition will lie between 7FFF and 8000 hex The overflow bit is set whenever an addition causes the result to cross the 7FFF to 8000 boundary Initially put limit lt limit 8000 P lt init limit To calculat
2. HReaeee DKS ILES FT setae 1 ee ee ee ee ee ee ee ee ee Files routines file block parkira File filspac puts ile sPec into Filbik sp 2 Gump over Letter count Filbik dup EB swap de set uP index dup rad50 i 3 2 looPp t increment addr and loop drop drop drop string and fFilblk Filblk chanbdlk 4 move 7 store ile name in array primitive routine takes a strina in the form DEVFILNAMEXT on the etring stack then Packs it in Proper format into File specification block FORTH Dimensions 11 Engineering for FORTH software of professional quality ready to run FORTH development systems application programs in FORTH Consulting services including custom program development Our latest product DUAL TASKING FORTH Now you can run your process control programs in background while still using your FORTH system in the normal way Background and foreground tasks may each be written in high level FORTH They can execute simultaneously and exchange data The foreground task can control the background task Available NOW 8 diskette 285 Write for our FORTH information booklet QTimin Engineering Co XoY 6044 Erlanger St Oo San Diego CA 92122 714 455 9008 4 Volume IV No 3 TEST FLY A 20 MILLION JET ON AN APPLE At the Bethesda Naval Research Center they ve discovered the power
3. Files routines RADSO conversion octal e radSoO addr n dup 3 swap do i cB gt br50 looe swaP rot 50 Si converts 3 characters i e bytes startina at addr into sinsle 1 word integer RADSO equivalent decimai radSO n addr gt r TSO gt r c r8 i o p gt 2 p gt converts RAD St n into 3 characters bytes starting at addr 10 Volume iV No 3 ptu OK TE TLES FTH wate tte te Pi RAH HD Te A AE E ee t Fles routines file strings handlina trO n 3 BO gt emit emit emit 7 prints tke characters stored as RADSS integer n Filnam addr fire r50 gt l C Print FIbaeser dup 2 r30O gt 46 emit 3 amn NAM na e 4 r50 OO 20 estes EXT z fslspec addr dup r30 gt 38 emit 1 print BEV 2 fFiinam Print FILNAM EXT Prints File specifications stored in 4 word block at addr pyara DK TEILES ETH sea teen 8 cee ee ee ee ee t Files routines file string handlins gt filefill addri addr2 i4 over c store lensth byte i 0 do over i 2 over radSo gt 3 loop Z2drop if 4 word File specifications besins at addri will make a TYPEable string at add HHEHEH DKIFILES FTH g Pe SSCP SLCC PPT E E E Files routines file array z OFilbik builds 8 allot does gt chan 8 1G dF ilb1K chanblk cr ate a string array to hoid iG file bleck srecifations
4. I wish to announce a new company in the FORTH arena Charles H Moore amp Associates Of the many opportunities available in the growing FORTH community we plan to spe cialize in custom applications At the moment that means software But when the FORTH chip becomes avail able so will custom hardware Moore amp Assoc will be a distributed network of programmers linked to each other through their computers Thus half of the associates will be com puters and the others humans Toge ther we will have the flexibility of working at home at the customer s site or at the place of our choosing Anyone knowing of applications demanding more than one FORTH programmer is invited to contact me Charles H Moore amp Assoc Drawer CP 66 Manhatten Beach CA 90266 I ll keep you informed of develop ments Charles H Moore Volume V No 3 Forte A FORTH Based Operating System John S James Colon Systems Does FORTH need an operating system If so what requirements are most important and how can a system be designed to provide them We believe that the answers to these ques tions are crucial to the future role of FORTH FORTH includes its own operating system and for years most users have been content to run it on a stand alone basis The advantages of fast develop ment transportability among different types of CPUs interactive flexibility and reliable and efficient software development are avai
5. In stead of each node having an arbitrary number of points namely to each of its children we make each node con tain exactly two pointers One to its next sibling and one to its first child Note that as in Fig 1 the leftmost child of the root has 2 children of its own and the rightmost child of the root has 4 children This structure also has some disadvantages We can no longer answer the question Who is the nth son of a node as quickly as we could with the structure in Fig 1 for now we must search through a linked list to find the answer However now we no longer need a dynamic storage allocator and we can quickly find the next sibling of a particular node Life is full of tradeoffs We will use the representation described in Fig 2 for our solution Now let s try to figure out in English what this beast is supposed to do Starting at the top the thing that defines the root should set up the root word so that it has no siblings and no children Put another way we want to create a defining word called ROOT which initializes 2 pointers to empty That much is trivial The FORTH code 28 for it is simply ROOT CREATE 0 Siblings 0 Children Thus we have specified the compile time behavior of the word ROOT Now we want to take a look at the run time behavior of the word defined by ROOT Suppose we said ROOT COLOR What is it we want COLOR to do if we said COLOR RED Well we want COLOR to CREATE th
6. block is named as the constant address so when I write a letter I begin the block with start address load then continue with the date the addressee s name etc Saves me from having to remember where I live Suggested Extensions There are a number of niceties I ve left out of this published version For one thing I wanted to keep it simple For another those niceties are reserved for the product version which I plan to sell for about 30 But I ll give you some hints if you want to spend the time you can add them yourself Of course there are all the obvious extensions such as page numbering item numbering automatic heading footing justification etc Perhaps less obvious additions are a user switchable log facility which optionally prints the corresponding block numbers beside the text in the formatted output This makes later editing extremely easy Also an escape from formatting the document during output can be very handy And of course there are routines to take advantage of your printer s capabilities My own verison for the Epson printer can print boldface words in the middle of normal text or lines or even paragraphs in double width compressed or both at the same time keeping the natural margins of the paper and of course do underlining A word you ll definitely want to add FORTH Dimensions right away is print It should take a block number on the stack direct your computer s
7. 99 95 ENHANCEMENT PACKAGE FOR V 2 Fioating point 49 95 COMBINATION PACKAGE Base amp Floating point advantage users add 49 95 for Hi Res CA res add 6 tax COD amp dealer inquiries welcome MicroMotion 12077 Wilshire Bivd 506 L A CA 90025 213 821 4340 Specity APPLE CP M or Northstar Dealer inquiries invited FORTH Dimensions Volume IV No 3 FOR TRS 80 MODEL OR III IBM PERSONAL COMPUTER MORE SPEED 10 20 times faster than interpreted BASIC MORE ROOM Very compact complied code pius VIRTUAL MEMORY makes your RAM act larger Variable number of block ele the 31 char unique wordnames use only 4 bytes in header MORE INSTRUCTIONS aae TOUR commanda to its 72 STANDARD plus Instruc tion set Far more complete than most Forths single amp double precision arazi ing handling clock graphics IBM low res gives and 18 color or 200 tint color display MORE EASE Excellent full screen Editor structured amp modular programming Word search utility THE NOTEPAD letter writer Optimized for your TRS 80 or IBM with keyboard repeats upperiower case display driver full ASCII MORE POWER Forth operating system Concurrent tnterpreter ANO Compiler VIRTUAL VO for video and printer disk and tape OOM oa rtf hard disk available Fuil or 8088 Assembler aboard 280 Assembler also available for TRS 80 Intermix 35 to 86 track disk drives IBM can read write and run M 3 Di
8. FORTH 79 V 2 requires 48K amp 1 disk drive ENHANCEMENT PACKAGE FOR V 2 Floating point amp Hi Res turtle graphics COMBINATION PACKAGE CA res add 6 tax COD accepted 99 95 49 95 139 95 MicroMotion 12077 Wilshire Blvd 506 L A CA 90025 213 821 4340 Specify APPLE CP M or Northstar Dealer inquiries invited FORTH 79 Version 2 For Z 80 CP M 1 4 amp 2 x amp NorthStar DOS Users The complete professional software system that meets ALL provisions of the FORTH 79 Standard adopted Oct 1980 Compare the many advanced features of FORTH 79 with the FORTH you are now using or pian to buy FEATURES OURS OTHERS 79 Standard system gives source portability YES Professionally written tutorial amp user manual 200 PG Screen editor with user definable controls YES cece Macro assembler with local labets MES Wi Virtual memory YES aame BDOS BIOS amp console control functions CP M YES FORTH screen files use standard resident file format YES Ree Double number Standard amp String extensions YES n _ Upper ower case keyboard input YVES we APPLE II Ii version also availabie YES m Affordable 99 95 me Low cost enhancement options Floating point mathematics YES Tutorial reference manual 50 functions AM9511 compatible format Hi Res turtle graphics NoStar Adv only YES lt i FORTH 79 V 2 requires CP M Ver 2 x
9. FORTH Instead most FORTH devel opment projects are written from scratch except for routines which may have been copied or more usu ally adapted out of listings and retyped or subroutine packages from a single source usually provided as part of the system package Obstacles to Modularity What are the obstacles to inter installation use of pre developed soft ware modules These are presented in the order in which they might affect a project A Incompatible media formats Available programs can help over come this problem by transmitting source code serially see Grotke G T Transfer of FORTH Screens by Modem FORTH Dimensions I1I 5 p 162 but such programs are not widely used probably because of the other problems which are outlined below B Only source can be transported if the developer will release it C Stand alone FORTH does not have directories or named files so screen ranges must be considered when source modules are copied The source may need to be edited to get it in a reasonable order D Any word name conflicts must be resolved These conflicts will usu ally involve words internal to the modules which the developer who is using those modules should be able to ignore E The final system may not fit in memory Even if more than 64K is available stand alone FORTH is not automatically set up to use it F Ifthe system does not fit a special overaly technique may need to be devel
10. I proceeded to write a quick scaled down word processor using the same syntax as that used at FORTH Inc The formatter portion occupied three screens and the editor portion nine screens not terribly sophisticated but at least the flaky tape and smelly fluid were back in the drawer This two part article features that simplified application which I call QTF the Quick Text Formatter For those of you who are running FORTH but don t have an off the shelf word processor whether because you don t write enough to justify it or because you can t afford it this month you may find this application quite attractive The basic approach takes some get ting used to but it has some definite advantages aside from simplicity In fact over the past several months I ve extended this approach to include many features I need in producing FORTH Dimensions technical manuals And the enhanced version will most likely become a product Another reason I m publishing the QTF here is this if any authors of future FORTH Dimensions articles were to use this application it would be extremely easy to transfer the text using any routine for transfering FORTH screens Eventually IIl be able to phone this directly to our typeset ter saving everyone a bit of work The final reason I m publishing the QTF is because we need more pub lished FORTH applications This one represents an interesting solution to a real problem The
11. Since printing a document consists of LOADing a series of FORTH blocks you can use any method that your system provides for doing that If you re preparing a short document one or two pages it s fine to use a series of blocks linking one to the next with the word But for longer documents such as book chapters or long articles it turns out to be much easier to provide a load block This block contains the main title and all the section titles but between section title will be a load statement e g 98 load By sticking to this approach you give yourself a directory to all the blocks in your document It s easy to move sections around if necessary by just changing the load order The QTF Editor lets you move text strings from block to block too Within each section blocks can be FORTH Dimensions 18 Volume IV No 3 linked together by arrows or alter natively you can define the word thru to load a range of blocks from the load block Notice that you can format load any block at any time You don t have to start from the beginning of the document That s the other advantage of using a load block you can review the entire document by loading the load block or just sections by loading the section blocks Sometimes it s convenient to define the load blocks to frequently used documents as CONSTANTSs In fact for my correspondence I have a block reserved for my return address This
12. TMARGIN O DO line LOOP 3 newpage begin next page CR FORMFEED start 4 cr begin next line if at bottom start new page 5 DOWNWARD 32 BMARGIN gt IF newpage ELSE line THEN 6 crs of crs O DO cr LOOP 7 pp start new paragraph er cr 8 tab n skip to position n relative to left margin 9 ACROSS LMARGIN 1 MAX SKIP 10 s indent n tab and reset left margin until next delim 1i DUP XTRA tab 12 hang ind n indent subsequent lines indent 3 more 13 DUP tab 3 XTRA 14 gt 15 Screen 35 crc ver 13904 O Text Formatter 08 09 82 s c 1 PNEAR true near right ACROSS RMARGIN gt 2 PWRAP true at very edge ACROSS 2 PAPER 3 LETTER current char BLK BLOCK gt IN 4 FLUSH LEFT after a cr don t output a 2nd blank 5 cr LETTER BL IF 24 gt IN THEN 6 PARSE c display text to delimiter c within margins 7 DELIMITER BEGIN LETTER 1 gt IN DUP 8 DELIMITER IN 1023 OR O WHILE DUP EMIT 9 1 ACROSS BL WRAP OR IF jj NEAR IF FLUSH LEFT 10 THEN THEN REPEAT DROP O XTRA 11 CEC ASCII 3 PARSE i2 ASCII PARSE 13 gt 14 15 Screen 36 cre ver 54948 O Text Formatter Extensions i sub cr 5 hang ind 2 subsub cr 10 hang ind 3 center center between margins 4 5 ASCII J WORD Cd 2 tab SIN C 3 re n right justify in field
13. are incorporated in the recursive procedure REJECT which uses the last outcode as true or false flag If true it returns to toplevel CLIPLINE having dropped one of the points or at any lower level having droped off the half of the current line that is entirely outside of the viewport Between MYSELFs is a test that drops the mid point if it happened to be inside the viewport so the search can continue onward for the other visible extreme of the line conducted by the other MYSELF If the actions of a recursive procedure are planned in advance then the procedure as a whole can be written to follow those rules and each recursive call can be trusted to follow those rules If REJECT returns false then CLIPLINE must plot the seg ment represented by the two endpoints left on the stack Continued Volume IV No 3 RETURN R gt DROP REJECT 2x 2y 20c 1x 1y 10 2x 2y TF 2xel 2ycl 2oc 1xcl Tycl FF TRIVIALREJECT IF 3DROP RETURN THEN TRIVIALACCEPT IF RETURN THEN INVIEWPORT IF 3SWAP MIDPOINT COINCIDE IF gt R gt R 3DROP R gt R gt 0 RETURN THEN OUTCODE 3SWAP MYSELF DUP NOT IF 3SWAP 3DROP THEN MYSELF 3SWAP ELSE MIDPOINT COINCIDE IF gt R gt R 3DROP R gt R gt 0 RETURN THEN OUTCODE 3SWAP MYSELF DUP NOT IF 3SWAP 3DROP THEN MYSELF THEN CLIPLINE 1x 1y 2x 2y OUTCODE 5 ROLL 5 ROLL OUTCODE REJECT DUP iF DROP 2DROP ELSE STRIPOUTCODES PLOTLINE THEN I find it unnecessary
14. can use COLOR to define a bunch of colors such as Volume IV No 3 RED WHITE and BLUE but the buck stops Fig 7 completely arbitrary TREE there When RED executes nothing POET In Fig 5 we have some code that will much will happen Exercise What print out the tree in indented form exactly would happen if we executed MILTON Fig 6 contains a sample Tree defini RED with the above definition ALLEGRO tion and finally Fig 7 shows the result Well let s see what we want RED to eines of printing out the Tree defined in Fig do when executed Suppose we said 6 with the code in Fig 5 I will not pp es OUTSTANDING 6 RED ROSE We would like to add ROSE PARADISE LOST explain how and why the code in Fig to the dictionary and link it into the OUTSTANDING 5 works since in the next issue I will child field of RED Isn t that exactly BYRON talk about Recursion in FORTH and what we wanted COLOR to do Of DON JUAN it is a pre requisite for understanding course it is so what we would really GREAT how INORDER works like is to have all subsequent words RANT RED One final note The code presented behave exactly the same What we S n will work with either FORTH 79 want is a perish the thought GOTO OKAY systems or systems compatible with before the to go back to just before SHELLEY Starting FORTH It will not work as the DOES gt Well for all you structured PROMETHEUS written with fig FORTH Feel free to programming fans who thought that GOOD e
15. for the system is in cluded Everything from the compiler core up can be stripped off and be recompiled in less than one minute This will allow you to modify or dedicate the system at will Then the new system can be saved as the boot system There is a files utility that allows you to take sectors from the Atari Disk File Manager which then sees them as if in use You can then read and write data directly to these sectors The directory is bypassed The utility draws a sector map in graphics using different colors to show the status of each sector Our user s manual is tutorial with numer ous examples and is designed for the begin ner All the standard FORTH words have been used so there is no relearning You work your way from adding numbers on the screen to maintaining a mailing list and producing graphics Minimum system configuration Atari 800 400 with 16K and disk 75 00 for disk and manual California residents add sales tax If interested in a cassette version contact Dan Bloomquist Nova Technology P O Box 688 Clearlake CA 95422 707 994 4649 994 1332 SEATTLE COMPUTER PRODUCTS 8086 fig FORTH 8086 fig FORTH modified to interface FORTH to SCP s 86 DOS and also com patible with Microsoft MS DOS and IBM PC DOS is available to anyone inter ested in learning more about FORTH This version of FORTH is useable I am currently developing some applications using it but is not as complete nor as
16. get the same results as published here and b you get the same result whether or not the final word in a block occupies the last bytes of the block Further cautions The program uses FORTH 79 WORD It can t handle comments longer than 255 characters The program uses unsigned ad dresses as LOOP parameters As long as WORD s buffer doesn t cross the 32K boundary everything s okay other wise you ll have to alter DISPOSE Finally we can t guarantee that the CRC algorithm used in ACCUMULATE is the best on land and sea It s adapted from a book and seems to work We d like to hear about flaws or improve ments We hope that this routine will become a standard We d like to see FORTH vendors include some com patible version of it in their systems Perhaps embedded as an option within LIST or TRIAD Good luck crc ver 34445 O Checksum for hand entered source screens i ACCUMULATE 256 XOR 80 DO DUP O lt IF ELSE DUP crcvalue adr len newcrcvalue SWAP i Ca BL AND OVER 1 AND 2DROP 41 i OVER SWAP DO I C3 ACCUMULATE LOOP LOOPs on addresses 2 3 4 DISPOSE 5 OVER DUP Ca 40 6 IF comment skip it 7 ELSE 8 9 THEN careful olderc char newcrc 16386 XOR DUP 1 THEN LOOP WORD DROP MORE adr f BL WORD DUP C 2 lt OVER 1 Ca 33 lt AND NOT 11 VERIFY 12 O BEGIN MORE WHILE BL OVER COUNT C R gt BLK 13 REPEAT D
17. in various ways to define higher level words which control groups of fields and entire commands Other Chapters Let s hear from you ee M6 P2 Q1 ene A5 M6 am C2 F3 K1 L2 3 paias C2 F3 L1 M5 M6 ee A2 M2 52 ETN I5 M2 P1 57 er A6 B1 C3 01 S6 T2 ENE A1 A6 B1 C3 01 56 T2 T5 suscten 15 M5 M6 S4 55 ee A3 F5 M4 T1 CPIM caisnradieccnanae A3 C2 F3 13 L3 M1 M2 M6 i Sai BM Ma Other Products Services Boards Machine F3 M3 R2 Computers Consultation C2 C4 N1 Alpha NictOnric ani P3 S3 Cross Compilers C2 F3 13 M6 N1 ea A eee A4 F4 I2 I4 J1 L4 M2 M6 O2 Products Various C2 F3 15 58 RS O03 SeaVMe Pe wema Bg cp nds ae Training F3 I3 FORTH Dimensions 34 Voiume IV No 3 FORTH Vendors The following vendors offer FORTH systems applications or consultation FIG makes no judgement on any product and takes no respon sibility for the accuracy of this list We encourage readers to keep us informed on availability of the products and services listed Vendors may send additions and corrections to the Editor and must include a copy of sales literature or advertising FORTH Systems A 1 AB Computers 252 Bethlehem Pike Colmar PA 18915 215 822 7727 2 Acropolis 17453 Via Valencia San Lorenzo CA 94580 415 276 6050 3 Advanced Technology Corp P O Box 726 Clinton TN 37716 4 Applied Analytics Inc 8910 Brookridg
18. is a possible defini tion for interger exponentiation using repeated squaring of the argument to reduce the number of multiplications This does indeed run faster than its sim pler DO LOOP equivalent Although the 16 bit result will overflow for all but the smallest exponents single length math lets the heart of the technique show through Thus its extension to higher precision or floating point is readily apparent Klaxon Suralis TIB 2 DUP OR IN R gt IN oR 5 CFA EXECUTE 0 IMMEDIATE Figure 1 O COMPLETE SOURCE OF DIRECT AND COMLIT 1 2 FORTH DEFINITIONS HEX 3 4 COMLIT R gt IN RR R3 5 INTERPRET IN R 5 R gt amp 7 COMLIT 8 COMP COMPILE COMLIT 7 9 10 DIRECT EXEC DP TIB 3 40 DP CSP J INTERPRET 11 TIB 3 40 gt R DP SMUDGE 12 13 14 15 3S Figure 2 O k xn x to the n gt i gt R 1 SWAP square repeatedly 2 BEGIN cumulat ve prod last factor 3 R 1 AND I th bit of n 4 IF apply and preserve factor 5 SWAP OVER amp SWAP THEN amp R gt 2 next bit of n DUP 7 WHILE gt R DUP new factor 8 REPEAT DROP 9 10 2 must be machine code shift 11 extendable to higher precision 12 and floating point x s 13 14 15 31 Volume IV No 3 NEW PRODUCT ANNOUNCEMENTS ATAFORTH The FORTH computer language designed for the Atari home computers ATAFORTH was written by Dan Bloomquist The source text
19. it s a problem either use a separate vocabulary or save this definition for last and only load this application when you re formatting text For example This string which would appear in your source formatting block would format this paragraph making the ap propriate line breaks at the right margin Obviously you can t cross block boundaries while inside text The word pp is a formatting com mand for starting a new paragraph it causes the formatter to do two car riage returns For instance the source This is paragraph A pp This is paragraph B would produce This is paragraph A This is paragraph B Essentially in creating a document you write a program to format the document using this specialized language The word r does a single carriage return Like pp it repositions the cur sor or printhead at the left margin set by the constant LMARGIN The words tab indent and hang ind allow you to get away from the left margin in very convenient ways You ll find all these formatting com mands in the accompanying glossary Figure 1 What about editing If you ve looked at the code for the for matting commands Figure 3 you may be saying There s nothing here This is useless Well you re half right The other half of this application which PrI feature in Part II is the text editor that you need to edit your text source It s impractical to use ordinary
20. looking much prettier if left unexpanded FORTH blocks in length Returns a Note The HEAD and NEXT macros used is exactly compatible with the FORTH PDP 11 listing flag tf which is 0 if successful or 1 if distributed by FIG Note Although CHAN is included the read write routines need to be taught to use CHAN as well As mentioned in the text either don t use CHAN for now or contact me HEAD 204 CHAN 240 CHANL DOVAR 7 tae CRAN WORD 0 HEAD 203 FDB 302 XFD DO0CON eee FDB WORD FSB HEAD 206 LOO0KUP 240 LOKUP LOOKUP MON CHANL 2 R1 GET CHANNEL FROM VARIABLE CHAN CLR gt ASSUME NO ERRORS LOOKUP EMTSLK Ri FDB BCC 1 gt DONE IF NO ERROR INC 5 PUT TRUE ON STACK FOR ERROR i NEXT HEAD ZOS ENTER 322 ENTER 7 44 ENTER MON CHANL 2 R1 gt MOWE THE CHANNEL TO Ri ASL 5 CONVERT FORTH SLKS TO DEC BLKS 2 ENTER EMTBLK R1 FDB 5 CLR S 7 CLEAR ERROR FLAG TO FALSE BCE 1 DONE IF NO ERROR INC S gt PUT TRUE ON STACK FOR ERROR 1 NEXT HEAD 205 CLOSE 303 CLOSE MOV CHANL 2 R1 CLOSE Rt CLOSE CHANNEL 1 NEXT EMTBLK BLKW 6 gt EMT BLOCK FDB RADSO DK FORTH DAT F CLOSE GET CHANNEL FROM USER VARIABLE CHAN unsuccessful e LOOKUP tf LOOKUP opens an existing file and returns an error flag similar to ENTER e CLOSE CLOSE closes the cur rently open file A listing of the code for the imple mentation as well as some interesting develop
21. n wide amp ASCII 3 WORD C3 O MAX SKIP gt IN C 3 7 load LOAD 8 9 10 11 12 13 14 15 Copyright 1982 Leo Brodie 08 09 82 7IN 3 RMARGIN LMARGIN 2 gt IN 3 SWAP 09 01 82 words for each document The idea is to describe the format of a document in logical terms rather than pro cedural terms For instance if you begin each title of a chapter subsection with the word subsection or some such descriptive name then at any time you can change the defini tion of subsection to print the section title in boldface or perhaps to under line or perhaps to begin the section on a new page When you do define special words there s a peculiar caution that I almost hate to bring up some FORTH systems print a message such as is redefined or isn t unique when a word is defined twice My personal opinion is that this test should be user switchable On such systems you can t print the same document twice without getting the error message in the middle of your document unless you take some special measure For in stance you could define all your special formatting words in a separate block and only load the block once Or you could define a dummy word called tabs on the top of the text for matter application and begin each document with the phrase FORGET tabs tabs or some such Text Management A few more words about working with the block modules
22. of environ ment it is yet more helpful Unlike the deeper aspects of good programming practices the formatting rules can be mastered and applied without serious error within about five minutes of the time they are first explained That s a pretty low cost for even an incremen tal improvement in readability By now I have seen about 100 people start FORTH None has ever complained seriously about formatting requirements Scores have bemoaned FORTH s tendency to be a write only language As more of our code has been formatted the moaning of the novices has decreased markedly To me that s important Suppose that FORTH allowed screens to be written backwards or that spaces between words might be omitted unless an ambiguity was thereby created The latter would cer tainly result in much more compact code ti daer ot nrael yllautneve thgim secivoN But what s the point In designing a language as in designing a government building in a Jot of freedom is good In each case it is not always a virtue or even kind to yourself to use all of it It s a virtue of FORTH that it leaves the user com munity free to decide on formatting conventions appropriate to the task at hand and the needs of the community There is no forthly imperative to hang yourself just because FORTH gives you enough rope to do so Stephen B Bracker Fermilab Users Office Batavia Illinois Charles Moore s New Venture Dear Fig
23. output to the printer LOAD the given block then return output to your console This is system depen dent stuff so I don t show it here lf you type it in I ve included checksum verifications at the top of each screen See the arti cle on checksums elsewhere in this issue This application is designed to run on FORTH 79 Standard To run it on a fig FORTH system you should predefine VARIABLE 0 VARIABLE CREATE VARIABLE 2 ALLOT gt IN IN WORD WORD HERE Some systems may require that you predefine 32 CONSTANT BL ASCII BL WORD 1 Ce COMPILE LITERAL IMMEDIATE where WORD is the 79 Standard version Finally remember that the Format ter will be frustrating to use until you have the Editor Can you wait till the next issue Notice Permission to use this application is granted for individual personal use in a non commercial manner All com mercial rights reserved Acknowledgements I thank FORTH Inc for permission to use this syntax which was originally invented by Charles Moore The entire text of Starting FORTH was done on a word processor that used this general approach Leo Brodie is an author lecturer and consultant specializing in FORTH He teaches the Advanced Systems Course at Inner Access Corporation and has written system documentation for three FORTH vendors He is also editor of FORTH Dimensions Magazine He no longer dances to 50 s music but in stead listens al
24. prefer The old LOOP and LOOP operate in two separable steps first add the in crement to the index then compare that new index value to the limit Static and easily understood but the differing flavors of numeric compari son signed lt unsigned U lt circular 0 lt beget a multitude of variations 32K circular LOOP unsigned incrementing LOOP unsigned decrementing LOOP and that horror of horrors the FORTH 79 signed LOOP and LOOP What s wild is the same form of LEAVE works for all of em FORTH 79 s LEAVE works by equating the loop s limit parameter to the current index Thus continues pardon the grammar to return its expected value while execution proceeds normally until a LOOP or LOOP is encountered At that point loop termination is assured in nearly all practical cases whether the increment is positive or negative The new LOOP and LOOP fuse the addition and the comparison steps into one indivisible calculation The flag for go no go arises as a natural by product of adding increment to index If during any one transition the index crosses the invisible boundary be tween limit and limit 1 in either direc tion then the loop terminates Else you branch back for another go round What s the payoff for all this confu sion For one thing the new LOOP and FORTH Dimensions LOOP can run much faster than their two step predecessors For another the same looping word will w
25. these problems and provides some ex tra features especially useful in the prose writing process So tune in next issue and in the meantime let s look at some of the benefits of the QTF approach Formatting Extensibly To illustrate how nice it is to have FORTH underneath you Figure 2 shows the formatting source that pro duced the glossary in Figure 1 Ac tually Figure 2 is a reproduction of the display produced by the QTF Editor Let s look at the source in Figure 2 and see what it does The document begins with a com ment just like a regular FORTH screen useful in recognizing the text when doing an INDEX Naturally the comment uses FORTH s ordinary parenthesis Next we find a FORTH definition We re defining the word means to do a hanging indent at tab position 15 We ll see how this definition is used momentarily After the definition comes the com mand start which initializes certain variables and moves the printhead down several lines from the top of the page Next we find the format command center following the text to be centered on the page The square bracket is part of the word center to remind us that it also indicates the beginning of some text After some more titles we format the first word in our glossary which happens to be the word start by delimiting it on both sides by square brackets Here is where our special purpose word means comes in it tabs over to the secon
26. well documented as a commercial product Additional changes to the source align definitions so that word pointers can always be accessed in one bus cycle add code level array and string primitives and support fetch and store operations outside the memory segment occupied by FORTH Typical execution times on the IBM personal computer are comparable to 6 MHz Z 80 benchmarks which have been published On the SCP system at 8 MHz execution times are one half to one quarter the Z 80 times The Sieve of Eratosthenes benchmark see FD 3 181 runs in just under 34 seconds Includes the assembly source the assembled system and some FORTH screens including the FIG editor and the Starting FORTH editor on disks for any of the above systems or in CPM format for 35 Joe Smith Univ of Penn Dept of Chemistry 34th amp Spruce Streets Philadelphia PA 19104 215 243 4797 FORTH Dimensions COURSE REVIEW Inner Access Corporation Advanced FORTH Systems Class 6 14 6 18 8e2 Reviewed by John Clark San Jose California This is a great class It will be very easy to recommend this class to any one requiring a detailed knowledge of the internals of FORTH or of the sev ral uses of FORTH covered in this class The small class size was great Leo Brodie is very easy to talk with and was always able to understand what we were having trouble with He also was able to jump right in and dig out how FIG FORTH worked when we found ou
27. you need Next to never I d say Using a faster CPU going to DTC or putting NEXT in line after each system CODE definition would return more on your invest ment Anyway if your loop is so tight and critical that the time eaten by LOOP or LOOP bothers you it s pro bably worth translating into native machine code From this point of view the new DO LOOP is more valuable for its dual signed unsigned capability than for its questionable performance increase 26 Let s compare LEAVE flag loops ver sus immediate LEAVE loops in more detail DO executes only once to initialize the loop The added overhead of pushing a LEAVE flag can be ignored LEAVE is rarely used almost never more than once within a given loop If we complicate it nobody will notice LOOP stands to suffer the most from testing an extra flag However if we put some extra functions into LEAVE we can eliminate any need for LOOP to inspect that flag In addition to set ting the flag LEAVE must set the inter nal index to 32 767 65 535 on 8080s and adjust the translation offset so that remains correct Do this and LOOP can be coded exactly the same as in immediate LEAVE implementations l and J will run equally fast in both systems A LEAVE flag if present is irrelevant except perhaps in determin ing return stack offsets for J It is LOOP which bears the main impact of the LEAVE flag testing it every time Even here h
28. 00 Enhanced FORTH with F Floating Point G Graphics T Tutorial S Stand Alone M Math Chip Support X Other Extras 79 FORTH 79 Specify Disk Size OQ APPLE H I MicroMotion Ci TRS 80 1 or iit by Miller F G amp 79 140 Microcomputer Services O CPIM by MicroMotion F X amp 79 130 F amp 79 140 O 6809 by Talbot Micro O H89 Z89 by Haydon systems T amp X 250 T amp S 250 C Z80 by Laboratory Micro systems F amp M Each 100 O 8086 88 by Laboratory C PET by FSS F amp X 150 ee O H89 Z89 by Haydon T 175 Each 100 CROSS COMPILERS Allow extending modifying and compiling for speed and memory savings can atso produce ROMable code Requires FORTH disk J CP M 200 O IBMe 300 DO H89 Z89 200 O 80869 300 O TRS 80 1 200 O Z80 300 O Northstar 200 L 6809 350 O fig FORTH Programming Aids for decompiling callfinding and translating 150 tig FORTH Mode and Source with printed Installation Manual and Source Listing O APPLE II 51 4 O 8080 Z80 8 references Flow charted z poe ititi le 20 2nd Ed 25 METAFORTH by Cassady O 1980 FORML Proc 25 Cross compiler with 8080 C 1981 FORML Proc code 30 2 Vol 40 O Systems Guide to fig O 1981 Rochester Univ FORTH 25 Proc 25 Caltech FORTH Manual 12 O Using FORTH 25 C Invitation to FORTH 20 H A FORTH Primer 25 PDP 11 FORTH User s Threaded Interpretive Manual 20 Languages 20 O CP M User s Manual O AIM FORTH U
29. 1 627 6650 I m interested My computer is Please send me MicroSPEED II 495 00 160 Page Manual 15 00 Detailed Information State Zip Phone No __ i F diir FORTH Dimensions 12 Volume iV No 3 Combining 79 Standard FORTH with Existing Microcomputer Operating Systems John Arkley The Software Works Palo Alto California During our recent conversion of Software Works FORTH into 79 Stan dard FORTH most of the problems of building a FORTH on top of several existing microcomputer operating systems were tackled and solved This article briefly discusses the advantages and disadvantages of our approach Building FORTH upon a wide range of different operating systems requires two virtual models for FORTH input output one for character or device I O and one for disk I O Conveniently 79 Standard FORTH defines these via the words KEY EMIT EXPECT and TYPE for character I O and BLOCK BUFFER and SAVE BUFFERS and EMPTY BUFFERS for disk I O 79 Standard FORTH fails to address the problems of directories directory management file creation device defi nition device assignment special driver linkages keyboard mapping function keys and the like The philo sophical reason is that no one oper ating system will ever do what is desired and it usually hinders rather than supports the programming lan guage system Advantages There are a number of advantages to using the nati
30. 19 503 244 4181 5 Interactive Computer Systems Inc 6403 Di Marco Road Tampa FL 33614 1 JPS Microsystems Inc 361 Steelcase Road West Unit 1 Markham Ontario Canada L3R 3V8 416 475 2383 1 Laboratory Microsystems 4147 Beethoven Street Los Angeles CA 90066 213 306 7412 2 Laboratory Software Systems Inc 3634 Mandeville Canyon Road Los Angeles CA 90049 213 472 6995 3 Lynx 3301 Ocean Park 301 Santa Monica CA 90405 213 450 2466 4 Lyons George 280 Henderson Street Jersey City NJ 07302 201 451 2905 1 M amp B Design 820 Sweetbay Drive Sunnyvale CA 94086 2 MicroMotion 12077 Wilshire Boulevard 506 Los Angeles CA 90025 213 821 4340 3 Microsystems Inc 2500 E Foothill Boulevard 102 Pasadena CA 91107 213 577 1417 4 Micro Works The P O Box 1110 Del Mar CA 92014 714 942 2400 5 Miller Microcomputer Services 61 Lake Shore Road Natick MA 01760 617 653 6136 6 Mountain View Press P O Box 4656 Mountain View CA 94040 415 961 4103 N 1 Nautilus Systems P O Box 1098 Santa Cruz CA 95061 408 475 7461 1 OSI Software amp Hardware 3336 Avondale Court Windsor Ontario Canada N9E 1X6 519 969 2500 2 Offete Enterprises 1306 S B Street San Mateo CA 94402 3 On Going Ideas RD 1 Box 810 Starksboro VT 05487 802 453 4442 p 1 Perkel Software Systems 1636 N Sherman Springfield MO 65803 2 Pink Noise Studios P O Box 785 Crockett CA 94525 41
31. 5 787 1534 3 Professional Management Services 724 Arastradero Road 109 Palo Alto CA 94306 408 252 2218 1 Quality Software 6660 Reseda Boulevard 105 Reseda CA 91335 R 1 Rehnke Eric C 540 S Ranch View Circle 61 Anaheim Hills CA 92087 2 Rockwell International Microelectronics Devices P O Box 3669 Anaheim CA 92803 714 632 2862 1 Saturn Software Ltd P O Box 397 New Westminister BC V3L 4Y7 Canada 2 Shaw Labs Ltd P O Box 3471 Hayward CA 94540 415 276 6050 3 Sierra Computer Co 617 Mark NE Albuquerque NM 87123 4 Sirius Systems 7528 Oak Ridge Highway Knoxville TN 37921 615 693 6583 5 Software Farm The P O Box 2304 Reston VA 22090 6 Software Federation 44 University Drive Arlington Heights IL 60004 312 259 1355 7 Software Works The 1032 Elwell Court 210 Palo Alto CA 94303 415 960 1800 8 Supersoft Associates P O Box 1628 Champaign IL 61820 217 359 2112 1 Talbot Microsystems 1927 Curtis Avenue Redondo Beach CA 90278 2 Technical Products Co P O Box 12983 Gainsville FL 32604 904 372 8439 3 Timin Engineering Co 6044 Erlanger Street San Diego CA 92122 714 455 9008 4 Transportable Software Inc P O Box 1049 Hightstown NJ 08520 609 448 4175 1 Zimmer Tom 292 Falcato Drive Milpitas CA 95035 Boards amp Machines Only see System Vendor Chart for others Controlex Corp 16005 Sherman Way Van Nuys CA 91406 213 780 8877 Datr
32. Approach As I said the approach takes some get ting used to The main surprise is that you don t edit an image of the final output as it will be printed Instead you edit a string of formatting com mands and text into a FORTH block The formatting occurs when you LOAD the block That s the key to the applica tion s simplicity the formatter uses FORTH s interpreter As an added boon the word processor becomes fully extensible Of course if you don t like being limited to 1K blocks of text you can design the application to use block based files But if you use the present system carefully you ll find it s actual ly convenient to compose your text in modules each module being a block containing one or two paragraphs To edit a paragraph you edit the module you don t have to scroll through a long document to find the paragraph you re looking for It s a random access approach to text editing The Syntax Let s take a quick look at the syntax for the formatting commands The main formatting word is left square bracket This word indicates the beginning of text delimited by right square backet You can think of it as a glorified that does carriage returns at the right margin and formfeeds at the bottom of the page Yes I know this conflicts with FORTH s own square bracket but it s 16 Quick Text Formatter Part just too nice a word not to use here If you think
33. Cross Compiler allows you to expand or modify the FORTH nucleus recompile on a host computer for a different target computer generate headerless code and generate ROMable code with initialized variables Supports forward referencing to any word or label Produces load map list of unresolved symbols and executable image in RAM or disk file No license fee for applications created with the Cross Compiler Prerequisite one of the application development systems above for your host computer Hosts Z 80 CP M 2 2 or MP M 8086 88 CP M 86 IBM PC PC DOS or CP M 86 Targets Z 80 8080 8086 88 IBM PC 6502 LSI 11 Cross Compiler for one host and one target 0 ccc eee eee eee 300 00 Pach AGqcitionaltarGet xc i rier oe kw Pe a A aa Choa aceee eee ee 100 00 FORTH Programming Aids by Curry Associates Includes Translator Callfinder Decompiler and Subroutine Decompiler 40 page manual Used with Cross Compiler to generate minimum size target applications Specify NOSE system 445i 3 55 hc toed aea i a nurse abide a E a a 150 00 Z 80 Machine Tests Memory disk console and printer tests with all source code in standard Zilog ANAS NOI Ss as es se eo ee ease eee a dene gee Ieee ees 50 00 All software distributed on eight inch single density soft sectored diskettes except PC FORTH on 5 inch soft sectored single sided double density diskettes Micropolis and North Star disk formats available at 10 00 additional charge Prices i
34. EE stamped addressed envelope TOTAL NAME MAIL STOP APT ORGANIZATION if company address ADDRESS 3 CITY STATE ZIP COUNTRY VISA MASTERCARD EXPIRATION DATE Minimum of 10 00 on charge cards Make check or money order in US Funds on US bank payable to FIG All prices include postage No purchase orders without check California residents add sales tax ORDER PHONE NUMBER 415 962 8653 FORTH INTEREST GROUP PO BOX 1105 SAN CARLOS CA 94070 FORTH INTEREST GROUP US POSTAGE P O Box 1105 ace ermi O San Carlos CA 94070 Mt View CA 477 SNAKTITHARDDIAP i 2 L SMITH esL SUASTOTA2 ME TRw 29 SOx 510 SUNNYVALZ CA 54985 Address Correction Requested
35. ER SERVICES B9 61 Lake Shore Road Natick MA 01760 617 653 6136 FORTH Dimensions APPENDIX B Development of the word FILE and misc Note 1 I m sorry but most DEC users must deal with RADS5O Note 2 This code uses the word WITHIN which is defined as follows WITHIN n low high f low lt n lt high gt RI OVER lt SWAP R gt lt AND HLEHHY DKS FILES FTH 4 4 Set EAE hE et G ae AE Ge h dE Gh e ae e t de e Files routines RADSO conversion octal gt r50 ascil radSo dup 40 if drop O else dup 44 if drop 33 else dup 56 if drop 34 else dup GO 72 within if 22 else dup 10 133 within if i100 else Tilegal RADIX 50 character 42 emit emit 42 emit cr then then then then then decimal basic routine to convert an ASCII character to RADSO aives error messase if try to convert an illesal character eee DKS FILES FTH 244444 5 De Sb AE He HH He HE a ee E Files routines RADSO conversion octal gt rS07 radSO ascii dup Q if drop 40 else dup 33 if drop 44 else dup 34 if drop SG else dup 36 50 within if 22 else dup i 33 within if 100 then then then then then F basic routine to convert RADSO to ASCII gt r50 n asc3 asc2 asci 0 50 u mod O 30 u mod rS0 gt rot r50 rot r50 rot converts a i word inteser in RADSO to 3 ASCII characters 3 decimal HHH DKESFILES LFTH xe eee 6 He Ae MEH aR SE Ee EE EE Ae a a 2E E
36. ERIFY But a missing space will as you d expect change the checksum The program runs on fig FORTH provided you make the following redefinitions before loading this application FORTH Dimensions WORD WORD HERE gt IN IN NOT O For some systems you may need to predefine 32 CONSTANT BL The program will NOT work however on FIG systems which don t have disk buffers consisting of 1024 bytes of contiguous memory Sorry The program has been designed for transportability at some expense of speed It depends on WORD to parse groups of letters separated by spaces Since certain details of WORD s opera tion vary from version to version we chose an algorithm that would cover all bases The main trick was the test to decide when to end the outer loop On 79 Standard systems when WORD hits the end of the block it returns a count of zero but on FIG systems it returns a count of one Therefore a test for zero count isn t transportable The algorithm we chose was this keep DISPOSing word strings until the next string parsed by WORD has a count less than two which covers zero and one and consists of an ASCII character less than 33 which covers blank and null Thus in a FIG system if the count is one but the character Screen 129 is blank or null we re at the end of the block This test is made in the word MORE If you feel a need to optimize this test for your system make sure that a you
37. FORTH line editors because they treat a block like 16 lines of 64 characters If you in sert a character in the middle of line 5 any text at the end of line 5 falls off Instead we want it to wrap around to line 6 Also we don t want to be editing inside a rectangle where Volume IV No 3 Figure 1 Quick Text Formatter User s Glossary start sets everything up Use at beginning C begins setting text There must be a space between the C and the first character to be printed For example This is your text ends setting text Doesn t need a space preceeding same as but allows you to print strings with a inside gt goes with cr does one carriage return tab pp begins a paragraph does two carriage returns crs does specified number of crs newpage causes text to begin at the top of a new page leaving the rest of current page blank tab tabs over to the position specified relative to the left margin for the current line only For example 5 tab tabs in 5 spaces from the left margin But if the text should continue to the next line below it will begin at the normal left margin does a tab to position specified and causes subsequent lines up to the delimiter ta be indented to the same tab does a tab to position specified and causes subsequent lines up to the delimiter to be indented three more spaces to the right This paragraph uses this format which typesetters call ha
38. FORTH course at San Diego State I will be running a modification of James PDP 11 fig FORTH on our VAX in RSX 11 compatibility mode The modifications will be mainly to make the FORTH follow Starting FORTH It s a bit strange to teach it on a time sharing system but we are embarrassingly short of micros There will be some advantages though I will be able to distribute materials and con sult with students over the phone net more easily than if we were using a roomful of micros I hope to have an article about my experiences teaching FORTH in time for your Teaching FORTH issue Vernor Vinge Dept of Math Sciences San Diego State University Good luck with your class We ll be looking forward to your article Editor FORTH Dimensions Holland Hobbyists Dear FIG I am in charge of software distribu tion in our 150 member Hobby Com puter Club here at Philips Data Sys tems in Apeldoorn Holland and we have decided to add FORTH to our standard club supported languages Our current P1 is based on 2650 processor and we are now modifying an excellent 2650 FORTH implemen tation made by Dr E J Hannivoort here in Holland We are now busy selecting a new CPU design for use this year probably Z 80 and will of course be offering FORTH on the new design too Interest in FORTH here in Holland is well started there was a local FORTH Interesse Groep as we call it here in Holland meeting yesterda
39. I O models that are simple but elegant and therefore easy to duplicate were used Most micro systems have the needed random access facilities and can have their disk file I O interfaces mapped directly to the 79 Standard FORTH 1024 byte definition of a block This does result in not being able to use all possible files that the host operating system could create since 79 Standard FORTH s disk I O design doesn t pro vide for partial block input or output One possible solution for this problem is to create a character driver for KEY and EMIT to provide sequential charac ter access to a disk file The results of combining microcom puter operating systems with 79 Stan dard FORTH produces an environ ment that remains entirely FORTH and at the same time allows real transportability that is acceptable to the large majority of existing micro computer users The performance and size costs to the resultant FORTH will no doubt be hotly argued from differ ent views but the bottom line selling software products in volume out weighs all possible technical perspec tives We expect to see a much larger acceptance of FORTH applications software as the result of this approach particularly from the hardware manufacturers like OSBORNE and SANYO 5 Volume IV No 3 Now Available On HEWLETT PACKARD DESKTOP COMPUTERS HP 9826 36 Multi FORTH HARDWARE The HP 9826A and 9836A are two of Hewlett Packard s newest and most
40. IABLE INDENT 4 NAME S PFA 5 CR INDENT SPACES NFA ID 6 INORDER S PFA 7 BEGIN 2 DUP WHILE DUP NAME 8 3 INDENT DUP 2 MYSELF 3 INDENT 9 REPEAT DROF 10 TREE S 11 CR O INDENT 7 DUP NAME CR 2 INORDER 3 12 13 14 15 Fig 6 Scr 29 O Sample Tree definition 2oJULB2HHL 1 ROOT POET 2 POET KEATS POET SHELLEY POET BYRON POET MILTON 3 KEATS ENDYMION KEATS NIGHTINGALE KEATS HYPERION 4 SHELLEY ALASTOR SHELLEY ADONAIS SHELLEY PROMETHEUS 5 BYRON CHILDE HAROLD BYRON MANFRED BYRON DON JUAN 6 MILTON PARADISE LOST MILTON LYCIDAS MILTON ALLEGRO 7 ENDYMION GOOD NIGHTINGALE GREAT HYPERION OKAY 8 ALASTOR GOOD ADONAIS GREAT PROMETHEUS GOOD 9 CHILDE HAROLD OKAY MANFRED GOOD DON JUAN GREAT 10 11 13 14 15 OK FARADISE LOST OUTSTANDING LYCIDAS OUTSTANDING ALLEGRO GREAT Everyone s a critic FORTH Dimensions _ 29 Let s take a close look at this After ROOT COLOR we have defined the word COLOR and set the contents of its PFA and PFA 2 to 0 The contents of the PFA points to the next sibling and the contents of the PFA 2 point to the first child Now when COLOR RED is executed the first thing that happens is that DOES gt supplies us the address of the PFA of COLOR on the parameter stack That s what DOES gt does remember Next we execute the word CREATE which will scan the input stream and make a dictionary entry for the word RED We still have the PFA of COLOR on the stack The 2 increm
41. OGRAMMING AIDS including all source code and the 50 page manual O fig FORTH model O FORTH 79 STANDARD specify system O Manual alone credit toward program purchase O Send more information O Master Charge O Visa Account Name feu De ase os Company Street __ PEY City State Zip 150 150 25 Number itt Calif residents add 6 5 tax Foreign air shipments add 15 Exp Date Indicate disk format O 8 ss sd fig FORTH screens O 8 ss sd CP M 2 2 file O Apple 3 3 O PC FORTH O Other Send to Curry Associates P O Box 11324 Palo Alto CA94306 415 322 1463 or 408 378 2811 FORTH Dimensions Volume IV No 3 A FORTH Based File Handling System Dr Donald Delwood Columbia Missouri introduction This article will discuss the topic of file handling that has been developed under the operating systems TR11 and RSX11 with principles applying to many others including CP M Fig FORTH inspired versions typi cally use one large file in which to store source screens of FORTH code Even casual glances through FORTH Dimensions reveal screens labeled into the thousands Finding an appli cation usually involves either wide searches of screen ranges using the INDEX word or the use of documen tors or documentor screens hopefully meticulously maintained Further more this approach requires much housekeeping as applications grow crowded requiring massive screen moves or fr
42. ROP R gt gt IN scr crcvalue BLK gt R IN gt R BLK O DIN COUNT DISPOSE 14 VER SCR 3 VERIFY U 3 15 Screen 130 crc ver 5038 Test screen For program exchange convenient COorWNe Oo 15 and machine independent are the time required for hand typing the source code and the possibility of human error in the process Even if the screens LOAD without error messages some errors may pass undetected until run time when the system crashes mysteriously the medium of hard copy is cheap Its primary disadvantages Volume IV No 3 QT F Leo Brodie Chatsworth California Like many other writers I ve become addicted to word processors Trying to write any other way seems unimagin ably tedious like plucking your own chickens for dinner A year ago when I left my full time job and word processor I found myself writing at home trying to cope with a medieval device called the elec tric typewriter It was a nightmare my mistakes actually appeared on paper the instant I made them Corrections of a sort could be made using a bizarre strip of tape coated with a flaky white chalk or a pungent paint which took three days to dry I have a dim recollection of using the electric typewriter and its awkward accouter ments years before only they hadn t seemed so archaic Must have been a previous lifetime Well as soon as I got my IBM Per sonal Computer and a version of FORTH
43. ST GROUP MAIL ORDER FOREIGN USA AR O Membership in FORTH INTEREST GROUP and Volume IV of 15 27 FORTH DIMENSIONS 6 issues O Volume Ill of FORTH DIMENSIONS 6 issues 15 18 O Volume Il of FORTH DIMENSIONS 6 issues 15 18 O Volume I of FORTH DIMENSIONS 6 issues 15 18 O fig FORTH Installation Manual containing the language model of 15 18 fig F ORTH a complete glossary memory map and installation instructions O Assembly Language Source Listing of fig FORTH for specific CPU s and machines The above manual is required for installation Check appropriate boxes Price per each O 1802 O 6502 O 6800 O 6809 O 8080 C 8086 8088 O 9900 O APPLE II O PACE O NOVA D PDP 11 O ALPHA MICRO 15 18 D Starting FORTH by Brodie BEST book on FORTH Paperback 16 20 O Starting FORTH by Brodie Hard Cover 20 25 O PROCEEDINGS 1980 FORML FORTH Modification Lab Conference 25 35 O PROCEEDINGS 1981 FORTH University of Rochester Conference 25 35 0 PROCEEDINGS 1981 FORML Conference Both Volumes 40 55 D Volume I Language Structure 25 35 O Volume II Systems and Applications 25 35 O FORTH 79 Standard a publication of the FORTH Standards Team 15 18 O Kitt Peak Primer by Stevens An indepth self study primer 25 35 D BYTE Magazine Reprints of FORTH articles 8 80 to 4 81 5 10 O FIG T shirts OSmall OMedium OLarge O X Large 10 12 O Poster Aug 1980 BYTE cover 16 x 22 2 5 O FORTH Programmer Reference Card If ordered separately send a FR
44. address and or to submit material the address is FORTH Interest Group P O Box 1105 San Carlos CA 94070 Volume IV No 3 Letters cont Freedom and Formatting Dear FIG J T Currie has provoked me as was his stated intention His statements concerning the formatting of FORTH source lines are not only provocative but outrageous ignoring many of the diverse user environments in which FORTH is a useful tool and within which the good FORTH program mer may find himself working I have used FORTH for many pur poses on many machines in many user environments since within a year of its emergence from NRAO For some types of problems and some user en vironments it is a marvelous language Lately I have been working with high energy physicists and their engineers and technicians FORTH has been used to 1 set up and check out an enormous data acquisition system and the apparatus it is con nected to 2 simulate debug and monitor a very large special purpose processor used in real time data selec tion and 3 check out and manage the operation of a multi processor used for analyzing the data collected Our users might be divided into three categories 1 Novices who use words already defined and restrict extension of the system to temporary simple lists of existing words 2 Normals who extend the system with permanent colon definitions and use those definitions to solve their pro blems 3 Nu
45. agmented multi linked screens If several screens of code are to be distributed the whole large file must be given out or other methods such as hardcopies or telephone trans fers resorted to Furthermore large files are just less convenient to mani pulate on the smaller floppy disk based systems The advantages of having an exten sive files system under FORTH would be many Each application or related applications could have a file This is hardly novel in fact it is the usual way of doing things in many other pro gramming systems A clearly named file may be loaded by an even clearer FORTH word Specific applications may be passed among users with ease Users of the same system at different times can each have their own file s or environment Generally useful words created during an application development may be easily and clear ly placed in the generally useful word FORTH Dimensions file rather than linking another screen to the already widely disseminated batch of screens in the one big file system In other words clear easy to use libraries would evolve Operating systems revel in manipu lating files It seems sometimes that their only purpose to exist is to help with CREATEing DELETEing COPYing PROTECTing MERGEing EXTENDing DATEing LISTing and DIRECTORYing files Since many FORTH users run under an operating system rather than stand alone it makes good sense to tap into this resource of well debu
46. and often almost impossible to step thru all the levels in planning a recursive procedure if one reads the toplevel procedure as a user of the action of the whole at each of its MYSELFs or reads MYSELF as the typical interface between two levels that should be enough for understanding But how many levels deep might it actually go in the search for the viewport boun dary To determine the risk of return stack overflow I simulated a high resolution 1024 wide graphics display and clipped random lines from a large user space 30000 pixel units wide Interestingly and reassuringly the depth of recursive calls NEVER exceeded 17 staying well within both parameter stack and return stack limits Of course a high level recursive search is slow the real effi ciency of this algorithm would be realized in assembler CODE calculating the midpoints with two additions and two right shifts To illustrate uses of clipping I have included printouts of a decorative title for this article and a frame from an animation sequence in which a bird and its reduced likeness fly into and out of large and small viewports simultaneously on the screen o swap endpoints swap ends back BIBLIOGRAPHY 1 Foley J D and Van Dam A Fundamentals of Interactive Com puter Graphics Addison Wesley Publishing Company 1982 2 Newman W P and Sproull R F Principles of Interactive Com puter Graphics McGraw Hill 1979 Bob Gotsch is a graphics p
47. be provided but not inter task protection Manv of the micros on which FORTH is custo marily used do not have facilities for real inter user protection instead protection should be provided at the local network level Simple multitask Continuec Votume Wo WC 3 ing allows utilities such as printer or communication spoolers to be used by a single developer or operator B The file system provides files of FORTH blocks so that existing pro grams which were not written for a file system can be run without modifi cation Normal source code and con ventional screen editors can be used But under the operating system all disk access is invisibly constrained within those files which the user is authorized to open There is no error message for attempting to access unauthorized data instead there is no such thing as BLOCK accessing out side of open files Effective data pro tection becomes especially important as non removable hard disks replace floppies because in many installations a single micro will serve several users who all keep data on line C Not only is BLOCK defined on top of the file system the file system is defined on top of BLOCK Besides the obvious advantage of transpor tability of the operating system this design also isolates any complexity below BLOCK such as support of dif ferent types of devices and support of the use of non error free media from the rest of the system The
48. ch module lives in a file in the hierarchical directory When run the module may be identified by name or pathname If the module is not found by a search starting in the current directory other directories in a search vector may be checked automatically Usually the search vector specifies program libraries All modules have the same starting address in memory If one calls ano ther the calling module is saved and restored Modules may or may not include headers Those with headers link to the resident root dictionary Modules normally communicate with each other by the FORTH stack Module calls can be used like other words in ordinary FORTH definitions as long as the modules themselves are available in a program library when needed during execution Summary Conventional FORTH systems do not effectively support libraries of sub routines larger than single definitions but smaller than complete programs As a result many software projects cannot take advantage of previous work A file system and a library mecha nism for precompiled routines are the essentials for extending FORTH s usefulness in the new environment of larger micros larger projects and modular software development O UNIX is a trademark of Bell Laboratories John S James is working for Colon Systems in San Jose California on the development of the Forte Operating System A Standardized Microcomputer Operating System In
49. channel is to be used in subsequent reads and writes Thus the minimal system re quires a word specifying the address of the file descriptor block FDB a word that somehow packs the file specifications into the FDB FILE a variable containing the currently ac tive channel CHAN and file active verbs ENTER LOOKUP and CLOSE See definitions below e FDB addr FDB returns the starting address of the system specific file descriptor block e FILE FILE can have many forms as long as it fills the FDB with the proper information This article will describe a FILE that expects a string on top of the string stack that is a standard RT11 file descriptor It then parses it converts it to RAD50 and shoves the letters into the proper posi tion in the FDB according to RT11 requirements e CHAN addr CHAN is a variable that holds the value of the cur rently active channel ciose current File File specification string Pack string into FDB try to find and open the File THEN error handling get to work close current file Fill FDB with File name TEST DAT foes such a file exist nore so make one 20 screens ions T ops bia time error Volume IV No 3 APPENDIX A RT11 Files Handling Source e ENTER n tf ENTER will This was added to FORTH in assembly language simply because the RT11 monitor calls are Create a new file of maximum n basically macros and end up
50. ctored only The first disk is readable by Digital Research CP M or Cromemco CDOS and contains 8080 source I keyed from the published listings of the FORTH INTEREST GROUP FIG plus a translated enhanced version in ZILOG 280 mnemonics This disk also contains executable FORTH COM files for 280 amp 8080 processors The 2nd disk contains FORTH readable screens including a extensive FULL SCREEN EDITOR plus many items published in FORTH DIMENSIONS including a FORTH TRACE utility a model data base handler an 8080 ASSEMBLER and formatted memory dump and I O port dump words The disks are packaged in a ring binder along with a complete listing of the FULL SCREEN EDITOR and the FIG FORTH INSTALLATION MANUAL the language model of FIG FORTH a complete glossary memory map installation instructions and the FIG line editor listing and instructions This entire work is placed in the public domain in the manner and spirit of the work upon which it is based Copies may be distributed when proper notices are included USA Foreign AIR Above described package cccccesccccvecces 50 60 Printed 280 Assembly listing w xref 15 18 Zilog mnemonics Printed 8080 Assembly liSting ssesesosees 15 18 TOTAL ___ Price includes postage No purchase orders without check Arizona residents add sales tax Make check or money order in US Funds on US bank payable to Dennis Wilson c o Aristotelian Logic
51. d column the glossary description Using this type of special purpose format command has definite advan tages Not only does it make the source easy to read this command means that action but it also lets us fiddle with the tabbing distance Even after we ve completed the entire document we can shift the description column around by changing only one number in the definition of means My experience in using this ap proach has taught me to use many such special purpose formatting Continued FORTH Dimensions 17 Volume IV No 3 Figure 3 Screen 33 tre ver 53368 O Quick Text Formatter 1 FORMFEED 12 EMIT 2 78 CONSTANT PAPER 80 column width 3 left right top and bottom margins 4 10 CONSTANT LMARGIN 5S amp CONSTANT TMARGIN 55 CONSTANT BMARGIN O VARIABLE DELIMITER current delimiter character 7 VARIABLE XTRA 8 VARIABLE ACROSS 9 VARIABLE DOWNWARD DUP ACROSS amount to indent on auto cr s t horizontal position absolute vertical position absolute 10 SKIP n SPACES 11 Nline 08 09 82 lt write code for your own printer PAPER 10 CONSTANT RMARGIN begin new line at appropriate left margin 12 O ACROSS CR 1 DOWNWARD LMARGIN XTRA 3 SKIP 13 gt 14 15 Screen 34 cre ver 31098 O Quick Text Formatter 08 09 82 1 start begin page at top margin use at start of document 2 O DOWNWARD
52. documents amp keyboard inputs ideai for form letters requires MMSFORTH V2 0 2 drives amp 48K RAM ee 175 00 MMSFORTH GAMES DISKETTE real time graphics amp board games wisource code Includes BREAKFORTH CRASH FORTH CRYPTOQUOTE FREEWAY TRS 80 OTHELLO amp TICTAGFORTH requires MMSFORTH V2 0 1 drive amp 32K RAM shee Rest des atin E A E seth Kh NA duke Cure A 36 95 Other MMSFORTH products under development FORTH BOOKS AVAILABLE MMSFORTH USERS MANUAL wio Appendices 17 50 STARTING FORTH bast aaa 15 95 THREADED INTERPRETIVE LANGUAGES advanced analysis of FORTH internals 0 ees 18 95 PROGRAM DESIGN amp CONSTRUCTION intro to structured Programming good for Forth 16 00 FORTH 79 STANDARD MANUAL official referance to 79 STANDARD word set atc 0 ene 13 95 FORTH SPECIAL ISSUE BYTE Magazine Aug 1980 A collec tor s item for Forth users and beginners 4 00 ORDERING INFORMATION Software prices include manuals and require signing of a single computer license for one person support Describe your Hardware Add 2 00 S H plus 3 00 per MMSFORTH and 1 00 per additional book Mass orders add 5 tax Foreign orders add 20 UPS COD VISA and MIC accepted no unpaid purchase orders or refunds Send SASE for free MMSFORTH information Good dealers sought Get MMSFORTH products trom your computer dealer or MILLER MICROCOMPUT
53. e Drive 300 Upper Marlboro MD 20870 5 Aristotelian Logicians 2631 East Pinchot Avenue Phoenix AZ 85016 6 Aurora Software Associates P O Box 99553 Cleveland OH 44199 1 Blue Sky Products 729 E Willow Signal Hill CA 90806 cC 1 CMOSOFT P O Box 44037 Sylmar CA 91342 2 COMSOL Ltd Treway House Hanworth Lane Chertsey Surrey KT16 9LA Englada 3 Consumer Computers 8907 La Mesa Boulevard La Mesa CA 92041 714 698 8088 4 Creative Solutions Inc 4801 Randolph Road Rockville MD 20852 Datentec Kukulies Heinrichsallee 35 Aachen 5100 West Germany d Emperical Research Group P O Box 1176 Milton WA 98354 206 631 4855 2 Engineering Logic 1252 13th Avenue Sacramento CA 95822 m Fantasia Systems Inc 1059 Alameda De Las Pulgas Belmont CA 94002 415 593 5700 2 Fillmore Systems 5227 Highland Road Minnetonka MN 55343 3 FORTH Inc 2309 Pacific Coast Highway Hermosa Beach CA 90254 213 372 8493 4 FORTHWare 639 Crossridge Terrace Orinda CA 94563 5 Frank Hogg Laboratory Inc 130 Midtown Plaza Syracuse NY 13210 315 474 7856 6 FSS P O Box 8403 Austin TX 78712 512 477 2207 1 IDPC Company P O Box 11594 Philadelphia PA 19116 215 676 3235 2 IUS Cap n Software 281 Arlington Avenue Berkeley CA 94704 415 525 9452 3 Inner Access 517K Marine View Belmont CA 94002 415 591 8295 4 Insoft 10175 S W Barbur Blvd 202B Portland OR 972
54. e is up to the challenge implementing a MOSI O S in FORTH of course would go a long way in helping clean up problems in the pro posed standard Who knows it may replace CP M or UNIX or both or neither To get on the MOSI committee con tact Jack Cowan Intel Corporation M S DV2 210 2402 West Beardsley Road Phoenix AZ 85027 The FORTH community should be involved in this effort g Volume IV No 3 FORTH FORTH PROGRAMMING AIDS is a software package containing high level FORTH routines that allow you to write more efficient programs in less development time It is also useful for maintaining existing FORTH programs The FPA package includes four modules ProacramminG Alps from Curry Associates TRANSLATOR provides a one to one translation of FORTH run time code CALLFINDER finds calling words i e calls to a specific word DECOMPILER generates structured FORTH source code from RAM and inserts program control words e g IF ELSE SUBROUTINE DECOMPILER finds called words i e words called by a specific word to all nesting levels FORTH PROGRAMMING ppa enables you to s Minimize memory require ments for target systems by finding only those words used in the target application Tailor existing words includ ing nucleus words to specific needs by decompiling the word to disk editing and recompiling e Build on previous work by extracting debugged FORTH routines i
55. e l note that I limit At LOOP P lt I increment Then check for overflow If the overflow bit is set continue to loop else exit from the loop For machines without an overflow bit such as the 8080 let limit lt limit lt init limit For LOOP merely increment I by 1 and branch back if the result is non zero For LOOP one has to examine the combination of the carry bit and the sign bit of the increment Klaus Schleisiek suggests the following use the RAR instruction to shift the carry bit into the accumulator then use XRA with the increment value Only the sign bit of the result is of interest If the result is positive continue to loop If the result is negative terminate the loop There have been various suggestions for implementing LEAVE Bob Berkey s original suggestion involves having the run time operator for 00 place the 24 exit address for the loop on the return stack to be used by LEAVE Klaus Schleisiek improved that by having LEAVE be an immediate word By using the return stack at compile time to store the addresses of fixup loca tions it is possible to avoid run time penalties when LEAVE does not occur in the loop Bill Ragsdale has sug gested a simple but clever way of avoiding use of the return stack ex cept as a very temporary storage place since Klaus s method may not be compatible with certain systems Bill s technique links t
56. e word RED and then to link it somehow into the child field of col or Furthermore we want to initialize RED to have no children of its own Before we do this let s take a look at Fig 3 which describes the action of LINK It is given an address and it inserts a new link into a linked list after that address Convince yourself that the code in Fig 3 performs the task depicted This is the same LINK Fig 2 Different Tree Structure Root Note the trees in Fig 1 and Fig 2 are equivalent word we used in Defining Words II the CLASS example Now then armed with LINK let s continue our definition of ROOT by specifying the run time behavior of its member word namely COLOR ROOT CREATE 0 Siblings 0 Children DOES gt CREATE name of child 2 LINK into Children field of Parent 0 Initialize my own Children field Volume IV No 3 Fig 3 LINK addr HERE OVER Action of LINK Address At gt A2 A3 Contents il A3 a 0 A2 LINK Address At A2 DA HERE Contents A2 w HERE 0 aa A3 SWAP Fig 4 Scr 27 GO Defining word for Trees 25JULB2HHL 1 3 LINK S addr 2 HERE OVER SWAP A 3 ROOT 4 CREATE oO Siblings O Children gt 5 BEGIN 6 DOES gt CREATE 2 LINK Siblings Oo Children 7 AGAIN 8 9 10 11 12 13 14 15 Fig 5 Scr 26 O Display Tree in INORDER Sequence 203 UL S2HHL 1 MYSELF S 2 LATEST PFA CFA IMMEDIATE 3 VAR
57. ents it so that now it is pointing at the Children field in COLOR i e PFA 2 We link our own PFA into this field Why is it our PFA that we are linking Well CREATE makes a dic tionary entry for us up to and includ ing the code field but it did not do anything to the parameter field Thus when LINK is executing the PFA of RED equals HERE which is what LINK will link into the list Thus after the 2 LINK executes the child field of COLOR will have a pointer to the PFA of RED and the sibling field of RED will have the former contents of the child field of color namely 0 Next we execute the 0 which simply initializes the child field of RED to null Now let s take a look at what happens if we said COLOR WHITE Pretty much the same thing actually except some of the pointers have changed CREATE would make a dictionary entry for WHITE and the 2 LINK code would insert WHITE into the child field of COLOR But now the child field of COLOR contains a pointer to the sibling field of RED after all that is what RED put there Thus COLOR will point to the sibling field PFA of WHITE which will point to the sibling field PFA of RED which points to 0 We have succeeded in making RED and WHITE children of COLOR and siblings of each other Notice that the entries in the tree are in reverse order from how they are defined Tough Pretty slick so far eh There is only one problem and that is that it only works for one level We
58. er standing this will be repaid a hundred When you read and under stand this example you can consider yourself a black belt defining words champion times over in the many simpler exam ples that you will encounter in your FORTH career The problem I pose is the following implement a Tree structure with defin ing words such that each node in the tree is a word and when it is executed it defines its children The original defining word will define the root of the tree You will have to reread that 3 times at least Before we descend to FORTH code let s look at some pic tures In Fig 1 we see what we ordi narily think of as a tree inorganic We have a root with 3 children The left most child has 2 children of its own while the rightmost child of the root has 4 children This is the kind of tree picture you see in many textbooks including Knuth etc However do not be lulled into thinking that this is the FORTH Dimensions Fig 1 Regular Tree Structure Root only way trees can be drawn Let me point out some of its disadvantages It seems that each parent may have an arbitrary number of children Unless you have some kind of slick dynamic storage allocation handy this can be a real pain Furthermore with this kind of structure it is very difficult to answer a question like Who is my sibl ing I don t want to be sexist and say sister Figure 2 shows the same tree but with a different representation
59. erkey accep tance has been swift It has been incor porated into the FORTH 83 Draft Standard Now if it weren t for LEAVE the pro posed FORTH 83 DO LOOP would be too good to be true The old LEAVE mechanism efficient utterly FORTH like and devoid of compile time trickery simply cannot work 25 with the dynamic boundary crossing exit criterion of the new LOOP and LOOP Here s why there is no way to zap those loop parameters on the return stack to guarantee an overflow for every possible increment LOOP might throw at us For plain LOOP it s easy but in the general case it s impossible Two currenlty proposed solutions both require a drastic change in LEAVE s function It must discard the loop parameters and jump straight away to the end of the looping struc ture It sounds rather nice LEAVE would actually leave instead of fool ing LOOP LOOP into wrapping things up How comfortable and easy to teach As orthodox as Pascal and apple pie Never mind an historical disconti nuity impeaching every FORTH pro gram ever written only a very few occurrences of LEAVE will actually require a change in coding You ll find them as you go along Concen trate instead on how LEAVE will know where to jump These are the two approaches In one LEAVE is IMMEDIATE It com piles LEAVE and leaves space for a branch address which is filled in by LOOP or LOOP much the way WHILE compiles OBRANCH and al
60. gged and sometimes even documented code I will use examples from RT11 the single user operating system by Digital Equipment Corp for their PDP 11 computers It is quite mature with a fine repertoire of useful monitor calls However the same approach was used in development for RSX11 and is being used for CP M From the top down A useful file system would use the system s specific naming convention be able to either find a pre existing file or create a new one and close the file after access That s all that is really needed Optionally it might be useful to delete rename as well as those other utilities listed above but cer tainly that can be done later by the operating system outside of FORTH The mechanics of file handling in the three operating systems RT11 Figure 1a CLOSE DKIEDITOR FTH FILE LOOKUP IF ABORT File Lookup Error 1 LIST Figure 1b CLOSE DK TEST DAT FILE LOOKUP IF 20 ENTER IF ARBOR THEN THEN perform any output CLOSE close file RSX11 and CP M are very similar A block of memory called the File Descriptor Block FDB is loaded with the file name device on which it resides and other useful information according to a system specified con vention Then certain action words or verbs which will be introduced short ly associate a channel a logical I O pathway with the file specified in the FCB I O from then on can be specified simply by indicating which
61. he forward references in a simple chain and then resolves the chain when the LOOP or LOOP is encountered at compile time As a result of his work Bill has also suggested an alternative form of LEAVE called LEAVE which appears to be more useful than LEAVE itself 7LEAVE takes the top element from the para meter stack and terminates the loop if the element is non zero i e true Fur ther details will probably be presented at the next FORML meeting One interesting possibility for augmenting the new DO is to add a function called say D0 When the arguments to D0 are equal as in the case 0 0 D0 then the loop is not executed at all If that appears suffi ciently useful then that function could be incorporated in DO itself so that an additional word would not be needed It would require a slight amount of additional time at the beginning of each loop and would eliminate one admittedly rarely used case from DO o Reprinted from Starting FORTH by Leo Brodie permission of Prentice Hall Inc Volume V No 3 FORTH 79 Compatible LEAVE for FORTH 83 DO LOOPS Klaxon Suralis Sunnyvale California Editor s note This paper originally appeared in slightly different form on the Northern California FORTH tele conference tree July 21 22 1982 The major controversy over the pro posed FORTH 83 DO LOOP is the implementation of LEAVE Allow me an attempt to explain the problem and to outline the solution I
62. i pee EARN srr preng Ta ae te SA ee AORN R i ka 3 t a j K i a VOLUME IV NUMBER 3 2 50 INSIDE OPERATING SYSTEMS Forte A FORTH Based Operating System ccsceeee John James ARETE NAA A 5 A Standardized Microcomputer Operating System Interface Gary Feierbach ccs 6 A FORTH Based File Handling System cc c ccccceeeeees Dr Donald Delwood l a 8 FEATURES _ Checksum for Hand Entered Source Screens Klaxon Suralis amp Leo Brodie 15 QTF Quick Text Formatter cccccccccccssecsseesensesseeeeeees Leo Brodie 16 The Sheer Joy of Clipping Recursively cc 2800 Bob Gotsch ccccccceeeeseeneeees 21 DORMLOOP DI oriin EAA ea sicouas Klaxon Surallis c cccccceeeeeeee 25 DEPARTMENTS PETS secs hetcs reac E E vel eee arte ven ae ne ee ete meee 3 Standards COMOT stareestticaveinanscrnciuwinadanstnass daiwa baswrstesichsetina slau parisdica os aebuanuaetaaeawencarieas aewead eeeenetataoae 24 A Techniques Tutorial cccccccscccssescssesceseees ne ny een TE ar Ronen aes cesses 28 TechnoteS esessesrserersrrereurirererruersrvrserenrioreoreserensrorsoasrsnnossrernsrerarsenerernereeas AE 31 Products Announcements ReVICWS ccccsssccssecesseeteeresseeteeens eles E E 32 OPERATING SYSTEMS AEE A OE re I TE Raa nS DEVELOPMENT TOOLS Develop FORTH code for a
63. ians 2631 East Pinchot Avenue Phoenix AZ 85016 602 956 7678 Se2 lt e m gt FORTH Dimensions 23 Volume IV No 3 FORTH Standards Corner FORTH 83 DO LOOP Robert L Smith A new form of the DO LOOP has been accepted for the next FORTH stan dard tentatively called FORTH 83 The new DO will generally work as you would expect for indices which repre sent either addresses or signed or un signed arithmetic values The index covers a complete 65K range the same as in FORTH 79 but twice as much as in fig FORTH or poly FORTH An ad ditional advantage occurs with LOOP the sign of the increment can change within the loop without necessarily causing an exit condition The speed of the new form is faster than most previous loops unless occurs fre quently A feature of the new loop is that when LEAVE is executed control is passed to the end of the loop without intervening calculations The price to be paid for the general form of the new loop is that certain side effects of the old form are miss ing Consider the simple definition TEST 0DO I LOOP Under the old form 5 TEST would execute exactly once In the new form the loop continues until the index I crosses the boundary between limit and limit 1 In the above case 9 TEST would print out 0 1 2 32767 32768 32767 8 7 6 To print only one value would require 1 TEST For another example consider the following function
64. icon 7911 NE 33rd Drive 200 Portland OR 97211 503 284 8277 Golden River Corp 7315 Reddfield Court Falls Church CA 22043 Peopleware Systems Inc 5190 West 76th Street Minneapolis MN 55435 612 831 0872 Zendex Corp 6398 Dougherty Road Dublin CA 94566 Application Packages Only see System Vendor Chart for others R E Curry amp Associates P O Box 11428 Palo Alto CA 94306 Decision Resources Corp 28203 Ridgefern Court Rancho Palo Verde CA 90274 213 377 3533 InnoSys 2150 Shattuck Avenue Berkeley CA 94704 415 843 8114 Consultation amp Training Only see System Vendor Chart for others Boulton Dave 581 Oakridge Drive Redwood City CA 94062 Brodie Leo 9720 Baden Avenue Chatsworth CA 91311 213 998 8302 Girton George 1753 Franklin Santa Monica CA 90404 213 829 1074 Go FORTH 504 Lakemead Way Redwood City CA 94062 415 366 6124 Harris Kim R Forthright Enterprises P O Box 50911 Palo Alto CA 94303 415 858 0933 Laxen Henry H 1259 Cornell Avenue Berkeley CA 94706 415 525 8582 Petri Martin B 15508 Lull Street Van Nuys CA 91406 213 908 0160 Redding Co P O Box 498 Georgetown CT 06829 203 938 9381 Dr Walter Schrenk Postfach 904 7500 Krlsruhe 41 W Germany Software Engineering 317 W 39th Terrace Kansas City MO 64111 816 531 5950 Technology Management Inc 1520 S Lyon Santa Ana CA 92705 FORTH Dimensions Volume IV No 3 FORTH INTERE
65. igh level interactive language allows for fast software development 3 Application programs are stored automatically in non volatile memory 4 The STD BUS interface allows the use of a variety of existing peripheral cards CHAIRMAN OF THE BOARDS PUTTING P FORTH TO WORK Users interactively develop applications through a combi nation of hardware and software These applications are automatic ally programmed into non volatile memory EEROM When the applications are proven and functioning a single switch transforms the system from the developmental mode into the target system PEOPLEWARE SYSTEMS INC 5190 West 76th St Mpls MN 55435 USA 612 831 0827 e TWX 910 576 1735 CROSS COMPILE FORTH ON APPLE OR ATARI SOFTWARE e An interactive high level language following the fig FORTH model e A monitor for system checkout e FORTH type screen editor for developing application programs e A FORTH type assembler for writing assembly language routines e High level interrupt linkage e High level communications protocol for down loading from a host system HARDWARE e 6801 microprocessor e 6K EEROM e 8K FORTH firmware e 2K RAM e STD BUS interface e RS232 serial I O e 16 TTL I O lines e Programmable timer The 6502 version of Nautilus Systems Cross com piler is now available on Apple and Atari The 6502 target may also be generated on any other host we support The Nautilu
66. in a city or region special interest chapters may be non geographical they focus on an interest area such as an application e g robotics telecommunication or on FORTH for a particular computer All chapters must provide a contact point and some form of regular public access usually meetings Non geographical chapters will normally provide other forms of access such as a newsletter or telecommunications instead of meetings Why Have a FIG Chapter A chapter lets you share information with other FORTH users in your geographical or application area In addition FIG provides several specific benefits A FIG will list your chapter in FORTH Dimensions so that others can find your group B FORTH Dimensions will give priority to publishing chapter news which can help you make professional contacts in the areas of your particular interests C FIG will occasionally supply material such as meeting handouts or tapes which can serve as a discussion topic at local meetings D FIG will supply its publications at bulk rates local chapters can sell them to raise money and to provide immedite local access to the material E Chapters can apply to FIG for one time funding for activities How to Start a FIG Chapter To be recognized as a chapter a group must have 1 a contact person 2 regular public access usually by meetings which are open to the public and 3 at least five members of FIG If you don
67. lable without any other operating system But the one major capability which stand alone FORTH fails to provide is becoming increasingly important namely an effective mechanism for reusing soft ware components which may have been developed independently Forte is intended to answer this need Two Kinds of Transportability While FORTH solves the problem of moving software between different CPUs there is another kind of transportability moving modules between different installations each with different teams of developers dif ferent conventions tools and environ ments For example suppose you are developing a fairly large software system and realize that most of the logic has already been coded by others You would like to tie together a number of FORTH routines from say ten different installations which have developed them independently of each other without coordination Naturally you want to treat these modules as black boxes and not make any changes to them Treating each module as a unit avoids the need to learn the internals and avoids the risk of introducing errors in work FORTH Dimensions which may have been well tested by use in dozens of different projects In addition the developers may only want to release running modules not the source This kind of modularity and trans portability which UNIX handles well a large part of the reason for its success is not available in stand alone
68. lots a dis placement later resolved by REPEAT Of course we ll want to allow multiple LEAVE s or none at all within a given LOOP structure So LOOP and LOOP must be coded to handle this possibly sharing their backfilling routine with REPEAT and UNTIL It s complicated and it costs you extra memory every time you code LEAVE but at least there s no speed penalty at run time The other technique keeps LEAVE non IMMEDIATE as required by FORTH 83 Working Draft A The requisite jump address is available as a third parameter on the return loop stack not in line as above It is the duty of DO DO actually to set up that pointer at the same time it com putes the translation offset and inter Volume IV No 3 nal index How does D0 know what forward jump address to push A single in line displacement reserved by DO and resolved by LOOP or LOOP There s a little more execution time overhead here than above but only within D0 which does its thing just once at the loop s beginning Perhaps more significant is the second method s appetite for return stack space six bytes per nesting level Folks could argue for weeks over which of these approaches is better it s quite an entertaining web of tradeoffs A Standard specifying an IMMEDIATE LEAVE could allow either implementation to comply imposing a mere few extra dictionary bytes LEAVE COMPILE LEAVE IMMEDI IATE on implement
69. lti FORTH features 79 standard programming environment Multitasking Full screen editor In line structured assembler I O and graphics extensions Loadable H P floating point IEEE format Extensive user manuals and documentation Optional Features e Meta compiler e Multi user e Data access methods library This product is part of HP PLUS a program for locating user software it has been developed by an independent software supplier to run on HP computer systems Itis eligible for HP PLUS as determined by references from satisfied end users Support services are available only through the software supplier Hewlett Packard s responsibilities are described in the Responsibilities Statement below Responsibilities Statement HP PLUS software was developed by an independent software supplier for operation on HP computer systems The supplier is solely responsible for its software and support services HP is not the manufacturer or developer of such software or support HP disclaims any and all liabilities for and makes no warranties expressed or implied with respect to this software Distribution of this product or information concerning this product does not constitute endorsement of the product the supplier or support services The customer is responsible for selection of the software it purchases For more information please write Marvel Ross Hewlett Packard Company 3404 East Harmony Road Ft Collins CO 80525 FORTH Di
70. mensions Volume IV No 3 Checksum for HMand Entered Source Screens Klaxon Suralis and Leo Brodie For program exchange the medium of hard copy is cheap convenient and machine independent Its primary disadvantages are the time required for hand typing the source code and the possibility of human error in the process Even if the screens LOAD without error messages some errors omitted or transposed words frin stance may pass undetected until run time when the system crashes mysteriously This program can ameliorate the lat ter disadvantage although it does nothing about the former Given a screen number on the stack VERIFY calculates a 16 bit CRC value which may be printed above each screen s listing The check value is NOT writ ten into any block or buffer On the receiving end VER is used to compute the check sum of the screen as typed in If the number differs from that given on paper something is definitely wrong if the values are equal chances are very good that the program compiles as listed We ve chosen to express the check sum as an unsigned number for the sake of standardization we suggest you do the same By the way VERIFY may take a second or two be patient Note that comments are ignored in the CRC generation Also the number of spaces between words makes no dif ference You may rearrange source words and change omit add com ments without affecting the value returned by VER and V
71. mensions Volume IV No 3 THE FORTH SPECIALISTS COLORFORTH AND PCFORTH Quality figFORTH compilers need not be expensive COLORFORTH is a version of figFORTH for the TRS 8O Color Computer It requires a minimum of 16K but does not require Extended Basic COLORFORTH has been customized for the Color Computer with special DUMP and PRINTER functions and a CSAVEM command for those owners without Extended Basic When you purchase COLORFORTH you receive both cassette and RS disk versions and the figEDITOR This means no added expense when you upgrade your system Complete Both cassette and RS disk versions with extensive manual JUST 49 95 PCFORTH is FORTH tailored for the IBM Personal Computer You receive all the outstanding qualities of standard figFORTH compiler and editor plus several additional words to customize it for the Personal Computer PCFORTH requires a minimum of 32K and 1 disk drive DOS Complete with diskette and manual Onvv 89 95 DEALER amp AUTHOR INQUIRIES INVITED All items are post paid in U S 0 0 0 0 00004 Texas Residents add 5 percent Armadillo Int Software P O BOX 7661 AUSTIN TEXAS 78712 master charge Tee uti megane Canis s 8080 2780 FIG FORTH for CP M amp CDOS systems 50 saves you keying the FIG FORTH model and many published FIG FORTH screens onto diskette and debugging them You receive TWO 8 inch diskettes single sided single density soft se
72. ments under the DEC o s is in the appendix An example of typical code to open a file appears in Figure 1a A defini tion to open and write to a data file appears in Figure 1b Note The RT11 file specification is device DEV which is a logical name assigned to the random access mass storage unit followed by a maximum 6 letter file name followed by an optional 3 letter extension e g DEV FILNAM EXT Text continued on page 22 Appendix B is on next page ILE NAME BLOCK DEFAULTS DK FORTH DAT FORT Ver 2 For your APPLE II II The complete professional software system that meets ALL provisions of the FORTH 79 Standard adopted Oct 1980 Compare the many advanced features of FORTH 79 with the FORTH you are now using or plan to buy FEATURES OURS OTHERS 79 Standard system gives source portability YES Professionally written tutorial amp user manua 200 PG Screen editor with user definable controls YES Macro assembler with local labels YES Virtual memory YES Both 13 amp 16 sector format YES Multiple disk drives YES Double number Standard amp String extensions YES Upper lower case keyboard input YES LO Res graphics YES 80 column display capability YES 2 80 CP M Ver 2 x amp Northstar also available YES Affordable 99 95 Low cost enhancement option Hi Res turtle graphics YES Floating point mathematics YES Powerful package with own manual 50 functions in all AM9511 compatible
73. most exclusively to Steely Dan records Copyright 1982 Leo Brodie 19 TO HORSE THE FORTH CAVALRY IS COMING COME TO YOUR IBM P C s CALL REWARD INGREASED PROGRAMMING PRODUCTIVITY BOUNTY of BENEFITS to those who JOIN FORTH Inc AVAILABLE AT SELECTED COMPUTER TRADING POSTS Volume IV No 3 Z 80 and 8086 FORTH PC FORTH for IBM Personal Computer available now FORTH Application Development Systems include interpreter compiler with virtual memory management assembler full screen editor decompiler demonstration programs utilities and 130 page manual Standard random access disk files used for screen storage Extensions provided for access to all operating system functions Z 80 FORTH for CP M 2 2 or MP M 0 cc cece ete n tent e nee er 50 00 8086 FORTH for CP M 86 sic e ic calesde hpi A ews HODES Ap adh eee Re 100 00 PC FORTH for IBM Personal Computer 0 00 0 c ect eee eens 100 00 Extension Packages for FORTH systems Software tTloatinG POINT ssc o c cede spinare eta ada eas ca a a ede 100 00 Intel 8087 support PC FORTH 8086 FORTH only 0 cece eee eee 100 00 AMD 9511 support Z 80 8086 FORTH only 00 ccc cece eee ee ences 100 00 Color graphics PC FORTH only 0 cc ccc cece eee ete teen eee eeeees 100 00 Data base management lt oss c 455i hd eet sotwtdd os ek Seo leewaaaes teehee eew ad 200 00 Nautilus
74. must have the freedom to use the peculiar ities of his her CPU environment to best advantage The LEAVE flag needs only one bit but may be padded to byte or cell width For reentrancy s sake it must reside on the return or loop stack or on some stack of its own Since there are no naturally disallowed combina tions of internal index and translation offset the flag cannot be encoded into the four bytes already assigned to loop parameters Thus compatibility with old LEAVE costs us another byte or two on the return stack for each level of nesting unless you use ROR ROL and TST instructions to implement a dedicated one bit wide LEAVE flag stack some where On the other hand dictionary space requirements are eased com pared to the jumping LEAVEs described earlier User programs are smaller because no forward branch displace ments are embedded in the code and the system is smaller cause it doesn t need complicated IMMEDIATE words to mark and resolve them If you count clock cycles loops using LEAVE flags run slower than equivalent ones running with im mediate LEAVE While I can t deny that a microsecond saved is a microsecond earned lIl show the price of com patibility with old LEAVE to be minimal Here s the real issue assume you ve got a DO LOOP or loops which runs too slow How often will converting that loop from a LEAVE flag implementation to an immediate LEAVE version give you the improvement
75. nclude shipping by UPS or first class mail within USA and Canada Overseas orders add US 10 00 per package for air mail California residents add appropriate sales tax Purchase orders accepted at our discretion No credit card orders Laboratory Microsystems 4147 Beethoven Street Los Angeles CA 90066 213 306 7412 Z 80 is a registered trademark of Zilog inc CP M is a registered trademark of Digital Research inc IBM is a registered trademark of International Business Machines Corp FORTH Dimensions 20 Volume IV No 3 The Sheer Joy of Clipping Recursively Bob Gotsch I ve been wondering since I wrote the last article whether recursion would be useful for anything else but a study of recursion That other thing turned out to be clipping discarding those parts of the lines of a picture that lie out side the specified viewport so that plotting takes place only within the desired or useable portion of the display device One strategy for clipping is to perform a binary search for the visible extremes of each line then plot the segment between Using the Sutherland Cohen algorithm 4 digit out codes are assigned to the endpoints of a line according to where they lie inside or outside the viewport 0101 0100 0110 VPT V 0001 P 0000 P 0010 R VPB 1001 1000 1010 Inside is 0000 For an X value to the left of less than the viewport boundary the rightmost bit is set 0001 Below the viewport the lef
76. ncluding constants and variables from RAM to disk m Patch changes into existing compiled words in seconds FORTH PROGRAMMING AIDS comes with complete source code and a 50 page indexed manual The gt DECOMPILER alone is worth a second look This is a true decompiler which converts the FORTH words in RAM into compilable structured FORTH source code including program control words such as IF ELSE THEN BEGIN etc If you ask FPA to DECOMPILE the nucleus word INTERPRET you get the following output displayed on your terminal within 3 seconds NFASZPFA 4796 4810 INTERFRET BEGIN FIND IF STATE IF CFA ELSE CFA EXECUTE THEN STACE ELSE HERE NUMBER DFL 1 IF CCOMPILEJ DLITERAL ELSE DROF CCOMFILE LITERAL THEN THEN AGAIN 3 You can decompile one word or a range of words at one time even the whole FORTH system This decompiled output may be sent by FPA options to TOSTACH DECOMPILE is useful for look ing up words or for obtaining variations of words by decom piling to disk editing and recompiling the console aa or disk Sister Reguremenis i FORTH r er acca on the fig F FORTH model or 79 STANDARD a minimum of 3K bytes and a recommended 13K bytes of free dictionary space For more information call Ren Curry 415 322 1463 or Tom Wempe 408 378 2811 ee ee a es ee ee ee eee ee ee ee ee ee ee ee ee ee ee ee eee ee a a a a a ea nS Ee Yes send me a copy of FORTH PR
77. nging indent like begins a string of text but centers it on the page re takes a number n off the stack Like begins a string of text but right justifies it in a field n wide sub subitem Does a cr and a 5 hang ind Convenient for making certain kinds of lists including outlines P bend Returns to normal indent hang ind center subsub sub subitem Does a cr and a 10 hang ind To produce the following list Income Expenses 1981 10 32 15 12 1982 328 543 21 408 964 864 we first defined year cer 5 tab income 20 tab 14 expenses 40 tab 14 then wrote Pp income rL Income income ri 10 32 rE 328 543 21 expenses r Expenses cr year E 19811 expenses ri 15 12 year C 1982 income expenses r 408 964 86 Figure 2 73 t Formatter Glossary means start center Quick Text Formatter cr pp C start means C sets everything up Use at beginning l cr C means begins setting text There must be a space between the C and the first character to be printed For example 1 cr 20 tab This is your text cr 3 means C ends setting text Doesn t need a space preceeding cr C l means same as but allows you to print strings with a inside cr C gt means goes with 1 gt iS hang ind 3 centert User s Glossary words may appear to be cut in half if they happen to straddle a 64 character boundary The QTF editor surmounts
78. nter it and try it out Dumping the FORTH doesn t have a GOTO take a ADONAIS dictionary at various points and chas look at the screen in Fig 4 It doesn t GREAT ing down the pointers by hand will be have one but it does There isn t really eee very illuminating Best of luck until GOOD any looping going on here I am KEATS next time and until then may the simply using the AGAIN to jump to the HYPERION FORTH be with you a BEGIN before the DOES gt Now all of the OKAY many descendants of the word NIGHT INGALE ae e a a a ees originally defined by ROOT will behave GREAT Henry Laxen is a independant FORTH exactly the same and we can build a gA e consultant proFORTH COMPILER 8080 8085 Z80 VERSIONS SUPPORTS DEVELOPMENT FOR DEDICATED APPLICATIONS INTERACTIVELY TEST HEADERLESS CODE IN PLACE COMPILATION OF ROMABLE TARGET CODE MULTIPLE PURGABLE DICTIONARIES FORTH 79 SUPERSET AVAILABLE NOW FOR TEKTRONIX DEVELOPMENT SYSTEMS 2250 MICROPROCESSOR BASED PRODUCT DESIGN SOFTWARE ENGINEERING DESIGN STUDIES COST ANALYSIS ELECTRONICS AND PRINTED CIRCUIT DESIGN PROTOTYPE FABRICATION AND TEST REAL TIME ASSEMBLY LANGUAGE proFORTH MULTITASKING DIVERSIFIED STAFF MICROSYSTEMS INC 213 577 1471 2500 E FOOTHILL BLVD SUITE 102 PASADENA CALIFORNIA 91107 FORTH Dimensions 30 Volume IV No 3 Technotes INPUT COMMANDS AS TEXT LITERALS H E R Wijnands Rijswijk Holland Here is a technique for literal com pilation
79. ny target No downloading No trial PROM burning 8080 Z80 system on your current 8080 Z80 This port addressed RAM on your S 100 host or Cromemco CDOS based system is the ROM of your target system 8080 2 280 METAFORTH _WORD BYTE CROSS COMPILER WIDE ROM SIMULATOR Produces coce 72 ay DE Cownicaded to any 280 or e Simulates 16K bytes of memory 8K bytes for 2708 and 2758 8080 crocesso Simulates 2708 2758 2516 2716 2532 2732 2564 inciudes 8282 ane Z80 assembiers and 2764 PROMS Can proauc code witnout headers and link words for up to The simulated memory may be either byte or 16 bit 30 2 Space Savings word organized Can procuce ROMable code No S 100 memory is needed to hold ROM data 79 Standare FORTH Driver program verifies simulated PROM contents Price 450 Price 495 each CONSULTING SERVICES Inner Access provides you with Custom Software Design We have supplied many clients with both Systems and Application Software tailored to their specific needs Contact us for your special programming requirements FORTH WORKSHOPS ONE WEEK WORKSHOPS ENROLLMENT LIMITED TO 8 STUDENTS FORTH Advanced FORTH Advanced FORTH Fundamentals Applications Systems e Program Design e FORTH Tools e FORTH Internals e Program Documentation e Engineering Applications e Assembiers and Editors e FORTH Architecture e Floating Point e Other Compilers e FORTH Arithmetic e Communications e Cross Compilation Theory e Control Structures e Sorting am
80. of MicroSPEED The Navy s engineers use this remarkable hardware software combination to fly an advanced fighter aircraft in real time even making vertical landings on a simulated carrier deck A crash is merely another learning experience and an opportunity to modify the research aircraft inside the Apple to improve tomorrow s combat planes Surprised that such a sophisticated task is possible on the Apple So were the Navy s officials and many others who have discovered THE MICROSPEED DIFFERENCE This extraordinary Language System exploits the real potential of the microcomputer for the first time The difference between MicroSPEED and other programming lan guages is that with MicroSPEED there is virtually no limit to what you can achieve It may well be the ultimate language for the Apple II and III and soon the IBM Personal Computer MicroSPEED literally combines the performance of a minicomputer with an exhaustive set of user friendly capabilities City AA MicroSPEED H 645 00 Name Company Address Use this coupon to order or for more information APPLE IS A TRADEMARK OF APPLE COMPUTER INC YES WITH MICROSPEED hardware math processing fast hi res graphics and text turtle graphics print formating two text editors unlimited data types and incredible FORTH extensibility all at speeds up to 100 times faster than Basic USER FRIENDLY EASY TO LEARN Starting
81. oped and the modules may have to be changed to accommodate it Perhaps the modules can be rewritten to use extended memory for data G Due to these problems there is no library of modules in widespread use Each project is developed from scratch H Even within the same installa tion it is difficult to use unchanged source program segments for different application systems New projects often must recode or at least modify previous work FORTH otherwise provides such a powerful environment for fast devel opment of correct programs that the major penalty resulting from these dif ficulties is often overlooked or found acceptable The opportunities which are lost because the FORTH environ ment does not easily produce inter changeable libraries of large program segments are not missed because they have not been experienced But in the future FORTH must increasingly compete with systems such as UNIX which do support this function For example when UNIX is distributed hundreds of modules written by many different users at different installa tions go with it What s Needed The most important requirements for modularity are a file system and a pro gram library The entire operating system can be smaller and simpler than most since FORTH itself pro vides many of these functions Several simplifying assumptions are used in the Forte operating system A We are assuming a single user system Multitasking will
82. operating system only sees sets of block number ranges since it can be configured for any ranges desired it can organize only parts of disks if desired The File System Allocation is dynamic and non contiguous All files are created with length zero and any access to a block number allocates a block of blanks to it If contiguous allocation is desired it can easily be forced Hierarchical directories and UNIX style pathnames are provided Both require low overhead and are increas ingly important for large disks A branch of the file hierarchy can be a dismountable volume All files start with a header block which contains the information neces sary to restore the file Therefore files can be recovered even if directories are destroyed A special file type important enough to be provided separately is the auto matically sorted file e g using B trees Many applications need to keep online files of records sorted by fields FORTH Dimensions such as part number or customer name the data should always be cur rent and the user should not have to wait for batch sorts The Program Library We have chosen a simplified library mechanism to keep down overhead by taking advantage of facilities already available in FORTH The goal is to support a library of precompiled routines called mod ules which can be called from other modules from a main program or from the keyboard in exactly the same way Ea
83. ork for signed OR unsigned parameters It s compatible with all earlier LOOPs simultaneously except in certain rare unsavory cases That quirk the new LOOPs lack any common sense conception of less than greater than If you mistakenly or not reverse the start and limit values or make them equal the new loop will promenade the long way around the 64K number circle Oh well that may sometimes be useful The overflow status in most CPUs 8080s can fake it offers an efficient ready made mechanism for detecting our boundary crossings provided the boundary is always 32 767 5 The trick then is to make DO translate its limit and starting values from true external form to an adjusted internal form positioning the loop limit over the 32K overflow threshold and add ing an equal offset to the index This is done only once when the loop is entered Later when we hit LOOP or LOOP we add the increment to the internal index and look for an overflow No comparisons are necessary and LOOP can use the increment memory in struction found on most processors Fast simple and no exceptions Of course J and must undo the translation by subtracting the offset Thus we still carry two loop parame ters on the return stack the adjusted internal index which changes and the translation offset which remains constant Although this looping technique was presented just last November at Asilomar by Robert B
84. ors who prefer the second way But this is still profoundly incompat ible with the way LEAVE has worked in fig FORTH polyFORTH FORTH 79 and others So I m fueling the debate by presenting a completely different solution Remember the reason for messing up LEAVE in the first place there was no setting of those two 16 bit loop parameters which would deliver the call it quits message to LOOP and LOOP in all conceivable cases We d have to split LEAVE into two words LEAVE which would work when the increment was known gt 0 and LEAVE which would handle all negative increments In addition to be ing even less compatible with existing code than the immediate LEAVE it makes life miserable for programmers who enjoy switching increment signs within their LOOPs Anyway neither LEAVE nor LEAVE would leave cor rectly for 0 LOOP These same disadvantages prevail if we ban the word LEAVE and replace it with some kind of CHANGE LOOP LIMIT word Ugh MY PROPOSAL in its general form is to keep an extra piece of informa tion on the return or loop stack a LEAVE flag This flag would be initial ized by DO set by LEAVE and tested by LOQP There is one quite elegant way to do this which I ll present at FORML Asilomar this Fall A discussion of FORTH Dimensions standards however should avoid concentrating on any one person s implementation The individual imple mentor of a standard system
85. owever the net effect is practically nil For exam ple the overall degradation of the unusually tight loop DO I DUP 2 LOOP is less than 6 This calcula tion is for my 6809 DTC FORTH but other CPUs should fall in the same neighborhood I want boundary crossing loops For my personal taste the complexity and incompatibility of a direct jumping LEAVE are intolerable Although flagged LEAVE can never match the old LEAVE for simplicity and speed it is something I can live with The existing LEAVE usage can work with the new DO LOOP We don t have to adopt a direct jumping LEAVE in order to reap the benefits of boundary crossing loop termination If the im mediate LEAVE is to become standard let it do so strictly on the basis of its own merits I sez it LEAVES much to be desired But which LEAVE do you prefer Make up your mind cause there s not enough room in the standard for both compatible and jumping versions Hey Does the Pascal FORTRAN COBOL Ada crowd ever have argu ments over this kind of stuff Volume IV No 3 INTRODUCING P FORTH The P FORTH Card is the key member in a family of control systems cards offered by the innovators at Peopleware Systems Inc P FORTH has four major advantages 1 Itis a versatile building biock The simple addition of a power supply and terminal makes the P FORTH card both a low cost development system as well as a target system 2 An integrated h
86. p Searching e Romability Multitasking e Input Output e Project Accounting System Timesharing e The Vocabulary Mechanism e Process Control e File Systems e Meta Defining Words e Simulations Database Systems OCT 4 8 NOV 8 12 NOV 15 19 OCT 11 15 JAN 3 7 FEB 7 11 FEB 14 18 JAN 10 14 395 Incl Text 495 Incl Text 495 Incl Text Instructors LEO BRODIE GARY FEIERBACH and PAUL THOMAS For further information please send for our complete FORTH Workshop Catalog inner Access Corporation P O BOX 888 BELMONT CALIFORNIA 94002 415 591 8295 FORTH Dimensions 2 Volume IV No 3 Letters Cordic Erratum Dear FIG Someone just pointed out an error in my algorithm outline shown in Vol IV No 1 page 14 box line 7 begin ANGLE lt ANGLE 2 XLAST lt Y YLAST lt X end The minus sign in front of the X should be deleted The minus sign in front of the X on line 9 is correct Alan Furman Palo Alto CA Pushing Frontiers Dear FIG The Math Edition was one of the best issues I have ever read While the commercial magazines have all turned very one dimensional business yours is still looking at new ideas and pushing the software frontier Kenneth B Butterfield Graduate Student University of New Mexico Thanks for the feedback Ken we ll try to stay Four Dimensional Editor FORTH in College Dear FIG This Fall I will be teaching an intro ductory
87. powerful desktop computers Each is based on the Motorola MC68000 microprocessor Both machines have full graphics capability and up to 2 full megabytes of user read write memory Both operate on 5 flexible disc drives the 9836A has two which feature 264K bytes of mass storage While the 9826A has an integral 7 178mm CRT which makes it useful for computer aided testing CAT and control the 9836A has a full 12 2 310mm CRT which makes it ideal for computer aided engineering CAE applications Each model features the following Seven levels of prioritized interrupt e Memory mapped 0 e Built in HP IB interface Standard ASCII keyboard with numeric keypad and international language options Ten 20 with shift user definable soft keys with soft labels e Rotary control knob for cursor control interrupt generation and analog simulations e System clock and three timers e Powerfail recovery option for protection against power lapses e Seven additional interface cards DMA controller up to 2 4 mb sec 8 16 bit bi directional parallel Additional HPIB interface Serial RS232 449 BCD Color video RGB 3 planes 512 x 512 8 color a Unbeatable Combination F i SOFTWARE HP 9826 36 Multi FORTH HP PRODUCT 97030JA Multi FORTH was developed in 1979 by Creative Solutions Inc The standard product has been substantially modified to take full advantage of the 9826 36 hardware features Mu
88. rogrammer for Time Arts Inc and a teacher of graphic arts at the California College of Arts and crafts He is interested in exploring the use of computers as aids to artists He uses FORTH WARE FORTH FORTH Based File Handling System continued from page 9 The ability of having several channels active allows easy file to file transfer of information or simultan eous editing of several files However since it would then be possible to have several blocks with the same block number yet on different channels the routines like BLOCK need some very minor alterations to pre vent confusion If there is enough interest from readers I will discuss these changes in a future arti cle For now I recommend that CHAN be ignored and that all file I O be performed on the default channel zero and that files be opened used and closed sequentially Conclusion A FORTH that has the file handling capability has many advantages The one illustrated is simple requiring only file string FDB stuffer and three verbs Error recovery is as simple Yet it clarifies FORTH program usage by making source code more modular and circumventing much code since there is no need for documentors or auto indexes The effort to add such to FORTH is trivial due to the modest amount of additional code The gain is easy file generation be it FORTH source code formatted text target compiled FORTH object code or FORTH generated executable code g FORTH Di
89. rtability the FORTH 79 Standard Required Word Set the vocabulary for the instruction book STARTING FORTH by Brodie editor assembler many useful routines and utilities MVP FORTH PRODUCTS for CP M IBM PC and Apple O MVP FORTH Programmer s Kit including disk with documentation ALL ABOUT FORTH and STARTING FORTH Assembly source listing versions 100 CO0 MVP FORTH Disk with documentation Assembly source listing version 75 O MVP FORTH Cross Compiler with MVP FORTH source in FORTH 300 O MVP FORTH Programming Aids for decompiling callfinding and translating 150 MVP FORTH Assembly Source Printed listing 20 O ALL ABOUT FORTH by Haydon 20 x xMVP FORTH operates under a variety of CPU s computers and operating systems Specify your computer and operating system x x FORTH MANUALS GUIDES amp DOCUMENTS 1 FORTH Encyclopedia by O Starting FORTH by Brodie Derick amp Baker A complete programmer s manual to fig FORTH with FORTH 79 Best instructional manual available soft cover 16 O APPLE IIi by O PET by FSS 90 Micromoton 100 TRS 80 t by Nautilus APPLE lf by Kuntzee 90 Systemse 90 I ATARI by PNS 90 O 6800 by Talbot O CPIM by 100 Microsystems 100 MicroMotion O 6809 by Talbot O CROMEMCO by Inner Microsystems 100 Access 100 O 280 by Laboratory D HP 85 by Langee 90 Microsystems 50 IBM PC by Laboratory C 8086 88 by Laboratory Microsystems 100 Microsystems 1
90. s to store the string in the parameter which normally prints the string at run time This is not our aim since we want to execute it For this reason COMLIT is FORTH Dimensions compiled before At run time COM LIT jumps over diverts the input stream to the string interprets its con tents and finally restores the input stream vector Purists who dislike the uselessness of in the object can employ the routine part on screen 1 which stores the string Care should be taken because some FORTH implementa tions increment the return stack before returning some after returning from subroutine COMLIT is perhaps the counterpart of DIRECT DIRECT directly executes the string following it as if it were a definition This allows direct use of non direct words like the control structures IF DO etc Example DIRECT 20 10 DO LIST LOOP The idea of DIRECT is not mine but the source on below 102 is This looks useful I would suggest look ing at how is defined and creating a similar word rather than wasting two bytes in each definition The name COM LIT strikes me as inadequately meliflu ous Perhaps something like COMPILE would be better DIRECT is very similar to Bill Ragsdale s word except that DIRECT compiles the temporary code in TIB while compiles it at HERE Michael Perry EXPONENTIATION George Lyons Jersey City New Jersey Below Figure 2
91. s Cross compiler has been used on every major 8 and 16 bit micro computer APPLE or ATARI version 300 00 plus 5 00 shipping amp tax where applicable 6502 target for existing users 100 00 IBM PC and CP M 86 versions available from LABORATORY MICROSYSTEMS 79 Standard versions are avail able from MOUNTAIN VIEW PRESS Nautilus Systems P O BOX 1098 SANTA CRUZ CA 95061 Apple is a trademark of Apple Computer Inc Atari is a trademark of Atari Computer CP M is a trademark of Digital Research IBM PC is a trademark of IBM Inc FORTH Dimensions 27 Volume iV No 3 A Techniques Tutorial Defining Words Ill Henry Laxen This is the third and final chapter in my series on Defining Words In the first episode we saw how to use defin ing words to define a simple Adven ture like interaction It illustrated how defining words are used in most real world examples In the second episode we saw how to create a defin ing word that can define other defin ing words Unfortunately this was only done for 2 levels This time we will take a look at the ultimate gener ality namely iterated defining words When you read and understand this example you can consider yourself a black belt defining words champion I must admit that I have never actually used a construct like this in a real world application however I think it is a very good exercise in mental gym nastics and the effort put into und
92. ser s MicroMotion 20 Manual 12 C FORTH 79 Standard 15 O APPLE User s Manual O FORTH 79 Standard MicroMotion 20 Conversion 10 O TRS 80 User s Manual i MMSFORTH gi9 H ie ORTH sio O Installation Manual for fig FORTH contains FORTH model glossary memory map and instructions 15 Source Listings of fig FORTH for specific CPU s and computers The installation Manual is required for implementation Each 15 O 1802 6502 O 6800 O AlphaMicro O 8080 O 8086 88 O 9900 O APPLE II O PACE CL 6809 J NOVA O PDP 11 LSI 11 Ordering Information Check Money Order payable to MOUNTAIN VIEW PRESS INC VISA MasterCard or COD s accepted No billing or unpaid PO s California residents add sales tax Shipping costs in US included in price Foreign orders pay in US funds on US bank include for handling and shipping by Air 5 for each item under 25 10 for each item between 25 and 99 and 20 for each item over 100 Minimum order 10 All prices and products subject to change or withdrawal without notice Single system and or single user license agreement required on some products DEALER amp AUTHOR INQUIRIES INVITED D 8086 88 8 O H89 Z89 51 Each 65 MOUNTAIN VIEW PRESS INC PO BOX 4656 MOUNTAIN VIEW CA 94040 415 961 4103 FORTH Dimensions 33 Volume IV No 4 Start Your Own FIG Chapter What is a FIG Chapter There are two kinds of FIG chapters local and special interest Local chapters are centered
93. sks M 3 can read write and run M 1 disks IMS FORTH THE PROFESSIONAL FORTH SYSTEM FOR TRS 80 amp IBM PC Thousands of systems in use MMSFORTH Disk System requires 1 disk drive 32K RAM V2 0 For Radio Shack TRS 80 Modellortli 120 95 V2 1 For IBM Persona Computer 80 col screen 249 95 AND MMS GIVES IT PROFESSIONAL SUPPORT Source code provided MMSFORTH Newsletter Many demo programs aboard MMSFORTH User Groups inexpensive upgrades to iatest version Programming staff can provide advice modifications and custom programs to fit YOUR needs MMSFORTH UTILITIES DISKETTE includes FLOATING POINT MATH BASIC ROM routines plus Complex numbers Rectan gular Poiar coordinate conversions Degrees made more powertul CAOSS REFERENCER to list Forth words by block and line plus TRS 80 a full Forth styie 280 assembler requires MMSFORTH V2 0 1 drive amp 32K RAM 39 95 FORTHCOM communications package provides RS 232 driver dumb terminal mode transfer of FORTH biocks and host mode to operate a remote FORTHCOM systems requires MMSFORTH V2 0 1 drive amp 32K RAM 39 95 THE DATAHANDLER a very fast database management system operable by non programmers requires MMSFORTH V2 0 1 driva amp 32K RAM eee nee 59 95 FORTHWARITE fast powerful Word Processor wieasy keystrokes Help screens manual amp demo files Full propor tions witabs outdenting Include other blocks
94. star amp Micropolis A FORTH by Shaw Labs Ltd can make your micro operate like a mainframe You can be printing sorting and inter actively inputing data all at the same time Hardware permitting you can even have multi users operating 395 FORTH TUTORIAL SYSTEM by Laxen amp Harris Inc Two 8 CP M disks with documentation and a copy of Starting FORTH by Brodie An inexpensive way to start learning and programming in FORTH 95 MOUNTAIN VIEW PRESS INC P O Box 4656 Mountain View Calif 94040 415 961 4103 Volume IV No 3 THE FOURTH SOURCE NEW FORTH PRODUCTS O Personal FORTH for the IBM PC by FORTH inc Multitasking full screen editor floating point support DOS file handier color monitor support turnkey compiler 300 MULTI TASKING FORTH CP M Northstar amp Micropolis A FORTH by Shaw Labs Ltd can operate your micro like a mainframe Print sort and inter activiy input all at the same time 395 FORTH TUTORIAL by Laxen amp Harris Two 8 CP M disks with documentation and a copy of Starting FORTH by Brodie The easy way to learn FORTH 95 And so FORTH by Huang An indepth how to book about FORTH with a Z80 impiementation Follows the fig FORTH model 25 O CO O MORE FORTH DISKS FORTH with editor assembler and manual Source provided Specify disk size MVP FORTH A Public Domain Product MVP FORTH contains a kernal for transpo
95. t know five members in your area FIG can help you contact them If you want to start a chapter send a request for a FIG Chapter Kit to the Chapter coor dinator FORTH Interest Group P O Box 1105 San Carlos CA 94070 List of FORTH System Vendors e g A1 signifies AB Computers etc Processors Atari onee 1802 A E C1 C2 F3 F6 L3 CrOmemco e 6502 AIM KIM SYM R1 R2 S1 DEC PDP LSI 11 6800 F3 F5 K1 L3 M6 T1 Heath 89 ee 6809 erse F3 F5 L3 M6 T1 Hewlett Packard 85 68000 C4 E1 IBM PO aeananas 8080 85 iesise A5 C1 C2 F4 15 L1 L3 M3 IBM Other M6 R1 Micropolis ZGUIS9 ouaaa A3 A5 C2 F4 13 K1 L1 M2 North Star M3 M5 N1 Ohio Scientific Z800 nnna 13 OSbOrNe serere 8086 88 ane F2 F3 L1 L3 M6 Pet SWTPC eCe aTa AE E2 L3 TRS 80 I I III TRS 80 Color FIG Chapter News Potomac Chapter At the August 3rd meeting Joel Shprentz described a keyboard and display controller written in FORTH Multifield commands are entered on a thirteen key keyboard 10 numeric and 3 control keys As each field is entered it is displayed on a 4 digit LED display The 24 possible commands require different combinations of fields Most languages would force the program mer to write either voluminous code or an elaborate table driven system With FORTH the code is simple and direct words controlling individual field input are combined
96. t that FIG didn t work like the system he was experienced with His use of the computer to illustrate the operations going on inside of FORTH while words were being com piled was very easy to follow and made it much easier to understand FORTH If there were more time I d like to see more on style compiler security multitasking and performance moni oring tools But if this course had everything I wanted it would take more than a week John Clark works for an international computer firm with offices in San Jose California Laxen amp Harris Inc Terminate Operations Effective immediately Laxen amp Har ris Inc is ceasing operations and no more Classes or services will be offered directly by Laxen amp Harris Inc Our instructional disk set working FORTH and Learning FORTH will continue to be available under license through Mountain View Press P O Box 4656 Mt View CA 94040 415 961 4103 Both Henry Laxen and Kim Harris will remain active in the FORTH com munity and will be offering consulting services If you would like to contact them individually you will find them listed under Consultants in the Vendor s List of FORTH Dimensions magazine THE FORTH CAVALRY IS HERE personalFORTH for the IBM PC by FORTH Inc Multi tasking full screen editor floating point support DOS file handler color monitor support turnkey compiler 300 MULTI TASKING FORTH 8 CP M North
97. terface Gary Feierbach The Institute of Electrical and Electronic Engineers IEEE has an active commit tee PI55 dubbed MOSI which is char tered to define a set of programmatic interfaces between microprocessor based operating systems and that soft ware which utilizes operating system functions Today we have what essenti ally amounts to chaos in this area with the exceptions of a few proprietary vendor packages which have become defacto standard like CP M and UNIX MOSI came out with a draft docu ment Rev 3 0 which is in the process of being revised and is soon to be released Rev 4 0 in August or Septem ber as a proposed standard The draft document reveals operating system or modules from 1 to 6 These capability modules span very simple environments as in the case of dedicated controllers to complex environments involving memory clock data and process man agement The current draft Rev 3 0 is quite bulky covering 161 pages and Rev 4 0 promises to be under 100 pages The MOSI committee is also bulky consist ing of over 268 members it was 600 One would think such an effort was doomed from the start to produce an elephantine monstrosity A monstrosity it is not As a matter of fact the result to this point looks quite plausible A good part of the bulk is due to examples of using the O S primatives from C BASIC and COBOL They need some one to provide examples from a FORTH environment Furthermore if anyon
98. tmost bit is set 1001 The out code for lower left is the logical OR of left and below 1001 etc A line can be trivially rejected no plotting at all if it lies entirely to one side outside of the viewport An efficient test for rejection returning a true flag is the logical AND of the endpoint s outcodes A line may be trivially accepted and plotted as is when outcodes for both ends are zero SX V x FORTH Dimensions DV lt 21 Of all the possible locations of a line entirely inside viewport entirely outside one end in or crossing view port every situation is handled by trivial rejection trivial acceptance or successive middle divisions of the line until each of the segments of the line can be trivially accepted or trivially rejected The binary search for the intersection with viewport boundary terminates when the segment becomes so short that the midpoint in integer screen coordinates coincides with one or the other endpoint I have chosen to save the three values for each endpoint X value Y value and outcode together on the stack with the out of viewport point always topmost on the stack Hence a true INVIEWPORT condition is followed by 3SWAP The other tests TRIVIALACCEPT TRIVIALREJECT and COINCIDE as well as calculation of MIDPOINT assignment of QUTCODE and the graphics action PLOTLINE do just what they say and should be understandable from the forego ing without listed definitions These
99. to being an editor for the MUMPS Users Group MUG Quarterly I am software firmware editor for EDP News Service and manage the Soft ware Digest newsletter I would like to begin getting information about FORTH into the trade news in the computer industry on a regular basis Since December I have been able to accomplish the following arranged for a full day tutorial on FORTH at the Annual MUMPS Users Group in Denver arranged for George Shaw s book review of Leo Brodie s text to be reprinted in the MUG Quarterly persuaded Bob Wickizer to include some paragraphs on his use of FORTH as a complement to MUMPS in his radiology system planned for including future arti cles on FORTH in the MUG Quarterly and in Software Digest Henry G Heffernan Washington D C FORTH Dimensions Published by FORTH Interest Group Volume IV No 3 September October 1982 Editorial Production Leo Brodie Publisher Roy C Martens FORTH Dimensions solicits editorial material comments and letters No responsibility is assumed for accuracy of material submitted Unless noted otherwise material published by the FORTH Interest Group is in the public domain Such material may be reproduced with credit given to the author and the FORTH Interest Group Subscription to FORTH Dimensions is free with membership in the FORTH Interest Group at 15 00 per year 27 00 foreign air For membership change of
100. to defer commands in the input stream Suppose we made a definition that operates on a string in the input stream For instance a file system command FLIST which should be followed by a file name The com mand FLIST gets the string stores it in a buffer and searches in the file direc tory for a match etc The command FLIST is compilable but it always ex pects its operand in the input stream on execution Sometimes this is un wanted and we wish to execute on a operand inserted during compilation Example HELP FLIST Helpfilename Execution of HELP is meant to give a listing of a helpfile The new word COMLIT which I derived from compile literal does the trick COMLIT compiles the sequence of characters as literals until it encoun ters the quotation mark At run time it executes this sequence The problem above is solved as HELP COMLIT FLIST Helpfilename Another example of delayed execution notice its order TEST testing COMLIT TEST1 TEST2 CR TEST1 one TEST2 and two Although TEST1 and TEST2 are not yet in the vocabulary TEST will be com piled Executing TEST after compila tion of TEST1 and TEST2 gives TEST testing one and two OK Source of COMLIT is shown in Figure 1 To leave arguments on the stack for further processing after the delayed execution only the return stack is used by COMLIT Operation of COMLIT is quite simple During compilation it use
101. trash compac tor on their way to disk is a formidable barrier that I see no point in imposing on our novices I m glad that FORTH doesn t insist that code for inner loops be indented three spaces from the next highest level ecstatic that it allows me to insist on it At about the time a user starts advancing from Novice to Normal I suggest club in hand that he adhere to a short list of formatting conven tions Definitions start on the left and are preceded by comments in plain English Loops and conditionals are indented Definitions do not usually span screens Screens that change BASE when loaded must save and restore it Use of a word for different functions in different vocabularies is strictly forbidden in general use of non default vocabularies is forbidden Words are to have clear mnemonic value whenever possible even at some expense in brevity Lots of empty space is left to make later amendment easy This does not insure that the code written is good cleanly factored concise fast sufficiently general easi ly used for further extension That will come with time and training What it does do is to insure that most of our users and especially our inexperi enced and occasional users can use and begin to understand the code as quickly as possible Formatting is help ful to most of our users even when the code being studied is excellent For badly written code and there is lots of that around in our kind
102. ts who may reassemble the kernel write code definitions to connect to new hardware define new defining words At any one time our users are about half novices and half normals with a nut or two hanging around It s not that the novices and normals are dull slobs who couldn t get beyond that level they are people who exercise their creativity in other areas and use FORTH as one tool among many to get a job done One might wish indeed I do wish that everybody learned FORTH in grammar school Until that happy day arrives I must work in an environ ment where most of the users will be non experts to say no more A local prison warden criticized for the appalling condition of his jail responded that things wouldn t get better until they got a better class of prisoners It makes no more sense for me to yearn for a better class of FORTH Dimensions technicians Our programming en vironment must seek to do the best it can in an imperfect world Our engineers and technicians have grown up on Pascal and BASIC and Assembler the physicists are addicted to FORTRAN They are used to lines of code and conventions of indenta tion Novices look at a block of unfor matted FORTH code the way I look at Bengali script incredulity that squiggles speak of truth or beauty or even the proper function of a time digitizer A screen made up of a hun dred or so terse words that look like they were run through a
103. ve operating system even though doing so increases the size of the FORTH system A primary advantage is the ability of such a FORTH to co exist on the same mass storage volumes with other application software and languages Now that we re seeing cheap high density storage the usual FORTH design which can be summarized by the phrase I own the whole disk is an unacceptable one The massive microcompuer market requires a dif ferent FORTH approach one which FORTH Dimensions supports sharing resources with other software systems Another advantage is the easier ac ceptance of FORTH by non FORTH programmers still undergoing the FORTHification process None of the common micro com puter operating systems support files that the system will span across multi ple disk volumes This problem can be solved in the interface between FORTH and the host system thus reducing the applications program mer s concern for disk capacities FORTH can circumvent deficiencies in these operating systems A similar scenario applies to charac ter I O The best example of this is the two and a half character devices in CP M FORTH can easily interface I O through a vector table that allows patching in device drivers for 8 or 16 devices Another example is found in device paralleling a means of directing the output stream to multiple output devices without having to put special case code in an application Disadvantages Using an e
104. with simple commands that are comfortable even for non programmers MicroSPEED extends and builds allowing you to create your own tailored application languages The capability of your computer will grow exponentially as you work in an active part nership with the machine exploring and develop ing new problem solving facilities creating cor recting refining your increasingly powerful system DEMANDING JOBS AT LOW COST Developed by a team of standout computer professionals MicroSPEED has been put to the test in fields as diverse as medicine the stock market oceanography and the arts In even the most challenging appli cations MicroSPEED users have been unanimous in their praise of the System and manual Typical comments are Very high marks Thomas Tosch Ph D Tosch Information Management The more I use MicroSPEED the more I love it Prof James L Hockenhull University of Washington Great A joy to use Henry Harris Mission Designer Cal Tech s Jet Propulsion Lab If you plan to use the Apple or IBM Personal Computer for any demanding task then we built MicroSPEED for you Sam Cottrell President of Applied Analvtics MicroSPEED requires the Apple or IBM Personal Computer with l single disk MicroSPEED II includes 2 MHz math processor I Micro SPEED II includes 4 MHz math processor I Applied Analytics Incorporated 8910 Brookridge Drive Upper Marlboro Maryland 20772 30
105. xisting operating system is not without some costs some of which affect performance A good example can be seen in the difference between character at a time I O with EMIT and a line at a time I O with TYPE If the overhead for an output request is very high software that only uses EMIT could easily run 10 times slower than if whole lines were TYPEed for most of its output Disk I O speed can also suf fer if the operating system is slow at random access reads or writes The final disadvantage is encoun tered with operating systems that are entirely useless for FORTH or too complex to support the simple needs of FORTH The problem is solved by using the directory format and disk allocation mechanism and implemen ting a subset operating system from scratch that is sufficient to support FORTH This problem arises when the operating system is inside a disk 13 BASIC ala MICROSOFT disk BAS ICS or such first generation systems like APPLE DOS 3 X which is very slow for large random access files due to its linear index structure and its unusual post basic interface design Implementation Considerations The actual cost of doing an operat ing system from scratch as we have done for the APPLE II is not as large as one would think It only took 3 weeks to create the 6502 FORTH the operating system and a new disk driver for the APPLE disk controller This is largely due to two factors most of FORTH can be written in itself and
106. y under Theo van Lottum s chairman ship and they are providing an excel ent range of information on FORTH However with more and more of our members asking what FORTH actual ly can do in practice I would like to ask your help in two areas namely a FORTH Training Course We will be organising a Training Course in FORTH in our Hobby Club this autumn While Starting FORTH is an excellent work book for such a course we really need some more structured material for a 6 to 10 lesson introduc tion Any ideas b Actual FORTH Applications Where can I get a few self contained applications written in FORTH as ex amples for our members The screens given in FORTH Dimensions are fine but I am looking for a few example Games a Word Processor a very basic BASIC that sort of thing just to show our members what they can expect from FORTH Looking forward to hearing from you and receiving FORTH Dimen sions regularly 1 M Prest M Preston The Netherlands Congratulations on the success of your club As for the applications any that we know of we re publishing here There were three games described in ITI 5 a very basic BASIC in III 6 I m including the code for my simplified word processor in this issue and we expect lots more applications to come Editor infecting the Mumps Dear FIG I would appreciate receiving some of your publications for book reviews in the publications I edit In addition
Download Pdf Manuals
Related Search
Related Contents
Carson Optical Binoculars ba-03 User's Manual User`s Manual Manual - Mega Global Solution Hoshizaki Flocken-Eisbereiter FM750AKE Kodak 1078419 User's Manual U - Toby Sleigh Wooden Clocks Home Not for Reproduction raspador piezo ultrasónico uds-l led manual de instrucciones Omron M6 Comfort Copyright © All rights reserved.
Failed to retrieve file