Home
2 - Forth
Contents
1. sor 0 O ACCESS TO 80286 EXTENDED MEMORY UNDER MS DOS I 2 Uses interrupt 15 function 87 3 Swaps block of data between PC AT s extended memory 4 addresses above 1 MB and DOS accessible memory below 640K A FAST FORTH 5 Based on James T Smith IBM PC AT Programmer s Guide 1986 OPTIMIZED FOR THE IBM 6 section 10 4 Using extended memory 7 PERSONAL COMPUTER AND 8 Written in Uniforth implementation of Forth 83 MS DOS COMPATIBLES 9 Unified Software Systems PO Box 21294 Columbus OH 43221 10 STANDARD FEATURES 11 Prof Richard F Olivo INCLUDE 12 Department of Biological Sciences 13 Smith College e79 STANDARD 14 Northampton Massachusetts 01063 15 eDIRECT I O ACCESS FULI SCR 1 SEURD AL CERS TO MS DOS O WRITE GLOBAL DESCRIPTOR TABLE GDT 1 decimal ENVIRONMENT SAVE 2 create GDT 48 allot Global descriptor table for INT15 amp LOAD 3 4 MAKE GDT src daddr dest daddr bytes Ocean corer FOR 5 daddr uses 32 bit address eg source 00A0 0000 LI ONS 6 bytes bytes moved can be up to 64K 1 segment eEXTEND RES 7 GDT 48 erase Fill entire table with 00 xT ED ADD SING 8 dup GDT 16 Store source length bytes MEMORY ALLOCATION 9 GDT 24 amp destination length bytes CONFIGURABLE ON LINE 10 GDT 26 2 Store destination address 11 GDT 18 2 amp source address e eAUTO LOAD SCREEN BOOT 12 147 GDT 21 c Store access rights byte 93 147 dec t gt i eLINE amp SCREEN E
2. Figure Two Listing One variable xleft variable xright variable xr variable yr right gt Cs 1 xr begin xr yr point O while xr yr dot 1 xr repeat xr 1 xright left gt 1 xr begin xr yr point 0 while xr yr dot 1 xr repeat xr 1 xleft scan CREE ae 2 begin xr xright lt while 0 flag begin xr yr point O xr xright lt and while 1 flag 1 xr repeat flag if xr yr point O xr xright and if xr yr else xr 1 yr then then xr begin xr yr point xr xright lt and while 1 xr repeat xr if 1 xr then repeat Le rived in order Thus the coordinates must be sorted before the points can be con nected However we usually do not know a priori how many intersections will be obtained Thus it is best to store the subse quent X coordinates on the stack which is sorted by Sort each time a new number is pushed onto it To make the stack sorting process more effective the return stack has been applied The sorting operation is real ized by insertion The idea of the process is that all coordinates smaller than the one to be inserted are popped from the stack and temporarily stored on the return stack Then the inserted coordinate is pushed onto the stack and all the coordinates on the return stack are pushed back to the stack After all the intersections are derived and s
3. The immediacy is lost but the words remain Successes Failures A study of the his torical applications of Forth to create an awareness of Forth s widespread use and to determine what the characteristics and causes are for successes and failures ANS Forth Participate through your SIGForth representative in the ANS Forth committee to produce an American Na tional Standard for Forth that everyone can use State of the Industry SIGForth periodi cally compiles surveys of the Forth industry to evaluate the status of the Forth product market job market workplace education availability job requirements etc Partici pate in these surveys and be one of the first to reap their benefits through their publica tion in the SIGForth newsletter Forth Dimensions Mike Perry January 1989 Owner of Even Odd Designs lt mike gt I have benefitted enormously from the work of many other people I have come to believe strongly in the value of open systems I want and even need to have complete control over my tools Shar ing code and avoiding secrets are essential for productivity Iam convinced that Forth will continue to be interesting because so many new techniques and ideas are explored here that is possible in large part because we share our code and ideas Remember we will only lose control of our machines if we give it away Randy Dumse February 1989 Owner of New Micros Inc lt
4. 16 Self Contained Editor PDE is self contained and does not need the traditional F83 EDITOR vocabulary Instead screens 5B 5E all numbers in hex are adapted from F83 screens OC 1B of the file UTILITY BLK From there comes the scrolling window where the top 12h lines of the CRT display the screen under test while the lower portion scrolls to allow debug output etc Figure One shows the two words that take care of scrolling W2 SCROLL and IN STALL which installs W2 SCROLL as CR W2 SCROLL adapted from EDITOR s ALL on screen 13 uses LINE to delete the top line of the second window causing everything below it to scroll up Note that this form of windowing works by preempting the PC s ROM rou tines from scrolling the whole screen As long as CR is used to force a new line we re okay When we output a line of more than 50h characters or one that includes charac ters OD or OA the whole screen scrolls and our windowing gets messed up That is one reason I m using a version of S that only displays the top six items on the stack and thereby avoids line wrap on the display This S also handles stack underflow it is found in screen 5A The other words from EDITOR are cursor addressing and GET ID etc GET ID screen F uses the system clock it does not require a hardware clock Simply set the PC s system date using the usual DOS command Most of the supporting code on screen five is lifted fr
5. DUP FILE lt gt OVER OR IF ELSE DROP THEN MARK UPD S amp UPD IF SCR BLOCK DROP amp SET ID IF STAMP THEN UPDATE amp UPD OFF THEN Figure Seven Multi file editing made easy 1 BUFFER 4 amp BADDR lt gt ABORT Buffer error only if fcb diff and lt gt 0 SAVE BUFFERS DOS FILES OPEN FILE Any changes made Make block current Set datestamp if wanted Set updated flags test EVIEW VIEW DUP IF 2 VIEW FILES 2 ELSE DOS FCBl THEN 0 ROT S code addr file curs scr Get word s VIEW field scr amp FCB addr Set to cursor loc 0 EVIEW DO WD EVIEW NXT SCR FILE FIX EVIEW OTH INIT NXT SCR FILE E Figure Eight View edit screen where word is defined eSOURCE BLK IF GET SUB BLK DROP ELSE TIB TIB THEN eLOAD S W2AT eSOURCE IS SOURCE FILE gt R BLK Q gt R gt IN OR 2 TAG BLK gt IN DROP RUN FIX SOURCE R gt gt IN R gt BLK P gt DOS FILES Figure Nine LOAD partial screen from within editor FILE gt R GET FILE BLOCK R gt GET FILE 2 TAG ROT GET CUR ADDR 3 TAG DROP NIP ROT GET CUR ADDR S curpos Scr fcb addr gt in Assumes multiple block buffers GET SUB BLK S addr len gt in Figure Ten Get sub block s address make sure it s in memory L Forth Dimensions
6. out buf returns 0 or 1 to indicate active output daddr buffer0 daddr Pout buf 4 5 COPY ONE VIDEO LINE FROM FORTH DICTIONARY SPACE TO IMAGE Requires previous calculation of current vline next screen GDT dseg pixels line 2 APPLICATION Copy to from video frame grabber DT2851 Frame grabber has 2 buffers each 256KB starting at address We will access these one video In Forth dictionary make create VIDLINE pixels line allot array to hold 1 video line GDT requires 32 bit addresses gt double constants amp variables Absolute address of vidline array in Forth dictionary Segment amp offset of vidline array 2constant VIDLINE DADR converted to 32 bit daddr const 0 1 CONSTANTS ARRAYS amp VARIABLES 2 3 4 00A0 0000 in extended memory 5 line at a time 512 bytes line 6 7 decimal 8 512 constant PIXELS LINE 9 10 11 12 13 dseg vidline seg gt adr 14 15 gt SCR 4 CONSTANTS amp VARIABLES ADDRESSES FOR DT2851 IMAGE BUFFERS Absolute 32 bit addresses of DT2851 image buffers 0 amp 1 2constant BUFFERO buffer0 4 0 d 2constant BUFFERI 2variable CURRENT VLINE daddr of buffer0 daddr of bufferl daddr of active video line buffer active image buffer d inactive image buffer 6 d Move one line up to image source constant daddr of vidline destination prev calc d daddr bytes pixels on one line write
7. re creat ing press F5 and presto you re looking at the screen on which SEARCH is defined screen OA in UTILITY BLK including the comment that describes its stack effect Use 4PgDn to get to its shadow If you want more detail such as about the word STRING that SEARCH uses point press F5 again and you re looking Employment opportunity for a Forth programmer with two to three years of real time systems ex perience and knowledge of an assembler lan guage for interrupt processing The programmer will join a small work group with a progressive company in Manchester New Hampshire This company develops dedicated data acquisition systems with embedded micro processors It is part of a US firm with world wide manufacturing and distribution Please send your resume and salary history and requirements in confidence to Mr Manfred Peschke Intersystems Company RFD 3 Story Hill Road Dunbarton Goffstown NH 03045 who is conducting this search for his client _ Forth Dimensions 18 at screen 3F of KERNEL86 BLK A re peated F6 gets you back where you were Of course all of this supposes that the words you re looking up SEARCH and STRING in our example are visible in a context vocabulary and that you used VIEWS etc when originally loading those definitions And yes it supposes you have a hard disk to have all your permanent source files on line If not get one this feat
8. where sn is the screen number of the text of 3 BUESTION the question 1n is the line number on that 7 screen where the question is found and q_name is the question s name A rule is a number of conditions that if all of them are true leads to an answer Each rule is just a word defined in this way rule_name questionl amp question2 a a A Volume XI Number 2 23 Forth Dimensions CREATE Ca x 1 NQ DUF line of screen of DUF ANSWERS Cia DUF If flag 0 If flag 1 IF The guestion t ROT ROT 2DROF ELSE The question t 4 its text its text s C Each word created by QUESTION stores C number of question nannan mn line screen sareen gt 1 NO address i NQ address NQ content in pfa in pfati in pfat2 and pnfat pfa answer pfa pfa pfa pfat pfa Question_no pfa guestion mo pfa question no pfa question nos pfa Question_na pfa question no lag pfa question _ na flag flag was answered before pfa question no flag pfa quesion ne answer question_no answer ofa answer answer pfa question na has never be made C pfa aquestion_no SWAF questian_no pfa DUF t g lt uestion_no pfa ofa ce C question_no pfa line SWAF 1 t question no line pfati ca question no line screen CR LINE question_no Y N guestion_no answer If
9. DUMSE gt Being somewhat isolated here in Texas has its disadvantages The availability of other informed people to bounce ideas off is limited so most of my opportunities for such interaction occur at most twice a year at FORML or Rochester On the other hand not having anyone to give guided direction to your thinking can allow original thought to take some inter esting directions How useful these thoughts are often cannot be determined by the originator It s a little like the male complex where no baby is ever pretty until it s his own So it is with ideas they are much like the only child a male can bear and there fore look pretty darn cute to Dada It can be a bit hard to be objective when there is that feeling of self investment in the thoughts Continued on page 34 _ Volume XI Number 2 REFERENCE SECTION Forth Interest Group The Forth Interest Group serves both expert and novice members with its net work of chapters Forth Dimensions and conferences that regularly attract partici pants from around the world For member ship information or to reserve advertising space contact the administrative offices Forth Interest Group P O Box 8231 San Jose California 95155 408 277 0668 Board of Directors Robert Reiling President ret director Dennis Ruffer Vice President John D Hall Treasurer Terri Sutton Secretary Wil Baden Jack Brown Mike Elola Robe
10. Y was typed answer 1 If N was typed answer 0 DUF i question no answer answert i ROT answer answerti question_no ANSWERS C answer answert i questian_no answers adr answer answert l question_adr C answer ENDIF i 2 oO N s IMMEDIATE amp 1 N amp CCOMPILE IF 3 IMMEDIATE 2 screen line flag IF screen line CR SWAF line screen LINE CRA QUIT ELSE t creen line Forth Dimensions 24 There can be any number of questions in side a rule If the answer to any question must be false we can add NOT after the name of the question rule_name questionl amp question2 NOT amp question3 It is possible to use AND or OR to link two or more questions rule_namel questionl question2 AND rule_name2 questionl question2 OR But there are some problems if we do this If we use AND both questions will be asked of the user even if the answer to question is false Instead of AND we should use the word amp the ampersand rule _namel questionl amp question2 Now if the answer to question1 is not quest ion2 will not be asked The OR case is not so important be cause there is no difference between rule_name2 above and the next two tules rule name2 1 questionl rule _name2 2 question2 We have questions and rules now we order the rules inside a Forth word
11. extended memory My own need for this code arose while working with a video digitizer Data Translation s DT2851 frame grabber in an application where I wanted to manipulate an image directly The digitizer has two on board image buff ers each 256 Kb in size and each capable of holding a 512 x 512 x 8 bit image Obvi ously this total of 512 Kbofimage memory cannot readily be placed in MS DOS measly 640 Kb since that would leave es sentially no memory for the operating sys tem and programs In fact the digitizer s Volume XI Number 2 default address settings put the two image buffers at hex AO 0000 and A4 0000 well above 10 0000 the 1 Mb boundary To be able to inspect and manipulate im ages move them to disk and do other operations that require direct access to the digitized image it was necessary first to move part of the image down into DOS accessible memory This is the same tech nique used by standard software for ex tended memory cards The largest block of data that interrupt 15 can move is one segment or 64 Kb thus a 256 Kb image would have to be treated as at least four separate segments However I actually The same technique is used for memory cards found it more efficient to move one video line at a time 512 bytes The main reason is that in our implementation of Forth 83 Uniforth from Unified Software Systems it is much easier to perform subsequent opera
12. screens eight and nine is an example of the more general task of moving data be tween a disk and extended memory The save routines utilize a loop that copies each of an image s 480 lines into the VIDLINE array from which the line is written to disk The disk handling words are from Uniforth The real work of copy ing images is carried out by the intermedi ate level words IMAGE gt DISK and DISK gt IMAGE the high level words SAVE and RESTORE handle the additional tasks of specifying filenames and opening and closing files Screens on next page Richard F Olivo a neurobiologist is a professor at Smith College He uses Forth for laboratory oriented imaging and analog data acquisition He is cur rently programming a PCIAT data acquisition system with drop down menus dialog boxes and other Macin tosh like tools He wishes Forth had standard extensions to make such ef forts unnecessary Forth Dimensions m TOTALCONTROL with LMI FORTH t ay r For Programming Professionals an expanding family of compatible high performance Forth 83 Standard compilers for microcomputers For Development interactive Forth 83 Interpreter Compilers 16 bit and 32 bit implementations e Full screen editor and assembler e Uses standard operating system files e 400 page manual written in plain English Options include software floating point arithmetic coprocessor
13. 707 Wetware Diver Fairwitness Forth Con ference gars Usenet domain gars well UUCP or Internet well gars Ill winken arpa ForthNet is a virtual Forth network that gars wet UUCP WELL gars Continued from page 29 There isn t even a mother on which to blame half of the genes With those thoughts I begin Forth as a Standalone Operating System Both the R65F11 and F68HC11 single standalone computer systems They use Forth as their operating system In this regard they follow in the tradition of mi cros like the KIM 1 SYM 1 and the AIM 65 Each of these had a built in monitor to allow user interaction with the system Similarly other systems used BASIC as their power on operating system such as the if my memory serves OSI TRS 80 and Apple Something to keep in mind operating system hasn t always meant disk operat ing system As most of us have heard Forth is nearly its own operating system In fact it chip computers have been designed as is often stated that Forth is difficult to install under an existing operating system because it is not well behaved These comments really have nothing to do with Forth asa general language but come outof the difficulty of doing blocks under another OS Wil Baden March 1989 Owner of Paleotaurus Inc lt Wil gt Let s stop kidding ourselves Forth deserves its reputation as a write only language 99 percent of published
14. GDT gdt addr amp segment words j 10 int15 call int15 11 dup not if drop then test status O ok drop code 12 else Error quit if error print code amp quit 13 then 14 gt 15 Screens continued on page 28 L ARSE E S E D Forth Dimensions 22 INNER ACCESS provides FORTH Development Tools For Zilog s Z8874 Super8 FORTH chip Development Board Incorporating the Supers FORTH microcomputer offers an unparalleled development environment for control applications With the addition of just a 5 volt power source and terminal you can develop serious applications swiftly and interactively in a nearly full implementation of F33 FORTH Metacompiler FORTH program that runs on an IBM compatible that creates an image of a Super8 FORTH complete with the programmer s application and can be downloaded to the Super emulator for testing Development ROMs Enable you to compile FORTH code directly using any of the 3 types of Super8 s available from Zilog The Super8 contains a serial interface that can be connected to a terminal or PC for direct loading of source code For more information call 415 591 8295 amp pel Access Box 8 Belen CA Volume XI Number 2 Forth 83 fig FORTH EXPERT SYSTEM TOOLKIT MARCOS CRUZ MADRID SPAIN S ISIFOrth is an environment in which to write expert systems It is not a
15. ca pabilities of Metawindows tm Metagraphics We use our Rosetta Stone Dynamic Linker to interface to Meta windows HS FORTH with MetaWindows makes an un beatable graphics system Or Rosetta to your own preferred graphics driver HS FORTH provides hardware software floating point including trig and transcendentals Hardware fp covers full range trig log exponential functions plus complex and hyperbolic counterparts and all stack and compari son ops HS FORTH supports all 8087 data types and works in RADIANS or DEGREES mode No coproces sor No problem Operators mostly fast machine code and parse format words cover numbers through 18 dig its Software fp eliminates conversion round off error and minimizes conversion time Single etement through 4D arrays for all data types in cluding complex use multiple cfa s to improve both per formance and compactness Z X Y X Y would be coded X Y XY ISZ 16 bytes instead of X Y X Y Z 26 bytes Arrays can ignore 64k boundaries Words use SYNONYMS for data type inde pendence HS FORTH can even prompt the user for retry on erroneous numeric input The HS FORTH machine coded string library with up to 3D arrays is without equal Segment spanning dynamic string support includes insert delete add find replace exchange save and restore string storage Our minimal overhead round robin and time slice multi taskers require a word that exits cleanly at the end o
16. demo program all parameters are positive integers Figure Three shows a family of a dozen eggs sorted by their point height Lm Forth Dimensions HSI Forth EGGS OVALS EASY ROBERT GARIAN ARLINGTON VIRGINIA Figure Four shows a nest of eggs of varying girths and point heights You might like to experiment with the source code and mod ify it for applications It is easy to draw filled ovals just by replacing the PIX function with the corresponding LINE function You may also want to experiment with the explicit form of the OVAL func tion which can be obtained as follows solve the following parametric equations of an ellipse for T Y R2 COS T C X R1 SIN T D Take the cosine of both sides and apply the identity COS SIN T V 1 T to get Y R2V1 X D R1 C E R2 R1 R3 R1 R2 R3 0 Point R1 R2 R3 gt 0 Circle R2 R3 R1 gt 0 Symmetrical oval R2 R3 gt 0 R2 lt gt R3 R1 gt 0 Egg oval Figure One Relationship of three radii to geometrical shapes OVAL R1 R2 R3 Text continued on page 35 Figures continued on page 8 Volume XI Number 2 YES THERE IS A BETTER WAY A FORTH THAT ACTUALLY DELIVERS ON THE PROMISE HS FORTH POWER HS FORTH s compilation and execution speeds are unsurpassed Compiling at 20 000 lines per minute it compiles faster than many systems link For real jobs execution speed is unsur
17. in the Forth Interest Group at 30 per year 42 overseas air For membership change of address and to submit items for publication the address is Forth Inter est Group P O Box 8231 San Jose California 95155 Administrative offices and advertising sales 408 277 0668 Copyright 1989 by Forth Interest Group Inc The material contained in this periodical but not the code is copyrighted by the individ ual authors of the articles and by Forth Interest Group Inc respectively Any reproduction or use of this periodical as it is compiled or the ar ticles except reproductions for non commer cial purposes without the written permission of Forth Interest Group Inc is a violation of the Copyright Laws Any code bearing a copyright notice however can be used only with permis sion of the copyright holder About the Forth Interest Group The Forth Interest Group is the association of programmers managers and engineers who create practical Forth based solutions to real world needs Many research hardware and soft ware designs that will advance the general state of the art FIG provides a climate of intellectual exchange and benefits intended to assist each of its members Publications conferences semi nars telecommunications and area chapter meetings are among its activities Forth Dimensions ISSN 0884 0822 is published bimonthly for 24 36 per year by the Forth Interest Group 1330 S Bascom Ave Suite D S
18. is further limited by the PC architecture Even with extended memory cards a program under MS DOS cannotdirectly read from or write to such memory The ROM BIOS does however provide a way out Here are some Forth words that access memory well above the one meg boundary EXPERT SYSTEM TOOLKIT MARCOS CRUZ 23 Here the author describes his environment in which to write expert systems It uses a set of Forth words to define the rules questions and answers one finds in an expert system There are just three basic steps define the questions the rules and at last the order of the rules and the answers they lead to TWO ASSEMBLERS ARE BETTER THAN ONE DARRYL C OLIVIER 30 The Forth assembler is handy for short pieces of code but cumbersome for large routines A full fledged macro assembler is ideal for larger routines but messy to implement Fortunately we can use aregular macro assembler and treat the binary output as a Forth word eo p gt eS i Ezi Editorial Reference Section 4 33 Letters FIG Chapters 5 36 39 Best of GEnie Advertisers Index 32 37 J Volume XI Number 2 3 Forth Dimensions EDITORIAL Call for Articles FORTH HARDWARE Creative Solutions Don Colburn was recently attending a developers conference where he met by chance one of the Forth Interest Group s directors He suggested Forth Dimensions pay for articles about a particular theme announced by the edi
19. memory PVM83 Popup Windows Prolog Save and Restore windows from files Virtual Mouse Support Machine Circular Event Que for Mouse keyboard All programs include 5 1 4 disk and manual CONCEPT 4 INC forthWiINDOWS Text and Data Windows Add productivity flexibility and auto mated reasoning Fully interactive between Forth and Prolog code Send check or money order to 69 95 PO BOX 20136 VOC AZ 86341 DOS services directory F83 HSFORTH FPC supported 49 95 All programs require DOS 2 0 or higher Volume XI Number 2 27 Forth Dimensions Fo ea a Se We can also think of SISTFOrth rules as Prolog sentences where there are condi tions to make the rule true With that idea in mind as you can see in the last example it is as easy to write an intelligent data base using SJSIFOrth as it would be using Prolog One more thing if the order of the rules inside the main word is chosen with care some questions of some rules can be saved But it is better to write every question needed in every rule it is surer And the final message should not be needed if the tules have been thought out properly but it is better to keep it there while debugging an expert system About the Name In Greek mythology Sisifo Sisyphus in most English translations was sen tenced by Zeus to roll a big stone up a mountain but when he arrived the stone dropped back down and Sisifo had to go down and
20. study Now back to my provocations I am extremely curious about the implementa tions Abu Mostafa has come up with to support postfix messaging private and public methods and inheritance Of extreme interest is the embodiment of several data and colon definition decla rations within a structure that looks like a super colon definition delimited by CLASS and CLASS What change does this make to the Forth landscape I assume that each instance of a class is created by honoring each of the data decla rations in the hierarchy of classes For example FIXED STACK creates an in stance object by creating the BOS and TOS instance variables inherited from the STACK class followed by the MAXSIZE instance variable directly declared in the FIXED STACK class followed by space for the stack itself Wow Presumably the name fields such as TOS and BOS aren t recreated with each instance object Rather those names should become shared addressing methods for FLOAT and STACK classes as well as any of their descendent classes Less inspirationally there remains the need for programmer supplied typing of objects Abu Mostafa has provided his object oriented method of taking the aver age of two numbers USE FLOAT A B 2 C The introductory phrase USE FLOAT should not be necessary in an object ori ented language Because objects such as A and B are known to be of a given class the methods for fetching and addin
21. the main word of the expert system in the following way expert_system_name SISIFORTH_OK Starting message snl lnl rule_namel sn2 1n2 rule_name2 etc J Volume XI Number 2 Message if no rule was true r For each rule sn and 1n are the screen number and line number where the text of the answer has been typed So if the rule is tue line Ln of screen sn will be printed and SISIFOrth will stop The order of the rules is very important because SISIFOrth will stop whenever it finds a true rule So for example if there are two rules like rulel questionl amp question2 amp question3 rule2 questionl amp question3 then rule2 should always be after rulet If not and if quaestion1 and question3 are both true SISIFOrth would stop in rule2 before examining rulel SISIFOrth Words I think SISIFOrth will be easy to under stand because only a few words do all the work The power of SISIFOrth is the way it does the dirty work we have nothing to do but tell it the rules and where the text is located QUESTIONS A constant that holds the maximum number of questions ever used It has to be changed as needed ANSWERS Anarray that holds the answers made by the user Answers are stored as 0 for ques tion not answered 1 for question an swered false and 2 for question answered true N amp Counter of how many times amp is f
22. then gt r repeat begin dup xmin lt gt while r gt repeat drop maxy maxy ymin vert 0 do pts i y max loop miny lt miny ymax vert 0 do pts i y min loop drawscan yS gt r begin sp stack lt gt while r plot r draw repeat r gt drop area adr n 2dup line vert pts sp stack maxy 1 miny do vert 1 0 do pts i y pts i i y 2dup min j lt rot rot 2dup max j gt rot rot lt gt and and if j pts i sy pts i 1 x pts i x pts i 1 y pts i y mod swap drop pts i x sort then loop i drawscan loop e ee BRYTE FORTH ov the INTEL 8031 MICRO CONTROLLER FEATURES FORTH 79 Standard Sub Set Access to 8031 features Supports FORTH and machine code interrupt handiers System timekeeping maintains time and date with leap year correction Supports ROM based self Starting applications cost 130 page manual 30 00 8K EPROM with manual 100 00 Postage paid in North America Inquire for license of quantity pricing Bryte Computers Inc P O Box 46 Augusta ME 04330 207 547 3218 lee Volume XI Number 2 CALL FOR PAPERS for the eleventh annual FORML CONFERENCE The original technical conference for professional Forth programmers managers vendors and users Following Thanksgiving November 24 26 1989 Asilomar Conference Center Monterey Peninsula
23. through nine A 512 byte array VIDLINE is created in the Forth dictionary to hold one video line Absolute 32 bit addresses for this array and for the image buffers required by MAKE GDT are calculated by words in screens three four and six Some of the defining words like DSEG and SEG gt ADR are specific to Uniforth New Forth words that move single video lines are DICT gt VLINE screen five which copies the VIDLINE array from the dictionary to the image buffer and VLINE gt DICT screen six which copies video line Y from the image buffer to the array These words are typi cally used in the opposite order from which they are presented a video line is moved from the image to the dictionary J Forth Dimensions manipulated and then moved back to the image Since a video line is usually re placed at the same location it was taken from DICT gt VLINE does not automati cally recalculate the Y value address This lack of symmetry was adopted for speed but it strikes me as a potentially risky programming style A few words that act on images are shown as examples in screen seven PIXEL and PIXEL access a single pixel picture element when one considers how much hidden work these words invoke screen seven may also be taken as a commentary on the disastrous architecture of Intel processors Neverthe less filling the screen VF ILL takes only about a second Transferring images to and from disk
24. to write about Forth hardware yet you probably have a few minutes to peruse the rest of this issue Dust off your graphics vocabulary and dig into Eggs Ovals Easy my nomination for best original title and Filling Algo rithms The last is by one of our authors in Poland where several items have been published about Forth We have very few details and can only speculate about how Forth is being used there and how well it is regarded In fact I received a couple of manu scripts from Poland at about the time Jack Woehr s Chapter Coordinator column pointed out that Forth interest overseas is far from on the wane Another two articles from Spain showed up in the mail that same week one appears in this issue titled Expert Systems Toolkit We appreciate the efforts of these far flung fellow Forth users many of whom will be key to the future of Forth development around the world We welcome each of them to our community may we learn a great deal from one another Marlin Ouverson Editor Forth Dimensions Published by the Forth Interest Group Volume XI Number 2 July August 1989 Editor Marlin Ouverson Advertising Manager Kent Safford Design and Production Berglund Graphics Forth Dimensions welcomes editorial mate rial letters to the editor and comments from its readers No responsibility is assumed for accu racy of submissions Subscription to Forth Dimensions is in cluded with membership
25. 2 8140 MASSACHUSETTS Boston Chapter 3rd Wed 7 p m Honeywell 300 Concord Billerica Gary Chanson 617 527 7206 MICHIGAN Detroit Ann Arbor Area 4th Thurs Tom Chrapkiewicz 313 322 7862 Fred Olsen 612 588 9532 MINNESOTA MNFIG Chapter Minneapolis MISSOURI Kansas City Chapter Ath Tues 7 p m Midwest Research Institute MAG Conference Center Linus Orth 913 236 9189 St Louis Chapter 1st Tues 7 p m Thornhill Branch Library Robert Washam 91 Weis Drive Ellisville MO 63011 NEW JERSEY New Jersey Chapter Rutgers Univ Piscataway Nicholas Lordi 201 338 9363 Volume XI Number 2 NEW MEXICO Albuquerque Chapter 1st Thurs 7 30 p m Physics amp Astronomy Bldg Univ of New Mexico Jon Bryan 505 298 3292 NEW YORK FIG New York 2nd Wed 7 45 p m Manhattan Ron Martinez 212 866 1157 Rochester Chapter Odd month 4th Sat 1 p m Monroe Comm College Bldg 7 Rm 102 Frank Lanzafame 716 482 3398 OHIO Cleveland Chapter 4th Tues 7 p m Chagrin Falls Library Gary Bergstrom 216 247 2492 Columbus FIG Chapter 4th Tues Kal Kan Foods Inc 115 Fisher Road Terry Webb 614 878 7241 Dayton Chapter 2nd Tues amp 4th Wed 6 30 p m CFC 11 W Monument Ave 612 Gary Ganger 513 849 1483 OREGON Willamette Valley Chapter 4th Tues 7 p m Linn Benton Comm College Pann McCuaig 503 752 5113 PENNSYLVANIA Villanova Univ FIG Ch
26. 32 source available Unit Price starts at 195 Prices start at 1 995 with SC Forth32 Ideal for embedded systems control multitasking and multiple processor operation data acquisition image processing or computation intense applications For additional information contact us at Silicon Composers ibis 210 nena baht ae K Ae CA 94306 un IS 322 8763 F orth Dinaasans 2 V lume Xl N umbe 2 FOR IH M E N EGGS OVALS EASY ROBERT GARIAN 6 The method for drawing described here generates shapes like footballs ellipses and eggs An oval is generated by three radii variations in which produce several classes of oval objects And it is just as easy to draw filled ovals FILLING ALGORITHMS ZBIGNIEW SZKARADNIK 10 Filling algorithms are specially suited to Forth because of the ease of using the stack for data storage The author discusses filling areas of known contour and filling polygons whose vertices are known PDE FULL SCREEN EDITOR FRANS VAN DUINEN 14 Another editor yes but with differences multi file editing windows copying screens between files single step execution with stack control of on screen words nested VIEWs and more Even if you don t use F83 the flavor of this code you will certainly want to adopt some of the author s ideas ACCESSING 80286 EXTENDED MEMORY RICHARD F OLIVO 19 MS DOS was written for the 80286 s real mode leaving 15 unaddressable Mb of memory that
27. ATE has to be executed before issuing BLOCK again because it always applies to the current block the one in the first position in the buffer header list There appears to be yet another prob lem Atleast some updates to a block would not be written out when switching between files The SAVE BUFFERS in GET FILE and the extra code in MARK UPD Figure Seven should not be necessary but seem to have fixed the problem Another place where multi file capabil ity had an impact was in the TAGS FSED used five to six fields to note a specific screen and line number e g to mark a spot for fast return or to mark a block or range of lines for copying PDE extends this in two ways Firstly every TAG includes the FCB for that block secondly every tag includes the exact cursor location at the time the tag was noted PDE also maintains a circular TAG list of the last ten screens edited This allows us to quickly revisit screens or to return from inspecting definitions of words EVIEW A very powerful capability in PDE is on screen VIEW EVIEW screen 47 Fig ure Eight While EVIEW is simply an adaptation of F83 s VIEW it is important because it is integrated and easy to use Say you re writing a new definition that uses SEARCH but don t remember what SEARCH needs leaves on the stack Simply position the cursor at the start of the word SEARCH on the screen which you had typed as part of the definition you
28. C type segmented memory struc ture Forth 79 is used along with the Microsoft Macro Assembler under MS DOS This makes practi cal a library of binary routines The assembler routine to be adopted into Forth must be written or modified to conform to certain restrictions It must be in the COM format with all code and data in the same segment The instruction ORG 100h usually included in a COM pro gram is not used because we want the routine to begin at offset zero within its segment Alternately keepthe ORG 100h instruction and subtract 10h from the seg ment value in the Forth defining word A stack segment is not defined and SS is not used in the ASSUME statement Input and output parameters will be passed via the Forth stack When the routine executes the top two elements on the stack will be the ica and offset of the Forth re entry Forth Dimensions SCR Forth 79 TWO ASSEMBLERS ARE BETTER THAN ONE DARRYL C OLIVIER NEW ORLEANS LOUISIANA 1 Two Assemblers Are Better than One D C Olivier 3 6 89 VARIABLE SIZE VARIABLE BINSEG VARIABLE NAME 11 ALLOT DVARIABLE REGS Size of file to be loaded Segment File name string Holds register contents 0 1 2 3 4 5 6 7 CODE CSEG Leaves contents of the CS register on the stack 8 CS PUSH 9 NEXT JMP END CODE SCR 2 0 Two Assemblers Are Better than One D C Olivier 3 6 89 1 CODE
29. CALLBIN 2 REGS BP MOV Save registers 3 REGS 2 SI MOV used by Forth 4 203 C Intersegment return instruction for 8088 5 END CODE 6 7 CODE REENTRY 8 AX CS MOV 9 DS AX MOV Restore DS register 10 BX REGS MOV 11 BP BX MOV Restore registers 12 BX INC BX INC used by Forth 13 SI BX MOV 14 NEXT JMP END CODE SCR 3 0 Two Assemblers Are Better than One D C Olivier 3 6 89 1 2 READBIN eevee 3 3 4 EXIT 5 6 The name of the binary file is at NAMES as a counted string 7 Use your own DOS file interface to open the file determine and 8 store its size in SIZE read the file from disk to BINSEG 0 9 close the file do any appropriate error checking SCR 4 0 Two Assemblers Are Better than One D C Olivier 3 6 89 l BINFILE 2 gt IN Saves input stream pointer 3 BL WORD DUP Reads next word from input stream 4 C 1 NAMES SWAP CMOVE Moves word to variable NAMES 5 gt IN I Restores imput stream pointer 6 CREATE Reads same word creates header 7 HERE 16 1 DUP of paragraphs to HERE 1 8 CSEG BINSEG Segment for binary routine 9 READBIN Read file from disk to BINSEG 0 10 16 SIZE DP Allot dictionary space 11 DOES gt PPA on stack at run time 12 CSEG REENTRY Segment and offset of reentry point 13 ROT 16 l CSEG 0 Segment an offset of binary routine 14 CALLBIN Intersegment RET instruction SA EE TT TT TE TED LE IR 30 Volume XI Number 2 point These sh
30. DITORS T h 147 GODT 29 c in two places in GDT DECOMPILER AND 13 DEBUGGING AIDS SCR 2 8088 ASSEMBLER 0 INTERRUPT 15 CODE moves data using GDT 1 hex GRAPHICS amp SOUND 2 code INT15 gdt addr segment words status O0 success ENHANCEMENT 3 CLI disable interrupts time of day clock eNGS S 4 BX CX MOV words from top of stack BX to CX eDETAILED MANUAL 5 AX POP GDT s dictionary s segment 6 AX ES MOV GDT segment into ES INEXPENSIVE UPGRADES 7 SI DX MOV save SI Uniforth s interpreter pointer 8 AX POP GDT s address offset in segment NGS USER NEWSLETTER 9 AX SI MOV GDT offset into SI 10 00 AL MOV 87 AH MOV function 87 to AH A COMPLETE FORTH 11 15 INT call interrupt 15 DEVELOPMENT SYSTEM 12 DX SI MOV restore SI 13 AH BL MOV put status code on tos PRICES START AT 70 14 00 BH MOV clear high byte tos restore intrupts 15 STI NEXT END CODE decimal gt NEW HP 150 amp HP 110 VERSIONS AVAILABLE L NEXT GENERATION SYSTEMS P O BOX 2987 SANTA CLARA CA 95055 408 241 5909 E O U EE E E Volume XI Number 2 21 Forth Dimensions hex 00A0 0000 CURRENT BUFFER out buf 4 0 CR 0 1 2 3 4 5 6 TN 8 9 10 11 OTHER BUFFER 12 13 bufferl 14 gt 15 SCR 0 1 2 3 decimal 4 DICT gt VLINE 5 vidline dadr 6 current vline 2 7 pixels line 8 make GDT 9 Automatic calculation of active buffer s address
31. DROP ELSE ROT DROP ROT DROP THEN ELSE SCAN THEN USCAN Case insensitive scan no simple scan INSTRING Find string S within string B fast INSTRING S sadr slen badr blen blen 0 WHILE 1 1 D REPEAT THEN R gt R gt 2DROP ROT 2DROP Step past matching char saddr baddr blen blen length not searched 20VER gt R C gt R slen amp to gt R ROT 0 MAX DUP IF Only if blen gt slen 1 Length to scan blen slen 1 BEGIN R sadr badr blen c USCAN DUP IF sadr badr blen R gt 20VER R COMPARE 0 equal 1 or 1 for not eql SWAP gt R c back to gt R ELSE 0 THEN Fix of parms on stack Figure Two SEARCH for substring case insensitive INS STR S addr len Pos DUP gt R 2DUP DUP CHARS TO EOL B BUF MV Make space len R gt BADDR SWAP MOVE E UPD REPL S R addr R len Pos D len OVER DEL CHARS INS STR Figure Three Text insert and replace 14 Volume XI Number 2 multi screen search capability and more 7 i STEP S Executes one word amp displays stack This article describes some of the more EXTRACT WD SET TIB Start addr of word in buff interesting techniques used in PDE to allow EXEC WD copy word amp execute others to tinker with and enhance PDE 0 MV CURS H Restore cursor in CRT screen Only a few of the 80 plus screens are cov ered here 2STEP S gt Execut
32. Forth programs prove this Until Forth improves its reputation it will be scorned Tonight I want to investigate the evil forces that cause this and discuss six necessary but insufficient rules for more readable pro grams 1 The stack state must be given for every line 2 Formatting must show logical structure 3 Use short definitions short lines short phrases 4 Don t mumble your program should pass your spelling checker 5 Mix upper and lower case all lower case is just as bad as all upper 6 Write comments in the English language Are there better rules What else must be done If you are grinding your teeth and wish ing you had participated in one of these terrific guest conferences all is not lost The immediacy is lost forever but the words remain for you to capture and study at your leisure They are posted in the GEnie Forth RoundTable Library 1 Screen continued from page 28 SCR 9 O RESTORE AN IMAGE FROM DISK FILE 1 decimal 2 3 DISK gt IMAGE ose Copy an open disk file to video 4 480 0 do For 480 lines of a video image 5 vidline 512 handle set up array s address size file 6 read bytes drop load array from file drop status 7 i current vline find address in image of this line 8 dict gt vline loop and move the line to image buffer 9 10 RESTORE filename Open amp load file to video 11 freeze open filename St
33. Forth Dimensions Pisces making use of a stack for storing data are quite often applied in practice However if a high level lan guage is used it is usually hard to imple ment a stack efficiently This does not concern Forth of course which is spe cially suited to such algorithms Filling algorithms are very applicable here The task of filling an area may be de fined as follows Filling an area of known contour not necessarily regular Filling the interior of a polygon not necessarily convex whose vertices coordinates are known Forth is specially suited to such algorithms Let us begin with the first algorithm realized as the word Fil1 in Listing One The algorithm assumes that the closed contour of an area is stored in video mem ory and that the coordinates of a point lying within the contour are known This point is called the seed and its coordinates are pushed onto the stack In the next step the seed point is displayed at a given posi tion and intervals connecting it with the contour to the right and left are drawn At that time the coordinates of the extreme points Xleft and Xright of the contour are calculated Next Scan is called which investigates the line above and the line below the plotted interval limited by Xleft and Xright Theinvestigation s effect is to find new seeds whose coordi Forth Dimensions Forth 83 FILLING ALGORITHMS ZBIGNIEW
34. G19 Univ of New South Wales Peter Tregeagle 10 Binda Rd Yowie Bay 2228 02 524 7490 BELGIUM Belgium Chapter 4th Wed 8 p m Luk Van Loock Lariksdreff 20 2120 Schoten 03 658 6343 Southern Belgium Chapter Jean Marc Bertinchamps Rue N Monnom 2 B 6290 Nalinnes 071 213858 CANADA BC FIG ist Thurs 7 30 p m BCIT 3700 Willingdon Ave BBY Rm 1A 324 Jack W Brown 604 596 9764 BBS 604 434 5886 Northern Alberta Chapter 4th Sat 10a m noon N Alta Inst of Tech Tony Van Muyden 403 486 6666 days 403 962 2203 eves Southern Ontario Chapter Quarterly 1st Sat Mar Jun Sep Dec 2 p m Genl Sci Bldg RM 212 McMaster University Dr N Solntseff 416 525 9140 x3443 Toronto Chapter John Clark Smith PO Box 230 Station H Toronto ON M4C 5J2 ENGLAND Forth Interest Group UK London 1st Thurs 7 p m Polytechnic of South Bank RM 408 Borough Rd DJ Neale 58 Woodland Way Morden Surry SM4 4DS FINLAND FinFIG Janne Kotiranta Arkkitehdinkatu 38 c 39 33720 Tampere 358 31 184246 HOLLAND Holland Chapter Vic Van de Zande Finmark 7 3831 JE Leusden ITALY FIG Italia Marco Tausel Via Gerolamo Forni 48 20161 Milano 02 435249 JAPAN Japan Chapter Toshi Inoue Dept of Mineral Dev Eng University of Tokyo 7 3 1 Hongo Bunkyo 113 812 2111 x7073 NORWAY Bergen Chapter Kjell Birger Faeraas 47 518 7784 REPUBLIC OF CHINA R O C Chapter C
35. Inner Access 22 InterSystems o0 18 Laboratory Microsystems 20 Miller Microcomputer Services 17 Mountain View Presso 9 Next Generation Systems 21 SDS Electronic oee 15 Silicon Composers 2 29 paes Volume XI Number 2 Code continued from page 9 DOZEN EGGS 35 IS R1 CR CR Assumes R1 has been preset WIPE Point height is increasing Equatorial radius is R1 6 IS COLS 2 IS ROWS R1 2 10 IS HJUMP 200 ROWS 2 10 IS VJUMP COLS 1 1 DO ROWS 1 1 DO HJUMP J IS D VJUMP I ISC F1 J IS R2 F2 I IS R3 OVAL LOOP LOOP ORIGIN CASE COMMANDS DOZEN EGGS NEST OF EGGS ONE EGG BYE CASE DEMO BEGIN CR 1 Dozen eggs CR 2 Nest of eggs CR 3 Draw an oval CR 4 Quit CR Your choice IN 1 ABS 3 MIN O MAX COMMANDS CR Press any key KEY DROP WIPE AGAIN Enter DEMO and a carriage return 16 1024 CONSTANT 16K 16K 10 SEGMENT PICTURE set up a buffer CLRBUF clear the buffer PICTURE DUP O OVER 2I 32 FILLL 0 PICTURE 4I Take a snapshot of screen Save it in TEMP PIC SNAP 16K PICTURE 4I make sure entire screen is saved C OFF cursor off CRT BASE 0 PICTURE O 16K CMOVEL SCREEN to PICTURE segment PICTURE TEMP PIC PUT FILE C 2 PICT to TEMP PIC file cursor on QD PICTURE 0 CRI BASE 0 16K CMOVEL PICTURE to SCREE
36. K use WORD HERE instead of simply WORD If necessary use lt BUILDS instead of CREATE at the start of QUESTION Simple Examples Screens two and three show a simple example To get it working just compile the screen where it starts then type SISIFORTH_VEHICLES You will have to answer some questions before SI SIFOrth gives an answer Try again chang ing your answers to see what happens I know this example is very simple but if the way SISIFOrth works has been un derstood it should be clear that very com plex expert systems can be written in this way not based on probabilities but hard rules expert systems Screens six through ten show another example Ascan bee seen the only problem in building an expert system is designing it Screen 10 SISIFOrth Flease look Flease look Please look Flease look Flease look Flease look Please look Flease look Flease look at shelving D Please look at sehlving 10 Sorry we have only computer languages books library manager continued at shelving at shelving at shelving at shelving at shelving at shelving at shelving at shelving 0ND PUNE S OONOU DWH eh i ad Pid ble m ii CODE OPT 8086 8088 Native Code generator The easy way to optimize Laxen amp Perry F83 including the hi level flow control words If Then Do Loop Begin Again 20 00 CONCEPT 4 90 Windows per available
37. LK 2 09 SHELVING O BLK 2 10 SHELVING_10 14 Sorry I can t help you 3 15 3S Compiles and the needed ENDIFs to complete the rule structure Screen 9 7 i O C SISIFOrth library manager continued using the value stored in N amp 1 Are you interested on computer languages 2 Are you interested on Forth language BLK 3 Are you interested on Fascal language 4 Are you interested on BASIC language This makes the expert system source Are you interested on C language code relocatable among screens Instead 6 Are you interested on any particular dialect PE T 7 Are you interested on Forth 79 of using absolute screen numbers to indi 8 Are you interested on Forth 837 cate where an answer or questions has 9 Are you interested on MMS Forth been typed we can use BLK rs where 10 Are you interested on fig Forth ry 11 Are you interested on Turbo Fascal rs stands for relative screen the offset 12 Are you interested on UCSD Fascal from the actual compilation screen Thus os BLK 0 denotes the screen currently being compiled BLK 1 means the next screen etc Conversion to fig SISIFOrth To convert this code to run on a fig FORTH system just add 0 before any ee Forth Dimensions 26 Volume XI Number 2 occurrence of the word VARIABLE Then inthe word use DUP in place of DUP The word ABS at the end of the definition of Y N could be deleted In the definition of BL
38. N Look at snapshot kept in TEMP PIC LOOK CLRBUF PICTURE TEMP PIC GET FILE TEMP PIC to PICTURE QD Illustration DEMO2 NEST OF EGGS SNAP WIPE CR Screen saved CR Press any key to display screen stored in file KEY DROP LOOK 37 Forth Dimensions The FIG Chapters listed below are currently registered as active with regular meetings If your chapter listing is missing or incor rect please contact Kent Safford at the FIG office s Chapter Desk This listing will be updated in each issue of Forth Dimensions If you would like to begin a FIG Chapter in your area write for a Chapter Kit and Application Forth Inter est Group P O Box 8231 San Jose California 95155 U S A ALABAMA Huntsville Chapter Tom Konantz 205 881 6483 e ALASKA Kodiak Area Chapter Ric Shepard Box 1344 Kodiak Alaska 99615 e ARIZONA Phoenix Chapter 4th Thurs 7 30 p m AZ State University Memorial Union 2nd floor Dennis L Wilson 602 956 7578 e ARKANSAS Central Arkansas Chapter Little Rock 2nd Sat 2 p m amp Ath Wed 7 p m Jungkind Photo 12th amp Main Gary Smith 501 227 7817 FIG CHAPTERS e CALIFORNIA Los Angeles Chapter 4th Sat 10 a m Hawthorne Public Library 12700 S Grevillea Ave Phillip Wasson 213 649 1428 North Bay Chapter 2nd Sat 10 a m Forth AI 12 Noon Tutorial 1 p m Forth South Berkeley Public Library Geor
39. PIXEL nxy Replace pixel X Y with value n 3 vline gt dict Bring video line Y from image 4 vidline c address pixel X modify it 5 dict gt vline and send line back to image 6 7 PIXEL xy n Fetch value n of pixel X Y 8 vline gt dict Y coord specifies one line 9 vidline c address pixel X find value 10 11 VFILL n Fill entire image with byte n 12 freeze End live video hold image 13 vidline pixels line rot fill set up video line 14 480 0 doi current vline address 480 lines of image 15 dict gt vline loop gt amp copy same array into each SCR 8 O SAVE AN IMAGE TO DISK FILE 1 decimal 2 HANDLE n fcb cR Get current file handle 3 4 IMAGE gt DISK Move video image to an open file 5 480 0 do For 480 lines of a video image 6 i vline gt dict move each line from image to array 7 vidline 512 handle set address count amp file handle 8 write bytes drop write array to disk drop status 9 loop and do next line 10 11 SAVE filename Save image in new disk file 12 close freeze Close any open file freeze image 13 Saving image tell user something is happening 14 make filename open a file using filename supplied 15 image gt disk close gt copy image and close file Screens continued on page 34 Forth Dimensions 28 Volume XI Number 2 n m numm SILICON COMPOSERS Per
40. S from disk to BINSEG 0 Line ten allots dictionary space for the defini tion Line 12 begins the run time part of the defining word It places on the stack the address of the Forth re entry point to be used by the final RET instruction in the binary routine Line 13 places the address ofthe beginning of the binary routine on the stack At first glance it might seem that this is simply BINSEG 0 but if the Forth program has been compiled as a turnkey system it may be executed from a different segment that the one in which it was com piled That is why this address must be calculated at run time Line 14 executes an intersegment RET instruction which takes the segment and offset from the stack and jumps to it This technique makes practical a com mercial or public domain library of binary routines to be incorporated into Forth pro grams These could be sorts searches graphic routines math functions trans forms etc Of course such a library would not be portable across CPUs but it would be portable across Forth dialects Any im plementation dependencies would be hid den in the defining word BINF ILE Sucha TITLE PLUS ASEG SEGMENT PARA PUBLIC ASSUME CS ASEG DS ASEG ES ASEG START JMP ADDUP RET_ADDR1 DW RET_ADDR2 DW ADDUP PROC FAR r Code and data in same segment MOV AX CS MOV DS AX Save the Forth re entry point POP RET _ADDR1 POP RET ADDR2 Perform the operati
41. SZKARADNIK BYTOM POLAND other seeds Lij first seed l Figure One nates are pushed onto the stack The de scribed actions as shown in Figure One are repeated until the stack is empty The Dot word used by Fi11 allows displaying a point at coordinates X Y while Point checks to see if the point is displayed The second filling algorithm realized as the word Area in Listing Two requires that the coordinates of the vertices of a filled polygon be determined The algorithm does not need a bit map of the image so this method is used by some plotters The con tour must be closed i e the coordinates of the first vertex must be identical with those of the last First the contour is drawn using Line Next the minimum and maximum values of coordinate Y are found by search ing through all the vertices coordinates This is done by Ma xY and MinY Now for each line Y falling within the determined interval the X coordinates of the intersec tions with all the intervals of the contour are found Itcan be proven that foraclosed contour the number of intersections with line Y const is even To fill a contour like that the found points must first be ade quately connected as shown in Figure Two The problem in this case is that the X coordinates of the intersections are not de 10 Volume XI Number 2 Y const cross points
42. VOLUM JME XI N 989 NUMBER 2 ae _ JULY AU AUGUST 1 oe a es ta mS SILICON COMPOSERS Introduces the World s First 32 bit Forth Microprocessor SC32 Stack Chip Also the SC FOX Parallel Coprocessor System32 a PC based development system SC FOX PCS32 Parallel Coprocessor System32 SC32 Stack Chip Hardware Features SC FOX PCS32 Parallel Coprocessor System32 32 bit CMOS microprocessor 34 000 transistors Uses the SC32 Stack Chip microprocessor One clock cycle instruction execution System speed options 8 or 10 MHz Non multiplexed 32 bit address bus and data bus Full length 8 or 16 bit PC XT AT 386 plug in board 16 gigabyte non segmented data space 64K to 1M bytes 0 wait state static RAM 2 gigabyte non segmented code space Hardware expansion two 50 pin strip headers 8 or 10 megahertz full static operation Operates concurrently with PC XT AT 386 host Stack depths limited only by available memory Multiple PCS32 board parallel operation Interrupt and interrupt acknowledge lines PCS32 memory accessible by PC host Bus request and bus grant lines with on chip tristate PCS32 controlled through PC I O space Wait state line for slow memory and I O devices Data transfer through 16K shared memory window 84 pin ceramic PGA package SC Forth32 interactive Forth 83 Standard with MIL STD 883C Class B version 3rd quarter 1989 32 bit Forth extensions SC Forth
43. aForth 80286 386 Native mode extension 295 HARVARD SOFTWORKS PO BOX 69 SPRINGBORO OH 45066 513 748 0390 Volume X1 Number 2 Forth Dimensions Glossary Special Terms biradial arc A circular arc is swept out by a single radius around a point a biradial arc is swept out by a varying length line seg ment arrived at using the values of two fixed radii A biradial arc becomes a circular arc only when the two radii are equal convex A plane curve is convex if any straight line cuts the curve in just two points hemioval The northern or southern part of a gen eralized oval divided by the equator oval A closed curve bounding a convex domain pole The point at which the height of a hemioval is maximum or minimum HS Forth Words FIND lt word gt 0 Similar to IF THEN and used to load extension modules as needed i e if lt word gt wasn t found VAR A word created by VAR has three pos sible actions return a stored number store a number or return the address where a number is stored VARs are a hybrid between constants and variables If X is a var then 10 IS X will store 10 at the address of X and X alone will simply leave 10 thereafter FI A loop index used by the coprocessor similar to I FSIN FCOS F F F Math functions directed toward the coprocessor S gt F and F gt S Convert single numbers to and from floating point numbers on the respec tive sta
44. an Jose CA 95128 Second class postage paid at San Jose CA POSTMASTER Send address changes to Forth Dimensions P O Box 8231 San Jose CA 95155 Volume XI Number 2 Wish List Dear FIG One comment I want to give is that we should adopt the Modula 2 definition mod ule for specifying all Forth abstract data types This would allow standard libraries to be developed from Forth implementation modules by using the vocabulary structure Definition modules are readily available for lists priority queues binary search trees AVL trees records B trees sets polynomials and graphs Also I want to see more written about using a Forth Prolog interpreter for conver sions between regular expressions deter ministic and nondeterministic finite auto mata push down automata context free grammars and Turing machines Some discussion about the limits of computability and the Chomsky Hierarchy would help set the diverse Forth commu nity on common ground for an even more productive future John Howard 627 N E Terrace Drive Kansas City Missouri 64116 Curious About Code With Class Dear Marlin A significant reward for being pub lished is the comfort derived from knowing that your interests are shared by others I now know that Dr Ayman Abu Mostafa shares my interest in object oriented Forth OOF For this I am thankful and relieved Before seeing his letter I was worried that the audience of Forth Dimen
45. andard compatibility D Built in assembler O Generates headerless self starting ROM based applications O RAM less target or separate data and program memory space SDS Technical Support O 150 pages reference manual hot line 8051 development board available now Limited development system including PC software and 8051 compiled software with manual for 150 00 generates ROMable applications on top of the development system m u u m m ee a o ee ee ee ie es SS inc 5375 Pare Avenue 210 Montreal QC Canada H4P 1P7 514 731 5797 ee ee ee ee ee ee ee ee ee ee eee ee L Volume XI Number 2 15 Forth Dimensions EXTRACT WD S addr len BPOS MV RIGHT WD DUP CPOS TRAILING 1 PROC WD S exec addr gt R CPOS EXTRACT WD R gt EXECUTE DISPL TO EOL S LWCASE S LOWER PROC WD E UPD UPCASE S UPPER PROC WD E UPD Start addr of word in buff Step to next word in buff But return length 1 only Process word under cursor For DISPL TO EOL Start addr of word in buff Go process addr len gt Must set E UPD as reqd Restore cursor on CRT screen LWCASE converts one word to lowercase Convert to lower case Apply LOWER to current word UPCASE converts one word to uppercase Convert to upper case Apply UPPER to current word Figure Six Get a word on the screen and operate on it gt GET FILE s fcb
46. apter Bryan Stueben 321 C Willowbrook Drive Jeffersonville PA 19403 215 265 3832 TENNESSEE East Tennessee Chapter Oak Ridge 2nd Tues 7 30 p m Sci Appl Int l Corp 8th Fl 800 Oak Ridge Turnpike Richard Secrist 615 483 7242 TEXAS Austin Chapter Matt Lawrence PO Box 180409 Austin TX 78718 Dallas Chapter 4th Thurs 7 30 p m Texas Instruments 13500 N Central Expwy Semiconductor Cafeteria Conference Room A Clif Penn 214 995 2361 Houston Chapter 3rd Mon 7 45 p m Intro Class 6 30 p m Univ at St Thomas Russell Harris 713 461 1618 VERMONT Vermont Chapter Vergennes 3rd Mon 7 30 p m Vergennes Union High School RM 210 Monkton Rd Hal Clark 802 453 4442 VIRGINIA First Forth of Hampton Roads William Edmonds 804 898 4099 Potomac FIG D C amp Northem Virginia ist Tues Lee Recreation Center 5722 Lee Hwy Arlington Joseph Brown 703 471 4409 E Coast Forth Board 703 442 8695 Richmond Forth Group 2nd Wed 7 p m 154 Business School Univ of Richmond Donald A Full 804 739 3623 WISCONSIN Lake Superior Chapter 2nd Fri 7 30 p m 1219 N 21st St Superior Allen Anway 715 394 4061 INTERNATIONAL AUSTRALIA Melbourne Chapter lst Fri 8 p m Lance Collins 65 Martin Road Glen Iris Victoria 3146 03 29 2600 BBS 61 3 299 1787 Volume XI Number 2 39 Sydney Chapter 2nd Fri 7 p m John Goodsell Bldg RM L
47. calls DOS com mands other programs interactively from definitions or even from files being loaded DOS and BIOS function calls are well documented HS FORTH words we don t settle for giving you an INTCALL and saying have at it We also include both fatal and informative DOS error handlers installed by executing FATAL or INFORM HS FORTH supports character or blocked sequential or random O The character stream can be received from sent to console file memory printer or com port We include a communications plus upload and down load utility and foreground background music Display output through BIOS for compatibility or memory mapped for speed Our formatting and parsing words are without equal In teger double quad financial scaled time date float ing or exponential all our output words have string formatting counterparts for building records We also provide words to parse all data types with your choice of field definition HS FORTH parses files from any lan guage Other words treat files like memory nn H and nn H read or write from to a handle file or device as fast as possible For advanced file support HS FORTH easily links to BTRIEVE etc HS FORTH supports text graphic windows for MONO thru VGA Graphic drawings line rectangle ellipse can be absolute or scaled to current window size and clipped and work with our penplot routines While great for plotting and line drawing it doesn t approach the
48. cks Precedes a number to be put on the floating point stack Figure Two Typical egg shape or nar Me Nf Figure Three Eggs of increasing point height Figure Four Nested eggs of varying point heights and equatorial radii FOR X D R1 TO D R1 STEP 03 Y1 R3 SQR 1 X D R1 2 C Y2 R2 SQR 1 X D R1 2 C PSET X Y1 1 PSET X Y 2 1 NEXT X Figure Five The explicit oval function written in BASICA Forth Dimensions 8 Volume XI Number 2 Source code for Eggs ovals easy by Robert Garian 24Dec88 Written in Harvard Softworks HS Forth 3 4 for IBM PC and compatibles Uses Math Coprocessor FIND DG gt RD 0 FLOAD TRIG DECIMAL Floating pt amp Trig ftns FLOATS FINIT Initialize coprocessor DEGREES Compute in degrees BW640 High resolution mode O VAR C See Fig 1 0 VAR D O VAR R1 radius 1 0 VAR R2 radius 2 0 VAR R3 radius 3 O VAR STP step size 1 VAR KOLOR Erase 0 Draw 1 ORIGIN 99 IS C 319 ISD centers oval at 99 319 BARC TO ANGLE FROM ANGLE Note 4166667 5 12 aspect DO FI FDUP next angle FSIN R2 S gt F 4166667 F Fx F gt S C compute corresp row FCOS R1 S gt F Fx F gt S D compute corresp col KOLOR PIX LOOP set pixel OVAL 361 181 BARC draw northern arc R3 IS R2 cross equator 181 0 BARC draw southern a
49. ded capabilities including most of those in VED and F SED two other editors derived from the original Laxen editor Over the years I had adapted the Laxen editor to a variety of computers TRS 80 Osborne IBM PC and had built in a con siderable number of features for testing and debugging Using that as the backbone I incorporated the bestof FSED and VED and a whole slew of further enhancements The result is PDE It is integrated and easy to use PDE provides editing any number of files copying screens or parts thereof between files step wise execution of on screen word definitions with inspection and modifi cation of the stack inspection of word definitions built in SEE and VIEW with nesting of VIEWs and return to screen being edited LOAD part of screen upper lower case and numeric base con version e screen insert and delete two window support one for screen being edited and one scrolling as for DEBUG output ie Forth Dimensions PDE FULL SCREEN EDITOR FRANS VAN DUINEN TORONTO ONTARIO W2 SCROLL INSTALL W2 SCROLL S 0 12 AT LINE O 18 AT OUT OFF INSTALL W2 SCROLL IS CR Figure One Scrolling window on lower part of screen USCAN S addr len c addr len CAPS OVER ALPHA AND Can case matter IF DUP 20 XOR 20VER ROT SCAN yes scan 2 ways gt R gt R SCAN R gt R gt DUP 3 PICK lt IF 2
50. e Pacific Northwest The dif ference is that when the spring soddenness arrives in the Cascades the air is heavy with a primeval green scent whereas here in Golden at the foot of the Foothills there is the tangy aroma of fields of damp straw Soon the bull snakes will hatch and warm their coppery beauty in the sunshine of early June Already it has become a questionable enterprise to climb North Table Mountain unseasonable eighty de gree weather in late April has the rattlers already emerging from their hibernation to bedevil suburbanites engaged in lawn care in the upscale development injudiciously located on the side of that prominence Colorado is like the bull snake fresh from the shell a coiled potency awaiting exercise The end of the petroleum boom left many high and dry economically Last year mortgage foreclosures surpassed new mortgages for the first time There is asense of lack of permanence among the high tech employed Miniscribe for instance for merly the Boulder area wunderkind has been steadily cutting back Yet the improbable obtains Coloradois a hotbed of Forth Ball Aerospace is here those arbiters of the final configuration of the RTX 2000 The red brick walls of IBM s city sized fortress in Longmont reputedly conceal several ongoing Forth efforts Applied Energy in Ft Collins has periodically gone to great lengths to obtain qualified Forth assistance Charles Johansen is working on finishing and f
51. e al ways asked what they wish to talk about Whatis their personal point of wisdom they wish to share Without exception those who have accepted the invitation have also accepted the opportunity to share their personal point of view as opposed to some general subject Itis clear that we all benefit from this unselfishness I again wish to thank all these gracious people for sharing their insight as they have Now on to the recaps George Shaw December 1988 Owner of Shaw Laboratories lt George gt We myself and others started the ACM SIG to bring Forth into the professional computing arena ACM is very visible in the universities and colleges and is very well respected around the world We felt that having a SIG would give Forth a large boost in image as a language for serious use by professionals Thanks to Alan Furman for starting the whole thing and analyzing the situation to THE BEST OF GENIE give us direction and goals I have a list of our initial projects Education Moving Forth into the uni versities and colleges to create an aware ness of Forth and a better supply of Forth programmers Forthics Research to create a basic set of Forth programming ethics as well as management metrics to increase the suc cess of Forth projects Market A study of the job requirements and the Forth programming skills available to determine trends in the Forth job market place and skills required for the future
52. e scope can be limited by depth or address HS FORTH lacks a modular compilation environ ment One motivation toward modular compilation is that with conventional compilers recompiling an entire application to change one subroutine is unbearably slow HS FORTH compiles at 20 000 lines per minute faster than many languages link let alone compile The second motivation is linking to other languages HS FORTH links to foreign subroutines dynamically HS FORTH doesn t need the extra layer of files or the programs needed to manage them With HS FORTH you have source code and the executable file Period Development environments are cute and necessary for unnecessarily complicated languages Simplicity is so much better HS FORTH Programming Systems Lower levels include all functions not named at a higher level Some functions available separately Documentation amp Working Demo 3 books 1000 pages 6 Ibs 95 Student 145 Personal optimizer scaled amp quad integer 245 Professional 80x87 assembier turnkey 395 dynamic strings multitasker RSDL linker physical screens Production ROM Metacompiler Metawindows 495 Level upgrade price difference plus 25 OBJ modules 495 Rosetta Stone Dynamic Linker 95 Metawindows by Metagraphics includes RSDL 145 Hardware Floating Point amp Complex 95 Quad integer software floating point 45 Time slice and round robin multitaskers 75 Gig
53. ement other transformations such as LWCASE UPCASE and NUM gt NUM for case or number base conversion see Figure Six PROC WD sets everything up then executes the word whose code field address CFA is passed and re displays the screen from the original cursor position Note the use of DISPL TO EOL S in PROC WD toallow for actions that affect more than just the current screen line The word LOWER in LWCASE is similar to the F83 code word UPPER except it changes alphas to lower case Multi File Editing F83 maintains its block buffers by using a list of buffer headers that describe where in memory the block is etc The buffer header also contains a pointer to the FCB File Control Block for the file that con tains this block BLOCK the word to read a specified block passes to BLOCK the primitive that actually brings in the wanted block or locates it if already in a buffer the ad dress of the FCB to use from the pointer FILE HIRTY DAY FREE OFFER Free MMSFORTH GAMES DISK worth 39 95 with purchase of MMSFORTH stem CRYPTOQUOTE HELPER OTHELLO BREAK ORTH and others 17 Forth Dimensions That made it very easy to implement multi file capability Simply set FILE to point to a different FCB make sure the file is open OPEN F ILE and issue BLOCK GET FILE in screen 34 and Figure Seven does that Well almost that easy If the current block was changed UPD
54. es 2 words amp display stack PDE Abe the public d EXTRACT WD SET TIB Start addr of word in buff DE is in the public domain non com EXTRACT WD ADD TIB Addr of next word in buff mercial use and its source code is available EXEC WD copy word amp execute on the East Coast Forth Board see Refer O MV CURS Restore cursor in CRT screen ence Section Canada Remote Systems 416 231 0538 and other fine bulletin Figure Four Execute one or two on screen words boards That version of PDE ver 1 02 is specific to Laxen and Petry s F83 and to the p IBM PC PDE is virtually all high level POE S caddr T 2 is virtually all high leve EXTRACT WD SET TIB Get word pointed to in screen code and can be readily adapted to other W2AT EXEC WD Go do words systems SEE WD S PDE includes ideas and code from a SEE DO WD Execute SEE against TIB number of public domain sources and I SEE WD issues SEE against word pointed to give credit to those sources in the follow DEBUG WD s ing DEBUG DO WD Execute DEBUG against TIB EVIEW DO WD EVIEW NXT SCR FILE Figure Five Operate on word under cursor SDS FORTH for the 8051 Programming Environment D Use your IBM PC compatible as terminal and disk server O Trace debugger O Full screen editor Software Features D Supports Intel 805x 87C51FA N80C451 Siemens 80535 Dallas 5000 QO Forth 83 st
55. es in on 4 SHELVING Z FORTH_LANGUAGE amp FARTICULAF_ VERSION top of the stack If the flag is 0 it calls 5 amp FORTH 79_ LANGUAGE 3 Y N to get the answer from the user In 6 SHELVING Z FORTH LANGUAGE amp PARTICULAR_VERSION any case the word created by QUESTION 7 amp FORTH S3_LANGUAGE 8 SHELVING_04 FORTH LANGUAGE PARTICULAR_VERSION leaves a flag i e the answer when exe 9 amp MMS FORTH LANGUAGE cuted 10 GHELVING_OS FORTH_LANGUAGE amp FPARTICULAR_VERSION 11 amp FIG FORTH_LANGUAGE 12 GHELVING_06 BASIC_LANGUAGE 13 SHELVING_O7 C_LANGUAGE Resets the content of N amp when a rule is ton ore compiled Screen 8 SISIFOrth library manager continued amp 1 SHELVING_98 PASCAL_LANGUAGE 2 amp PARTICULAR_VERSION NOT Increments the content of N amp and Z3 SHELVING_09 PASCAL_LANGUAGE amp PARTICULAR_VERSION compiles an IF 4 amp TURBO FASCAL_LANGUAGE S SHELVING_10 PASCAL_LANGUAGE 0 amp amp UCSD PASCAL 7 SISIFORTH_LIBRARY SISIFORTH_OK Let s start The shadow word compiled at the start pres z s ETNEN Bii eV INEZ of It checks to see if the rule is true if z 20 H O i 2 OD 02 10 BLK 2 O3 SHELVING_OZ BLE 2 04 SHELVING O4 So it writes the answer and ends execu 11 BLK 2 OS SHELVING_OS BLK 2 06 SHELVING_06 tion of SISIFOrth 12 BLK 2 07 SHELVING_O7 BLK 2 08 SHELVING OS 13 B
56. f subtask execution The cooperative round robin multi tasker provides individual user stack segments as well as user tables Control passes to the next task user whenever desired APPLICATION CREATION TECHNIQUES HS FORTH assembles to any segment to create stand alone programs of any size The optimizer can use HS FORTH as a macro library or complex macros can be built as colon words Full forward and reverse labeled branches and calls complement structured flow control Complete syntax checking protects you Assembler programming has never been so easy The Metacompiler produces threaded systems froma few hundred bytes or Forth kernels from 2k bytes With it you can create any threading scheme or segmenta tion architecture to run on disk or ROM You can turnkey or seal HS FORTH for distribution with no royalties for turnkeyed systems Or convert for ROM in saved sealed or turnkeyed form HS FORTH includes three editors or you can quickly shell to your favorite program editor The resident full window editor lets you reuse former command lines and save to or restore from a file Itis both an indispensable development aid and a great user interface The macro editor provides reuseable functions cut paste file merge and extract session log and RECOMPILE Our full screen Forth editor edits file or sector mapped blocks Debug tools include memory stack dump memory map decompile single step trace and prompt options Trac
57. formance Quality Service SC FOX Forth Optimized eXpress SC FOX PCS Parallel Coprocessor System Uses Harris RTX 2000 real time Forth CPU System speeds options 8 or 10 MHz Full length 8 or 16 bit PC XT AT plug in board 32K to 1M bytes 0 wait state static RAM Hardware expansion two 50 pin strip headers Multiple PCS board parallel operation Data transfer thru moveable shared 16K window Includes FCompiler SC Forth optional Prices start at 1 995 with software SC FOX SBC Single Board Computer Uses RTX 2000 real time Forth CPU System speed options 8 10 or 12 MHz 32K to 512K bytes 0 wait state static RAM 64K bytes of shadow EPROM space RS232 serial and Centronic printer ports Hardware expansion two 50 pin strip headers Eurocard size 100mm by 160mm Includes FCompiler optional SC Forth EPROM Prices start at 995 with software SC FOX SCSI I O Daughter Board NEW Piug on daughter board for SC FOX PCS and SBC Source s w drivers for FCompiler and SC Forth SCSI adaptor with 5 Mbytes sec synchronous or 3 Mbytes sec asynchronous transfer rates Floppy disk adaptor up to 4 drives any type Full RS 232C Serial Port 50 to 56K Baud 16 bit bidirectional latching parallel port Price 695 with software SC Forth Language SC FOX Support Products Interactive Forth 83 Standard SC Forth Source Code 15 priority time sliced multitasking SC Float IEEE Floating Point Library Supports user def
58. g them should be automatically predetermined Only those methods owned by an object should be available for use and the use of any other methods should result in error messages I will stand by my description of stan dard Forth as having a two stack architec Continued on page 35 Forth Dimensions ie method for drawing ovals de scribed here was found in the course of a project I was working on that required drawing arrows on the screen An oval is technically a closed curve bounding a convex domain It applies to curves shaped like footballs ellipses or eggs Ovals have a certain aesthetic appeal that I find a relief from all the straight lines and rectangles we usually see on computer screens Figure One shows the underlying struc ture of the method An oval is taken to be generated by three radii R1 R2 and R3 The figure shows the classes of oval objects that can be generated by varying just these radii The key word in the source code is BARC BARC stands for biradial arc i e it draws an arc specified by two lengths R1 and R2 If Ri R2 the arc will be circular As R2 increases so does the curvature of the arc Closed curves bound ing convex domains We can define the OVAL function as follows OVAL R1 R2 R3 BARC R1 R2 BARC R1 R3 where the separate BARCS sweep out the northern and southern hemiovals Figure Two shows the typical egg shape defined by OVAL 40 90 50 In this
59. ge Shaw 415 276 5953 Orange County Chapter 4th Wed 7 p m Fullerton Savings Huntington Beach Noshir Jesung 714 842 3032 Sacramento Chapter 4th Wed 7 p m 1708 59th St Room A Tom Ghormley 916 444 7775 San Diego Chapter Thursdays 12 Noon Guy Kelly 619 454 1307 Silicon Valley Chapter Ath Sat 10 a m H P Cupertino Bob Barr 408 435 1616 Stockton Chapter Doug Dillon 209 931 2448 COLORADO Denver Chapter 1st Mon 7 p m Clifford King 303 693 3413 CONNECTICUT Central Connecticut Chapter Charles Krajewski 203 344 9996 Forth Dimensions 38 FLORIDA Orlando Chapter Every other Wed 8 p m Herman B Gibson 305 855 4790 Southeast Florida Chapter Coconut Grove Area John Forsberg 305 252 0108 Tampa Bay Chapter ist Wed 7 30 p m Terry McNay 813 725 1245 GEORGIA Atlanta Chapter 3rd Tues 6 30 p m Western Sizzlen Doraville Nick Hennenfent 404 393 3010 ILLINOIS Cache Forth Chapter Oak Park Clyde W Phillips Jr 312 386 3147 Central Illinois Chapter Champaign Robert Illyes 217 359 6039 INDIANA Fort Wayne Chapter 2nd Tues 7 p m I P Univ Campus B71 Neff Hall Blair MacDermid 219 749 2042 IOWA Central Iowa FIG Chapter Ist Tues 7 30 p m Iowa State Univ 214 Comp Sci Rodrick Eldridge 515 294 5659 Fairfield FIG Chapter 4th Day 8 15 p m Gurdy Leete 515 472 7077 MARYLAND MDFIG Michael Nemeth 301 26
60. hin Fu Liu 5F 10 Alley 5 Lane 107 Fu Hsin S Rd Sec 1 TaiPei Taiwan 10639 SWEDEN SweFIG Per Alm 46 8 929631 SWITZERLAND Swiss Chapter Max Hugelshofer Industrieberatung Ziberstrasse 6 8152 Opfikon 01 810 9289 SPECIAL GROUPS e NC4000 Users Group John Carpenter 1698 Villa St Mountain View CA 94041 415 960 1256 eves Forth Dimensions NEW PUBLICATIONS SILICON COMPOSERS SC FOX PCS Parallel Coprocessor System User Manual December 198 35 EACH NOW AVAILABLE FROM THE FORTH INTEREST GROUP Forth Interest Group P O Box 8231 San Jose CA 95155 Second Class Postage Paid at San Jose CA
61. il Baden comes to Colo rado around January of next year there will be an eager and attentive audience await ing his presentation Any other Forthers visiting Colorado are invited to address the chapter on their doings please give us some advance notice 36 Volume XI Number 2 Our chapter bulletin board the RCFB isnow on the ForthNet ForthNet messages bounce around the continent from local BBS to local BBS sometimes even coming back to reinsert themselves accidentally in the conversational threads of the board of origin The Forth community has never had such a communications resource at its fin gertips before What is needed now is some creative use of same Wouldn t it be nice if every chapter had a BBS on the ForthNet In such a situation no formal Speaker s Bureau would be nec essary There is already a FIG Conference that is exchanged on the ForthNet Cur rently we are discussing just what is a FIG Chapter You should log in just to see Brit ish Columbia FIG s electronic newsletter Forthers can post their travel dates in the ForthNet FIG Conference or in a separate Speaker s Conference We might actually get to meet one another Hibernating chap ters might have cause to dust off the gavel more often than quarterly But these are dreams one has only on rainy days Advertisers Index ByE tivnrimi iia erie Tae 12 Concept 4 0 0 ee 27 FORML r 13 Harvard Softworks 0e 7
62. implemented And code words become incredibly powerful with multiple entry points not requiring jumps over word fragments One of many reasons our system is much more compact than its immense dictionary 1600 words would imply INCREDIBLE FLEXIBILITY The Rosetta Stone Dynamic Linker opens the world of utility libraries Link to resident routines or link amp remove routines interactively HS FORTH preserves relocata bility of loaded libraries Link to BTRIEVE METAWIN DOWS HALO HOOPS ad infinitum Our call and data structure words provide easy linkage HS FORTH runs both 79 Standard and Forth 83 pro grams and has extensions covering vocabulary search order and the complete Forth 83 test suite itloads and runs all FIG Libraries the main difference being they oad and run faster and you can develop larger applica tions than with any other system We like source code in text files but support both file and sector mapped Forth block interfaces Both line and block file loading can be nested to any depth and includes automatic path search FUNCTIONALITY More important than how fast a system executes is whether it can do the job at all Can it work with your computer Can it work with your other tools Can it trans form your data into answers A language should be complete on the first two and minimize the unavoidable effort required for the last HS FORTH opens your computer like no other lan guage You can execute function
63. ined PAUSE SC PCS PROTO Prototype Board Automatic optimization and code support SC SBC PROTO Prototype Board Turnkey application support SC FOX SP Serial Parallel Board Extended structures and case statement XRUN Utilities and SC SBC Serial Cable Double number extensions Infix equation notation option Harris RTX 2000 Real Time Forth CPU Block or text file interpretation 1 cycle multiplier 14 prioritized interrupts Optional sorce code developers system one NMI two 256 word stacks 16 bit timer counters Prices start at 695 and an 8 channel multiplexed 16 bit I O bus Ideal for embedded real time control high speed data acquisition and reduction image or signal processing or computation intense applications For additional information please contact us at a Silicon Composers Inc 210 California Avenue Suite K Palo Alto CA 94306 415 322 8763 Volume XI Number 2 29 J Forth Dimensions The Forth assembler is handy for writ ing short pieces of code to access the hard ware or to speed up a loop but it can be cumbersome for large routines A full fledged macro assembler with all the bells and whistles is ideal for larger routines but it would be very messy to implement as a Forth vocabulary Fortunately this is not necessary It is possible to write a routine using a regular macro assembler then to incorporate the resultant binary file as a Forth word I will describe a way to do this for a P
64. ked on automating both software verification and code generation His current interests include simulation of complex systems cellular automata and genetic algorithms Letters continued from page 5 ture When someone adds another stack they enter the realm of extended rather than standard Forth even though the standard does not explicitly disallow extra stacks However I personally favor exten sions such as extra stacks particularly if I don t have to manipulate the extra stacks while they give me the features of an OOL While it may be better to implement the features of an OOF in assembly language be Volume XI Number 2 the Forth community is better served by first offering algorithms expressed in Forth so the explanations that accompany the code can be more readily understood Once care is taken to provide such information assembly language implementations might be appreciated I hope information about object ori ented languages piles up for Forth Dimen sions Aren t Forth programmers more likely to appreciate creative approaches to the problem of programming computers Before C takes off perhaps FORTH can step in Mike Elola San Jose California 35 Forth Dimensions It Rains Chapter Coordinator Muses H in the high altitude desert that is Colorado on the eastern side of the Rockies it is drizzling a drizzle that would do credit to th
65. l 9 Work Kaic Manual 25 MVP FORTH Software A trans portable FORTH MVP FORTH Programmer s Kit including disk documentation Volumes 1 2 amp 7 of MVP Series FORTH Applications and Starting FORTH IBM Apple Amiga CP M MS DOS POP 11 and others Specify 225 MVP FORTH Enhancement Package for IBM Programmer s Kit Includes full screen edi tor amp MS DOS file interface 110 MVP FORTH Floating Point and Math O IBM C Apple or O CP M 8 100 MVP LIBFORTH for IBM Four disks of enhancements 25 MVP FORTH Screen editor for IBM 15 MVP FORTH Graphics Extension for IBM or O Apple 100 MVP FORTH PADS Professional Application Development System An integrated system for customizing your FORTH programs and applications PADS is a true professional development system Specify Computer CBM O Apple 500 C MVP FORTH Floating Point Math 100 MVP FORTH Graphics Extension 100 MVP FORTH EXPERT 2 System for learning and developing knowledge based programs Specify C Apple O IBM or CP M 8 175 00000000 Order Numbers 800 321 4103 In California 415 961 4103 FREE CATALOG MOUNTAIN VIEW PRESS PO DRAWER X Mountain View CA 94040 6 VAR COLS 2 VAR ROWS O VAR HJUMP horizontal spacing 0 VAR VJUMP vertical spacing 20 VAR F1 stretch factor 30 VAR F2 stretch factor Code continued on page 37 TU A ES A Il E Volume XI Number 2 9
66. n however that the entire rest of the screen may change and need to be re displayed which makes this mode too slow for normal use Volume XI Number 2 Execution of Words on the Screen One of the powerful features of PDE is that it can take words off the screen move them to TIB the keyboard input buffer and then interpret them The idea for this originally came from Tom Blakeslee whose code I had adopted as is when I started factoring his code into smaller words it became really interesting STEP screen 45 was the original word see Figure Four The basic process is EXTRACT WD Get the memory address and length of the word character string where the cursor is at on the screen and skip past it SET TIB Copy that string to the TIB and set TIB accordingly EXEC WD Issue INTERPRET to handle the text string now in TIB showing the stack after wards Now by factoring EXEC WD into an EXEC WD that can execute words other than INTERPRET we can easily do some interesting stuff such as SEE a word VIEW F 1X or DEBUG a word see Figure Five Note that the approach taken is not to redirect SOURCE since any errors would hang the system see eLOAD below gl a eee ene nee ee po 2 oe eS a Se Similarly EXTRACT WD which re turns the memory address and length minus trailing blanks of the word text string under the cursor and moves the cursor to the next word makes it easy to impl
67. ncomplete and ailing Forth projects for the Forth Doctor to diagnose show off fancy new toys such as the MC68HC11 with New Micros Forth on board Members will indeed gather if they can sense some purpose in doing so In the case of the Forth class for instance some members purpose is to get consultation help for 2 50 an hour that they used to pay 30 an hour to obtain Isn t FIG for helping people not only with Forth in the abstract but also with Forth in their specific appli cation In any event this small weekly event has defied the mortality statistics of local chapter activity to run for about a year now with only two blizzards and one Florida vacation having interrupted its continuity They still talk about the time three years back when Charles Moore came to town to show off the Novix Forth chip One gets the sense that more than any thing our chapter awaits the founding of a FIG Speaker s Bureau that would track Forthers willing to address local groups and to publish their travel itineraries for the benefit of interested chapters Speakers at FIG meetings do not have to be celebrities a new face would be worth ten clever newsletters in terms of drawing a crowd at Denver FIG Fortu nately for the continued vitality of our chapter Gary Betts of the ANSI Forth Technical Committee X3J14 is in the area and has agreed to address us Charles Curley should be out for a visit sometime soon and when W
68. om FSED Search Capability The original Laxen editor used SCAN and SCAN for forward and backward scanning to find a character SCAN lt gt and SCAN lt gt to scan for the first occur rence of anything other than the character These were high level definitions and given their frequent use kind of slow F83 of course has a machine code SCAN and SKIP which are the same as SCAN and SCAN lt gt respectively though with some stack differences Screens six through eight implement a machine language version of SCAN and SKIP for both 8086 and 8080 assembler Also included in screens nine and 0A are USCAN and INSTRING Figure Two which together are a faster version of SEARCH Both INSTRING and SEARCH Volume XI Number 2 can do a case insensitive search where upper case and lower case characters are acceptable SEARCH uses COMPARE against every possible substring For instance if looking for a five character string within a 400h character block it would compare the search string against characters one through five of the block then against two through six then three through seven etc More than a thousand times INSTRING goes on the basis that we first look for the first character of the search string then see if the rest matches Since the machine language SCAN is so much faster than a high level loop we gain Of course if we re looking for a string starting with a blank in a screen that
69. on PUSH AX A r POP AX Get arguments from stack POP BX ADD AX BX Add them Put result on the stack library could greatly increase the produc tivity of Forth programmers Why spend time coding a quicksort routine in Forth for example when you could buy a canned assembly language version that had been optimized tested and debugged It is even conceivable that for some applications Forth could be used as glue to hold to gether packaged routines that did most of the work Put the segment and offset of the Forth re entry point on the stack PUSH RET_ADDR2 PUSH RET ADDR1 RET ADDUP ENDP ASEG ENDS END START L Jump to the re entry point Figure One An assembly routine can perform its task and return to Forth Volume X1 Number 2 31 Forth Dimensions GARY SMITH LITTLE ROCK ARKANSAS A promised in the last issue I will continue with recent on line conferences that featured George Shaw Mike Perry Randy Dumse and Wil Baden As before I will feature the guests opening remarks from their respective conferences These remarks set the tone and direction of the conference and they serve that purpose well hope most readers will note they also serve to acquaint the attendees of the con ference and now the readers of this col umn with the guests personal philoso phies This is no accident When I have ap proached a prospective guest I hav
70. op live video open file 12 disk gt image close copy file close it 13 14 15 Forth Dimensions 34 Volume XI Number 2 such as 00 3B for function key one Using this trivial definition makes it much easier to avoid such problems as the user pressing an extended key after Press any key QUIT in screen 33 in conjunction with the main editor loop E in 57 shows how to force an exit regardless how many levels of calling words return addresses on the return stack there are In the mainline word E we note the position of the return stack RP which we save in our variable amp RPO This notes the point on the return stack with the ad dress to which we ultimately want to exit Then when a word like ABANDON or EXIT SAVE wants to exit PDE it uses SQUIT to reset RP RPO RP and then returns to that higher level return address This approach is more general than a series of R gt DROPs particularly when you consider that ABANDON is nested four levels deep when invoked through Z but only three when Alt F1 is used Footnotes 1 Screen Oriented Editor in Forth by Henry Laxen Dr Dobb s Journal vol 6 no 9 pg 27 VED Craig Lindley and FSED Gene Czarcinski September 1986 Credit also to John A Peters and R F Buchanan F83 is a public domain implementation of Forth 83 by Henry Laxen and Michael Perry with many many fine added fea ture
71. orted Drawscan connects the points whose coordinates are stored on the stack thus filling the polygon Draw called by Area draws a line to the point X Y while Plot just moves to the point Call for Articles about Forth Hardware Forth Dimensions will publish an issue about Forth hardware in the coming months To encourage high quality article submissions we will be offering payment for the theme related articles we publish in that issue 1st 450 2nd 300 3rd 225 Your article is welcome For more see the Editorial in this issue Send article self addressed stamped envelope and optional Macintosh or IBM 5 25 diskette Editor Forth Interest Group P O Box 8231 San Jose California 95155 Volume XI Number 2 Il Forth Dimensions Listing One continued variable stack fill Cx y gt sp 4 stack begin yr xr xr yr dot xr right gt xr left gt xleft xr 1 yr scan xleft xr 2 yr scan sp stack until Listing Two points C yn xn yl xl n Forth Dimensions variable pts create 0 do loop does re adr n x n 24 24 0 Ly C adr n y En 24 2 2 line adr n swap dup dup 0 x swap 0 y plot swap 1 do dup dup i x swap i y draw loop drop variable vert sort C xn xl xi xn xi x1 xmin begin sp stack lt gt while 2dup lt if swap
72. ould be saved in variables and restored before the final RET instruc tion Define the routine asa FAR procedure so that the final RET instruction will be assembled as an intersegment return Figure One is a trivial example that takes two numbers from the stack adds them and places the result on the stack before returning to Forth Assemble the source code and LINK as usual use the EXE2BIN utility to convert to binary for mat then rename the file if you like Its Forth name will be the same as its filename BINF ILE in screen four is the defining word The syntax is BINFILE lt name gt where lt name gt is the name of the binary file on disk On line two we save the value of the input stream pointer on the stack On line three we read the next word from the input stream which is lt name gt Line four moves lt name gt to a variable Line five restores the original value of the input stream pointer so that CREATE can read lt name gt also Line six creates a dictionary header for lt name gt The binary routine must start on the first paragraph boundary within the parameter field A paragraph boundary is any address evenly divisible by 16 On line seven we calculate the number of paragraphs from the beginning of the Forth segment to the parameter field Line eight adds the value in the CS register to this number and places the result in the variable BINSEG On line nine READBIN reads the file whose name isin NAME
73. oun drying an inexpensive Forth chip while Cliff King president of Denver FIG is in Forth Dimensions JACK WOERR JAX ON GEnie the process of releasing the first revision of his 32 bit AT amp T DSP chip Forth develop ment system The local chapters of the Forth Interest Group have been only partially successful in tying together the disparate practitioners of Forth ina functioning fraternity Boulder Forth Interest Group seems to have disap peared its members swallowed but not digested by Denver FIG The latter organi zation meets sporadically usually when a speaker is in town Since the meeting place moved to Golden between Denver and Boulder we have been more successful in trapping members of both communities at meetings This small event de fies the mortality statis tics Our most successful recent meeting was at the National Institute of Standards and Technology at the Commerce Department facility in Boulder We gathered from all over the state to see Dr Jeffrey Fox demon strate software he wrote in Forth on various architectures to demonstrate chaotic sys tems and the Monte Carlo method Subsequent to that meeting we had another well attended meeting in which we agreed to really get Denver FIG going again There hasn t been a formal Denver FIG meeting since Are we unusual Our Forth 83 class still meets once a week Three to seven people attend to learn gripe bring i
74. ound within a rule used to compile the correct number of ENDIFs at the end of the rule NQ Counter of how many questions were created by QUESTION TITLE 2DROF ENDIF dy COMFILE N amp a amp no DUF C If k no 0 amp no C If amp nozo C amp no amp na IF 0 amp no 0 DO CCOMFILE ENDIF LOOF ENDIF IMMEDIATE BLE t screen 32 WORD address NUMBER number DROF number BLOCE screen BLOCE adds current screen number to the number an TOS STATE screen IF screen BLE is being used inside a definition CCOMPILE LITERAL ENDIF IMMEDIATE compiling Screen 2 SISIFOrth Questions BLE 1 5 QUESTION MONEY BLE 1 QUESTION PASSENGERS BLE 1 7 QUESTION BAGGAGE BLE 1 8 QUESTION SFEED BLE 1 9 QUESTION SFORT Rules vehicles expert NOGU SH S 8 SUBWAY 9 CAR lt 10 s MCYCLE ito CS 12 13 14 15 MONEY NOT 3 FASSENGERS BAGGAGE OR SPEED gt 3 iE SFORT NOT 3 BIKE SPORT 3 Screen 7 0 SISIFQrth vehicles expert continued SISIFORTH VEHICLES SISIFORTH_OK Vehicles Expert System CR BLK CAR BLE O 13 MCYCLE BLE 14 CS BLK O 15 BIKE Texts of questions Have you got money enough Are you carring passengers Are you carring baggage Do you like speed Do you like sport i Texts of answers 11 Go to the subway silly 12 Buy a ca
75. overlooking the Pacific Ocean Pacific Grove California U S A Theme Forth and Object Oriented Programming Data structures to support object oriented program development are readily constructed in Forth This is possible because Forth is an extensible language that has unique properties for building data structures These structures may be reused which increases productivity when new applications are developed Papers are invited that address relevant issues in the development of object oriented programming and object oriented applications Papers about other Forth topics are also welcome Mail abstract s of approximately 100 words by September 1 1989 to FORML P O Box 8231 San Jose CA 95155 Completed papers are due November 1 1989 For registration information telephone the Forth Interest Group business office at 408 277 0668 or write to FORML P O Box 8231 San Jose CA 95155 Asilomar is a wonderful place for a conference It combines comfortable meeting and living accommodations with secluded forests on a Pacific Ocean beach Registration includes deluxe rooms all meals and nightly wine and cheese parties Volume XI Number 2 13 Forth Dimensions Te article is about PDE a program editor for Forth F83 flavour Yet another editor Yes but with a few differences The PDE Program Development Envi ronment editor is a derivative of the Henry Laxen WS like screen editor and provides many ad
76. passed as well Even non optimized programs run as fast as ones produced by most C compilers Forth systems designed to fool benchmarks are slightly faster on nearly empty do loops but bog down when the colon nesting level ap proaches anything useful and have much greater memory overhead for each definition Our optimizer gives assembler language performance even for deeply nested definitions containing complex data and control structures HS FORTH provides the best architecture so good that another major vendor cloned rather poorly many of its features Our Forth uses all available memory for both programs and data with almost no execution time penalty and very little memory overhead None at all for programs smaller than 200kB And you can resize seg ments anytime without a system regen With the GigaForth option your programs transparently enter native mode and expand into 16 Meg extended memory or agigabyte of virtual and run almost as fast as in real mode Benefits beyond speed and program size include word redefinition at any time and vocabulary structures that can be changed at will for instance from simple to hashed or from 79 Standard to Forth 83 You can be head word names and reclaim space at any time This includes automatic removal of a colon definition s local variables Colon definitions can execute inside machine code primitives great for interrupt amp exception handlers Multi cfa words are easily
77. program to make expert systems but a TASE it wi i m m toolkit with which to make them Once 128 CONSTANT QUESTIONS array lenght SISIFOrth has been loaded we can make VARIABLE ANSWERS QUESTIONS ALLOT array use of a set of new words to define the rules VARIABLE Ng questions and answers I will try to explain VaR Tne ee ia d TITLE CR SISIFOrth environment V2 00 CPU w Before writing an expert system of SISIFORTH_OK it Wh ANSWERS QUESTIONS ERASE erases array course w have to design it en that is CLS TITLE CR By Marcos Cruz 1988 SFAIN CR done we can build it using SISDFOrth There are three steps on the way define the yN flag questions the rules and at last the order of Boca the rules and the answers they lead to KEY ascii DUF DUF ascii ascii ascii 82 ascii ascii ascii B827 gt SWAF ascii ascii ascii We can think of SI 78 ascii ascii 78 DR ascii ascii B2 OR ascii 787 SIFOrth rules as NOT C ascii agcii lt gt Z AND asciis 78 P l 93 WHILE t ascii rolog sentences DROF REPEAT C Y or N typed S DUF Each question of the expert system is IF stored in any line of any screen To define ne nT a questions the word QUEST ION has to be L SNo used in this way ENDIF ABS converts flag 7 1 to 07 19 CR sn ln QUESTION q_name If Y has been typed flag 1 If N has been typed flag 0
78. r sure 13 Buy a speedy motorcycle then 14 Well buy a electric Sinclair C5 tricicle 15 Better buy a bike my friend GANCU SUE 11 SUBWAY BLK O 12 3 3S Volume XI Number 2 25 Forth Dimensions Prints titles Screen 6 ISIFORTH_OK O SISIFOrth library manager S a ae d the displ 1 BLE 3 01 QUESTION COMPUTER_LANGUAGES ears ANSWERS and the display to 2 BLE Z 02 QUESTION FORTH_LANGUAGE start execution of rules BLK 3 07 QUESTION FORTH 79_LANGUAGE 4 BLK 3 08 QUESTION FORTH 82_LANGUAGE 5 BLE 3 09 QUESTION MMS FORTH_LANGUAGE Y N flag 6 BLK 3 10 QUESTION FIG FORTH_ LANGUAGE Waits fora Y or N tobe typed and 7 BLk 3 O03 QUESTION FASCAL_LANGUAGE leaves a flag 8 BLE 3 12 QUESTION UCSD FASCAL_LANGUAGE 9 BLK 3 11 QUESTION TURRO PASCAL_LANGUAGE 10 BLE 3 04 QUESTION BASIC_LANGUAGE QUESTION sn ln 11 BLE 3 OS QUESTION C_LANGUAGE 12 BLE 3 06 QUESTION FARTICULAR_VERSION A word to create other words Stores ae z s and 1n at the PFA of the new word with 14 the content of NQ and increments the 15 content of NQ When the new word is Screen 7 executed it checks its flag in ANSWERS SISIFOrth library manager continued and if it is 1 or 2 which would mean the 1 NO_SHELVING COMPUTER_LANGUAGES NOT I 2 SHELVING_OL FORTH LANGUAGE question has already oven answered by z amp FARTICULAR_VERSION NOT the user decrements it and leav
79. rc NEST OF EGGS WIPE ORIGIN CR Equatorial radius is increasing 90 IS R3 fixed R3 30 IS STP 300 50 DO I IS R1 new R1 50 150 DO I IS R2 new R2 OVAL draw the oval STP 1 LOOP STP LOOP ONE EGG draw an egg to specifications ORIGIN CR Use whole numbers between 10 and 200 Typical egg is 50 100 75 CR Enter radius at equator IN IS R1 CR Enter height of NORTH pole IN IS R2 CR Enter height of SOUTH pole IN IS R3 WIPE OVAL FORTH SOURCE WISC CPU 16 The stack oriented Writeable Instruction Set Computer WISC is a new way of harmonizing the hardware and the application program with the opcade s semantic content Vastly improved throughput is the result Assembled and tested WISC for IBM PC AT XT 1500 Wirewrap Kit WISC for IBM PC AT XT 500 WISC CPU 16 manual 50 MVP FORTH Stable Transportable Public Domain Tools You need two primary features in a software devel opment package a Stable operating system and the ability to move programs easily and quickly to a variety of computers MVP FORTH gives you both these features and many extras MVP Books A Series C Vol 1 Ali about FORTH Glossary 28 Vol 2 MVP FORTH Source Code 25 Vol 3 Floating Point and Math 35 Vol 4 Expert System 22 Vol 5 File Management System 30 Vol 6 Expert Tutorial 22 Vol 7 FORTH GUIDE 25 Vol 8 MVP FORTH PADS 55 Vo
80. rt L Smith Founding Directors William Ragsdale Kim Harris Dave Boulton Dave Kilbridge John James In Recognition Recognition is offered annually to a person who has made an outstanding con tribution in support of Forth and the Forth Interest Group The individual is nomi nated and selected by previous recipients of the FIGGY Each receives an engraved award and is named on a plaque in the ad ministrative offices 1979 William Ragsdale 1980 Kim Harris 1981 Dave Kilbridge 1982 Roy Martens 1983 John D Hall 1984 Robert Reiling 1985 Thea Martin 1986 C H Ting 1987 Marlin Ouverson 1988 Dennis Ruffer On Line Resources To communicate with these systems set your modem and communication software to 300 1200 2400 baud with eight bits no parity and one stop bit unless noted other wise GEnie requires local echo GEnie For information call 800 638 9636 Forth RoundTable ForthNet link Call GEnie local node then type M710 or FORTH SysOps Dennis Ruffer D RUFFER Scott Squires S W SQUIRES Leona Morgenstern NMORGENSTERN Gary Smith GARY S MACH RoundTable Type M450 or MACH2 Palo Alto Shipping Company SysOp Waymen Askey D MILEY BIX ByteNet For information call 800 227 2983 Forth Conference Access BIX via TymeNet then type j forth Type FORTH at the prompt SysOp Phil Wasson PWASSON Volume XI Number 2 33 LMI Conference Type LMI at the prompt Labora
81. rtion of the block Miscellaneous A few other techniques are of note eKEY in screen four handles the PC s peculiarity of returning certain keystrokes as two characters the extended keys Continued on page 35 Volume XI Number 2 Forth 83 ACCESSING 80286 EXTENDED MEMORY RICHARD F OLIVO NORTHAMPTON MASSACHUSETTS Ama the 80286 processor is capable of addressing up to 16 Mb of memory in its protected mode MS DOS for reasons of downward compatibility was written for the processor s real mode That mode has an absolute limit of 1 Mb of address space which is further lim ited by a PC architecture that reserves the upper 384 Kb for special purposes As a result MS DOS programs have access to a maximum of 640 Kb of address space Even though one can plug so called ex tended memory cards with addresses above 1 Mb into a PC AT a program under MS DOS cannot directly read from or write to such memory This is of course not a good thing The ROM BIOS in a PC AT does however provide a way out A service at interrupt 15 hex function 87 moves blocks of data between extended memory and DOS accessible memory Prior to call ing this function a Global Descriptor Table GDT that lists the source and destination addresses must be set up in memory and the table s own address must be placed in the 80286 s registers I describe here some Forth words that use interrupt 15 to access
82. s F83 is available on disks from SIGM 154 or better yet from Laxen and Perry s No Visible Support Software for 25 Go ahead make their day Fast SEARCH for F83 by Bill Zimmerly Forth Dimensions VIIV 4 pg 5 Also IX 2 4 and X 1 Ed Debugging from a Full Screen Editor by Tom Blakeslee Forth Dimensions V 2 pg 30 N U p gt nm Frans van Duinen is regional man ager of Micro expertise Inc a cus tom software house that specializes in networked database systems A slightly more recent version of the code may be downloaded from GEnie and from Canada Remote System 416 629 0136 as PDE202 ARC Eggs continued from page 6 where D R1 lt x lt D R1 The equivalent unoptimized BASICA program for the explicit oval function might be written as shown in Figure Five If you try both approaches you will find the latter explicit method unsatisfactory for drawing ovals without some modifications for angles close to the horizontal axis The OVALS HSF demo can be downloaded from the GEnie Forth RoundTable and from the East Coast Forth Board see Ref erence Section Ed Robert Garian is a technical information and language specialist at the Library of Congress specializing in Soviet computing He has written an Al program called Block Solver that rearranges one multistack configuration of blocks into a specified goal configuration under constraints and he has wor
83. s 75 percent blanks we don t gain all that much For an even faster SEARCH look at the machine language version published in Forth Dimensions That version is case sensitive however It also returns the abso lute memory address where the substring was found rather than the offset in the block as returned by the F83 SEARCH INSTRING returns the length not searched i e the offset relative to the end of the block Hence the different name it is not identical to SEARCH INSTRING is used by the multi screen search capability AQF in good WordStar fashion the heart of which are QF 1 and QF in screen 41 Not implemented is a search and replace function QA even though the primitives exist INS STR and REPL in screen 26 see Figure Three INS STR uses CHAR TO EOL B to determine the number of characters to the end of the line or block When you insert a String the text to the right of the insertion point has to be moved over with truncation occurring at the end Similar to deletion padding occurs at the end PDE will sup port truncation padding at either the end of the line or at the end of the block or any number in between see amp PAGEL LINE MODE and BLOCK MODE in screen 12 The Laxen editor supported only end of line truncation Thus if text was bumped past the end of the line it was lost By supporting end of block truncation anything bumped off one line gets carried over to the next Itdoes mea
84. sions may not really be interested in this topic While that possibility remains at least I have found one voice willing to speak up in support of OOF Volume XI Number 2 LETTERS I am overjoyed to hear Forth program mers support object oriented Forth pro gramming By taking the role of devil s advocate and criticizing OOF I hoped to motivate readers to develop better object oriented Forths than have been offered so far in the Forth journals At least some of my whines were considered legitimate such as the mixing of postfix and prefix notation while manipulating data It s a bad design By the way Rick Hoselton managed to get the syntax correct on the first try See Object Oriented Forth in Forth Dimensions X 2 Clear progress is being made to over come all the obstacles to OOF Still it s hard to express an educated opinion regard ing OOF without more published works to draw upon If I had access to as yet unpub lished works I might only have positive things left to say about object oriented Forth OOF As further explanation of my point of view realize that the guidance offered in my series of articles FD X 2 S was the design of data structures not how to best produce obj ct oriented Forth However to the extent that I observed how well the object oriented programming model re sulted in more portable and reusable de signs I felt compelled to acknowledge OOP and to encourage its
85. start again and so on again and again forever Do you understand Marcos Cruz joined the Forth Interest Group last year and reports that the few Forth users he knows in Spain mostly use 68000 based computers such as the Sinclair QL Commodore Amiga and Atari ST SISIFOrth was originally written for a Sinclair ZX Spectrum with a fig FORTH from Melbourne House that was improved upon and translated for a Sinclair QL running a Forth 83 from Computer One The author wel comes mailed suggestions or improve ments at Acacias 44 28023 Madrid Spain Screens continued from page 22 e O COPY VIDEO LINE FROM IMAGE TO FORTH DICTIONARY SPACE I 2 CURRENT VLINE Y val Calc address in image 3 For active image calc 32 bit address of video line Y 4 and save the address in double variable 5 pixels line uss d unsigned mult w 32 bit prod Y px l 6 current buffer d added to start addr line address 7 current vline 2 stored as daddr in variable 8 9 VLINE gt DICT Y val Copy one line Y down 10 current vline current vline 2 source daddr to stack 11 vidline dadr pixels line make GDT dest amp bytes gt GDT 12 GDT dseg pixels line 2 gdt addr amp segment words 13 int15 dup not if drop call int15 test status 14 else Error quit then if error print code 15 gt SCR 7 O STORE amp FETCH SINGLE PIXELS AT X Y FILL IMAGE WITH 1 VALUE 1 2
86. support symbolic debugger native code compilers and graphics support For Applications Forth 83 Metacompiler e Unique table driven muiti pass Forth compiler e Compiles compact ROMable or disk based applications e Excellent error handling Produces headerless code compiles from intermediate states and performs conditional compilation e Cross compiles to 8080 Z 80 8086 68000 6502 8051 8096 1802 and 6303 No license fee or royalty for compiled applications For Speed CForth Application Compiler e Translates high level Forth into in line optimized machine code e Can generate ROMable code Support Services for registered users Technical Assistance Hotline e Periodic newsletters and low cost updates e Bulletin Board System Call or write for detailed product information and prices Consulting and Educational Services available by special arrangement a f Laboratory Microsystems Incorporated figs Office Box 10430 Marina del Rey CA 90295 Phone credit card orders to 213 306 7412 Overseas Distributors Germany Forth Systeme Angelika Flesch Titisee Neustadt 7651 1665 UK System Science Ltd London 01 248 0962 France Micro Sigma S A R L Paris 1 42 65 95 16 Japan Southern Pacific Ltd Yokohama 045 314 9514 Australia Wave onic Associates Wilson W A 09 451 2946 20 Volume XI Number 2
87. tions on data that is held in the same memory segment as the Forth dictionary rather than to use the more cumbersome and time consuming procedures that ma nipulate data held in other segments Con sequently the application examples de scribed below all work with single video lines The most generic of my Forth words are shown on screens 1 and 2 GDT is a48 byte array that will hold the Global Descriptor Table MAKE GDT sets up the descriptor table based on 32 bit double addresses for 19 the source and destination and a 16 bit count of the number of bytes to be moved The table actually requires 24 bit ad dresses but for convenience 32 bit opera tors are used and the highest order byte is later overwritten The addresses are cal culated by subsequent words in the list ings The code word INT15 written in as sembly language calls the BIOS interrupt to move the data INT15 requires 16 bit addresses for the start of the descriptor table and the table s segment and for the number of words not bytes to be moved in Uniforth s 8086 assembler unlike Intel s assembler the syntax of instruc tions like AX SI MOV follows the Forth practice of first giving the source then the destination then the action Both MAKE GDT and INT15 are general purpose words that can be used to move any batch of data in any direction The use of these words is illustrated in excerpts from an imaging application on screens three
88. tor Fm usually in favor of paying authors so I passed the idea to FIG for consideration along with some other items We didn tend up with a fixed policy but we will try itand let the results do the talking Therefore we are happy to offer pay ments of 450 300 and 225 respec tively to the three authors whose articles are chosen as best suited for the upcoming theme issue about Forth Hardware The issue is currently scheduled for FD XI 6 We need your theme related submission by November 1 1989 to be included in this offer I will work closely with our technical reviewers to choose articles that merit payment and publication in the theme is sue and those decisions will be final If an article of high quality and interest is not among the three selected Forth Dimen sions may ask to publish it later under our standard terms payment in the form of peer recognition technical feedback and a couple of free copies Along with of course the satisfaction that comes from making a contribution to our growing body of common knowledge Now is the time to jot down your article idea and maybe a brief outline from which to work Deadlines lurch up unexpectedly fast especially when you want to track down the last idea you had while polishing Forth Dimensions that final draft and it s time to prettify the code for publication I look forward to hearing from you If you haven t rushed out
89. tory Microsystems products Host Ray Duncan RDUNCAN CompuServe For information call 800 848 8990 Creative Solutions Conference Type Go FORTH SysOps Don Colburn Zach Zachar iah Ward McFarland Jon Bryan Greg Guerin John Baxter John Jeppson e Computer Language Magazine Con ference Type Go CLM SysOps Jim Kyle Jeff Brenton Chip Rabinowitz Regina Starr Ridley Unix BBS s with Forth conferences ForthNet links WELL Forth conference Access WELL via CompuserveNet or 415 332 6106 Fairwitness Jack Woehr jax Wetware Forth conference 415 753 5265 Fairwitness Gary Smith gars PC Board BBS s devoted to Forth ForthNet links East Coast Forth Board 703 442 8695 SysOp Jerry Schifrin British Columbia Forth Board 604 434 5886 SysOp Jack Brown Real Time Control Forth Board 303 278 0364 SysOp Jack Woehr Forth Dimensions Other Forth specific BBS s Laboratory Microsystems Inc 213 306 3530 SysOp Ron Braithwaite This list was accurate as of March 1989 If you know another on line Forth resource please let me know so it can be included in this list I can be reached in the following ways Gary Smith P O Drawer 7680 Little Rock Arkansas 72217 Telephone 501 227 7817 Fax 501 228 0271 Telex 6501165247 store and forward GEnie co SysOp Forth RoundTable GARY S BIX Bytenet GARYS Delphi GARY_S MCIMAIL 116 5247 CompuServe 71066
90. ure alone makes it worthwhile on line documentation for your entire Forth envi ronment Load from the Editor Occasionally you want to LOAD only part of a screen such as when you re cor recting the second or third definition on a screen PDE has the ability to mark the beginning and end of a section of a block AF6 4F8 and then issue the eLOAD com mand see Figure Nine eLOAD works by settirig the SOURCE that F83 uses for LOAD as well as for INTERPRET eSOURCE is similar to the regular SOURCE in thatitcanaccept input from TIB as well While eLOAD never uses input from that source it sets BLK it is very important If there were an error in the sub block being loaded F83 would ABORT QUIT and reset for keyboard input It would not reset SOURCE however but would look to eSOURCE for input If eSOURCE did not allow for keyboard input you d have F83 waiting for keyboard input with out ever seeing any eSOURCE uses GET SUB BLK and GET CUR ADDR Figure Ten to re turn the address and length of the marked section where 2 TAG and 3 TAG define the screen number FCB and cursor for the start and end of the section Note how GET SUB BLK and GET CUR ADDR return an address in two compo nents start of block address and offset of start of sub block within that block That drastically simplified the implementation of eSOURCE since it allows us to use gt IN to tell F83 we ve already processed that po
Download Pdf Manuals
Related Search
Related Contents
集集大地震における猫羅渓橋の被害要因の推定 PAG-MAI 2012 Instruction Manual ........................................... 3 Manuel d'instructions Keller-Didier-Boules-d-acier-vulneraires OPEN SYSTEMS® Accounting Software Fixed Assets User`s Manual V7 Coax Connection Cable White 5m La Lettre hebdomadaire des TIC La Lettre A Prenatal and Newborn Resource Guide for Oregon Copyright © All rights reserved.
Failed to retrieve file