NNNNNN6p NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNONNNNNNNNNNNNNNNNNNNNNNO  @`!O%`)+-/1 3@o9;=?A C@E`GIKMQS@U`W[]/c@e`gikmq s@u`wy{} @` @ ` @ ` @ ` @ ` ɠ @ ` ׀  @` @`!Aa   !Aa!!#A%a'+/1!3A5a79;?A!CAEaIKMOQSAUaWYO  @`!O%`)+-/1 3@o9;=?A C@E`GIKMQS@U`W[]/c@e`gikmq s@u`wy{} @` @ ` @ ` @ ` @ ` ɠ @ ` ׀  @` @`!Aa   !Aa!!#A%a'+/1!3A5a79;?A!CAEaIKMOQSAUaWYGFATIP01 t GFATIP02 t GFATIP03 t GFATIP04 t "GFATIP05 t 7GFATIP06 t oGFATIP07 t HORSEMED +t DIR BASDt ;GFAGRAF DOCHt EAD ME St (IME INFVt ) TINY_GFABASXt * CAD3DGFA t -DIAMOND t =.  t..  tGFATIP01DOCt  GFA TIP01: By John B. Holder Senior Software Engineer Marathon Computer Press This short file will show you the two ways to tell if the printer connected to your system is ready to receive data or not. The first method, { The way discussed in the GFA Basic Manual} uses the OUT? command, and the second way utilizes the low level GEMDOS c_prnos System call. So without further ado let's take a look at the two methods and what they do for you. Using the OUT? Command: By using the following code snip you can determine if your printer is hooked up and ready to receive data. Out 0,0 If Out?(0) Ok=1 Else Ok=-1 Endif If Ok=-1 Alert 1," Printer is not on! ",1," OK ",reply% Else Alert 1," Everything's O.K. ",1," OK ",reply% Endif end Positive points: This method will work not only with the printer port, but also with the AUX (1) port and the MID (3) port. To check those ports just use Out?(1) or Out?(3). Bad Point: If the printer is not connected, you will have to wait for 30 seconds for the control of the console to be returned to the application. It is for this reason that this method may not be the one of choice for most applications. The c_prnos Substitute call: Try this procedure out: Procedure C_prnos Status%=Gemdos(&H11) Return If your printer is connected to the system and ready to receive data, the value assigned to the Status% variable will be a negative 1 (-1). If the printer isn't ready, you'll find a zero (0) in the variable upon return. Positive Point: This call only takes an instant to register an answer, instead of the 30 seconds recorded above if there is a problem. Weak Point: This call will function with only the printer port, and not MID port. I hope this small doc file has helped some of you. I will try to address questions in this manner in Future GFATIPxx.DOC files. Please U/L your own tip files to the MichTron Libraries if so desired. I ask that you use some other naming convention besides the GFATIPxx.DOC one though so there will not be any confusion. .  t..  tDRV_MAP BASt xGFATIP02DOCt pGfABASIC ,XNUMTEMPNUM DRIVE_MAPMFpFpFp qEG6 HF qd?@6 @ 1F$Drive "B7A  " Is OnlineF  qFv(Drive "B7A  " Not Connected!F F  qF"+FpE  F Ep F.FE? q May 25 1987 GFATIP02.DOC Constructing a System Drive Map By John B. Holder Senior Software Engineer, Marathon Computer Press This is the second in a planned series of tips on how to get the most out of your GFA Basic Interpreter/Compiler. The topic is Mapping your System. What this means in plain english is: "Determining how many logical drives are connected to the system". Why do we need to know that you may ask? Unless you will never write programs for anyone besides yourself, this will be a good technique to learn for reasons described below. What will this do? Well, it will give you a binary presentation of your system's drive status. Imagine each drive hooked up to the system as a single digit. By this I mean that if you have 3 drives attached to the machine the drive map will be represented by the symbols 111. If there were 10 drives connected to the system the drive map would be 1111111111. Starting to make sense? Now it gets a little complicated. So you say, Wow! that's great; all we have to do now is call the Drive_map procedure and get Len(Num$) to find out which drives are attached. Not completely true. If the user has 4 drives attached and they are in the sequence of A B C D then you could do that. But the first problem comes into play when you consider that the BIOS always returns a value of 11 for drives attached. That's so you can make those handy dandy full disk backups by dragging Icon A to Icon B and sit back while it copies all of the files for you. So if it always returns a signal that says that Drive B is connected whether or not it really is, how do you get around it? Well, the answer is you don't. The operating system handles this condition by telling the user to insert disk B into Drive A and vice versa to get around it. So not all's bad with this condition. Ok, so we can now accept the fact that we'll always get a return of at least 11 no matter what. Now how do we tell if another drive is missing or out of order? At this point we must go back to the above analogy of 1 digit per drive. Take the following configuration: A B C D _ F The underscore is represented above to show that the user has somehow managed to install a Ram Drive or something in Drive F's slot, thus bypassing drive E. Now if you call the Drive_map procedure and use: Print Len(Num$) You'll see a 6 appear on the screen, but we know right off that it's not right {because we cheated and saw which drives were connected, after all we own the machine right?}. But if you use: Print Num$ You will now see the system as it really exists. The following will appear on the screen 101111 Pretty handy if you don't want your latest and greatest program to hopelessly crash because Joe BetaTester had a Ram Drive out of Normal Sequence. Now getting an actual picture of the system is as simple as: @Drive_map ! Gosub Drive_map For X =0 To Len(Num$)-1 step 1 If Mid$(Num$,Len(Num$)-X,1)="1" Print "Drive ";Chr$(Asc("A")+X);" Is Online" Else Print "Drive ";Chr$(Asc("A")+X);" Not Connected!" Endif Next X I hope this little routine and explanation of how it works will assist you in getting the most out of your investment in a wonderful Interpreter and Compiler. Comments are welcome, good or bad. I've included the sample source code in a Basic .BAS file in the archive for you to run as is. Have fun! John B. Holder GRIFJOHN Here's the actual procedure and some commented source code: ' Drive_map Returns two values for you; they are: ' Num% = a bit vector containing active drives ' Num$ = a binary representation of connected drives ' If you had drives A,B,C connected num%=7 and num$=111 ' In this way you can count up the active drives from A-P by ' looking at the resulting bit vector representation. ' If drives are not in order there may be zeros in between ' numbers. Example: You have drive A & B, plus a Ram Drive M ' M__________BA ' drive map = 1000000000011 ' ' Or the more classical situation: ' CBA ' drive map = 111 ' ' ' Example: @Drive_map Print Num% Print Num$ ' ' Procedure Drive_map Num%=Bios(10) Num$=Bin$(Num%) Return .  t ..  tERRREC01BASt ERRREC01PRGt #ERRREC02BASt ERRREC02PRGt LGFATIP03DOCt 4GfABASIC&&&&"""((((,,,,WHAT_WENT_WRONGAOUTSTRINGER_TRAPBError Demo - Vers 1.0 by John B. Holder ---- GFATIP03.BAS. 1.0 i.Notes on using the Compiler with this demo: 0Do not use the imbedded commands Option + xxx 4manually select the options from the Dialog Box. e a$Select the Errors Text+ on option Select the Trapv+ option eSelect the Bombs option &Select the Query Stop "Ever" option  rL This will increase the size of the finished program, but it duplicates e<the FULL error trapping capabilities of the interpreter.  h hvLFjF r.This would be the main body of the program.   ,Let's induce a File Not Found Error # -33 < That is if you don't have a file named JUVJVJ.DAT t6 If you do....Name it something else!  @7I!M! JUVJVJ.DATF just a garbage name to induce the error    !F FTNSee ... We just recovered from an error trapping routine with the InterpreterF0+or the Compiler as this demo clearly shows.FFIJDNow that we know we have a disk error we can take appropriate actionFF4Yp!8 "Press any key to continue....F<Since we've seen what we came to do, let's go home to GEM Ea F !F>We continue on our merry way with the body of the program. o  FqF i i"The ever ready error subroutine +FF8F|EFF)!)An Error Has Occurred! | The number is = A  |!! OK !F h4Have to turn it back on in order to use it again!  avLF aF aFO.K. Let's get back to the routine that caused all of the problems.  ..F!`#4*QT` Efv*oM m HPHUBg?<JNA(m)m -*:gS)@ -OK1PC#HN:Hx?<HNA@)@l/?<HNA)@h&@)@XЬl)@d)@`ARCpr Ѝ"QHN(ALNHz2?< NA\pdAxr0XQ)K\NN JrBjNuHz?<&NN\NCAp$L Qp N9lrBlJpNNpMN9@pdAr 0Q0tr N9lNupealp`NuaN,Hz?<&NNBWNANC2A@p222NrҌ0<NB0,rNurA9Ar`v C9Cr`rt9@9A9BNrrҌpsNB0,Nu9@N`rDҌpsNBNuC2 @ e @}bA@p222Nr,Ҍ0<NBNu pa2|a>:><|a4g RGj`a(0GVfA1G<ap??<?<NM\Nu??< NMXNuHn& 2$4BBNuAd RdQRB BbABJk 0NuJBjBBXNu 0Nu 2$NuE`B<gJEgEjCDEDF Fe( F dF8BCHC` F0bFHC8v` HD8HDkDуdQRBNuDdBDA@kgAр[SBk0NuJlJBk&Nu0g H@rB JkЀ[` BbNuJBj prtNuHPAJgPpr$< _Nup _NpNNuCDEJEgJBgJjBEBQ*HE?<>0rHGGdHGGdSWDуdi\?<>0rHGGdHGGdSWDуdiN?<>0rHGGdHGGdSW2 H@N?<,>CEdGH@0r`?<`JBgVB&8TTDуdQRBNuDAр&AdRAрAрDуNuprt|=|J  g +g -f .g20  b 0e 9b da`RF` .f 0e 9b dajSF` Eg efX +g -f 0e 9oSH`00  b&Hz0  b E Do`HJjDDDS4</NJFkSFk&aQN`Ha"FFaQL8Nv6.JJgtBnJNupr$<NuJBk4<rpAC v JBgJjv-| Bb BkH>aaNRFBdL8?Nv<JBga2SF Be BgQRB`ApdR e <rRF&0xafEv+0JFjDFv-Hƌd0BFHF 0HF0ANuprt|`2:HQ A dNAXJ@jNNu~c0NJQNuvN)@p `H@)@prtNAHplrtNB 2pNpNpapaprapalpalpalpaTpaTpaTBp'a?<NNT@B){L9|0<rtNpapap9@p`pvNv`v`vj`v `v`v`v`?(* 9AJA)H@@[000][ˈN Evz`* [g" ]g |g QSz` zQSpQ][ɈN Dvx`* [g" ]g |g QSx` xQSpQ]Bp4NHNu2(g"P@g2RADAH""l`r2oZAe 1@#)I`Nuk1@Nup NN"l`dpNAtrdJhk\QpaNH ld$l`"Hg: k&@0+R`g k#&@0+S@H3 Q&f)I`LNuApNN$Nl$BS@kH2QNupC ұd"X0Pg"RA$D#Nu"X0Nu _0HpN _0HpNp"_0HqNp"_0HqN(* 0(iNl$E 4R`Q$D 4R`QˈN DN ENu?k?<NM"UAf J@fH@NuDW?<NMXNu0,p2,rR@RANuS@SA9@p9ArNu9@pN4, 6fprta0,2,NuA4, 6f9@9Ap rt`, HHHNup`pJ@gHzZ?<&NN\NuB?< NA\Av ACLElp"Jg X\QC"C!/:@?< NA\NuLH!NuHx`(Hx`"Hx`Hx`Hx`Hx` Hx`Hx !4VxH A6@ Ni LHL|1R/:?< NApdK`HaJLxNNu)H9@Jp4NP'J&f H LNu P&NuQ'` J,'fJ,&gHA#ȇeC! B,&LNu-W)K20, 8k8@ gJl&f"Nu , 8g"P 8 @/, 8N  8fQ 8J,'gNupB <``L@ H)l26)z @W , Jf`CfSHj-D@Hd0H@H 0H@0`fSC\fS , @a"C\fApNNNHP?< NA\NuH@aa/a a Nu@0 9c^Nu| PC>$Error # ][Abort]\f.B &lX)K\)ld` lp ,BQjNup(N Division by zeroOverflowNumber not integer|-2147483648 .. 2147483647Number not byte|0 .. 255Number not word|0 .. 65535Square root only|for positive numbersLogarithm only for|numbers greater than zeroUndefined error Out of memory Function or command|not yet implemented String too long|max. 32767 characters Not GfA-BASIC V1.0 program Program too long|memory full|NEW Not GfA-BASIC program|file too short|NEWArray dimensioned twiceArray not dimensionedArray index too largeDim index too largeWrong number of indicesProcedure not foundLabel not foundOn Open only|"I"nput "O"utput "R"andom|"A"ppend "U"pdate|allowedFile already openFile # wrongFile not openInput wrong|not numericEnd of file reachedToo many points for|Polyline/Polyfill/Polymark|max. 128Array must have|one dimensionNumber of points too|large for arrayMerge - Not an ASCII fileMerge - Line too long|aborted ==> Syntax error|program aborted!Undefined label"Out of data#Data not numeric$Syntax error in data|unpaired quotes%Disk full&Command not allowed|in direct mode'Program error|Gosub not possible(Clear not allowed in|For-Next-loops or|Procedures)Cont not possible*Parameter missing+Expression too complex,Undefined function-Too many parameters.Parameter wrong|must be a number/Parameter wrong|must be a string0Open "R"|Record lenght wrong2Not an "R"-File3Only one Field per|Open "R" allowed4Fields larger|than record lenght5Too many Fields (max. 19)6GET/PUT|Field string lenght changed7GET/PUT|Record number wrongMENU error?RESERVE error@Pointer (*x) errorZLOCAL error[FOR error\Resume (next) not possible|Fatal, For oder Locald GFA BASIC V 2.0| Copyright 1986|GFA Systemtechnik GmbHf2 bombs - bus error|Peek or Poke possibly wrongg3 bombs - adress error|Odd word adress! Possibly at|Dpoke, Dpeek, Lpoke or Lpeekh4 bombs - illegal instruction|executed in machine codei5 bombs - divide by zero|in 68000 Machine Codej6 bombs - CHK exeption|68000 interrupted by CHKk7 bombs - TRAPV exeption|68000 interrupted by TRAPVl8 bombs - privilege violation|68000 interrupt by|execution of a|priviliged instructionm9 bombs - trace exeptionGeneral errorDrive not readyUnknown commandCRC error|disk check sum wrongBad requestSeek error|track not foundUnknown media|boot sector wrongSector not foundOut of paperWrite faultRead faultGeneral error 12Write protectedMedia change detectedUnknown deviceBad sector (verify)Insert other disk|(request)Invalid function numberFile not foundPath not foundToo many open filesAccess deniedInvalid handleOut of memoryInvalid memory block adressInvalid drive specificationNo more filesGEMDOS range error|seek wrong?GEMDOS internal errorInvalid executable file formatMemory block growth failure"l`Yd&-KNN"l`YepN&#k"C-KN"Cփk փk2##`փk"`2`$Y8gHRDD*D%H8#$c2g# HRDD%H`/\ga `6f -K. @Nua \dp\N&#k gH`Nu"Cփk փk2##`փk##`3#`$Y8gHRDD*D%H8#$c2g# HRDD%H` l @ , Ь R@"@E Tg`)J @N .)|" NSee ... We just recovered from an error trapping routine with the InterpreterNNNNL+or the Compiler as this demo clearly shows.aNNNNNNN>DNow that we know we have a disk error we can take appropriate actionNNNNNNprNNLPress any key to continue....pNNpNANNN"NNNNNNxNNANNHxN2)An Error Has Occurred! | The number is = 4HPAN0N"_NZHPN& |"_NZHPN& OK r"_ N\+@ N)|" :><|a4g RGj`a(0GVfA1G<ap??<?<NM\Nu??< NMXNuHn 2$4BBNuAd RdQRB BbABJk 0NuJBjBBXNu 0Nu 2$NuE`B<gJEgEjCDEDF Fe( F dF8BCHC` F0bFHC8v` HD8HDkDуdQRBNuDdBDA@kgAр[SBk0NuJlJBk&Nu0g H@rB JkЀ[` BbNuJBj prtNuHPAJgPpr$< _Nup _NpNNuCDEJEgJBgJjBEBQ*HE?<>0rHGGdHGGdSWDуdi\?<>0rHGGdHGGdSWDуdiN?<>0rHGGdHGGdSW2 H@N?<,>CEdGH@0r`?<`JBgVB&8TTDуdQRBNuDAр&AdRAрAрDуNuprt|=|  g +g -f .g20  b 0e 9b da`RF` .f 0e 9b dajSF` Eg efX +g -f 0e 9oSH`00  b&Hz0  b E Do`HJjDDDS4</NJFkSFk&aQN`Ha"FFaQL8N$6.JgtBnNupr$<NuJBk4<rpAC v JBgJjv-| Bb BkH>aaNRFBdL8?N$<JBga2SF Be BgQRB`ApdR e <rRF&0xafEv+0JFjDFv-Hƌd0BFHF 0HF0ANuprt|`2:HQ A dNAXJ@jNNu~c0NhQNuvN)@p `H@)@prtNAHplrtNB 2pNpNpapaprapalpalpalpaTpaTpaTBp'a?<NNT@B){L9|0<rtNpapap9@p`pvNv`v`vj`v `v`v`v`?(* 9AJA)H@@[000][ˈN Evz`* [g" ]g |g QSz` zQSpQ][ɈN Dvx`* [g" ]g |g QSx` xQSpQ]Bp4NtHNu2(g"P@g2RADAH""l`r2oZAe 1@#)I`Nuk1@Nup NN"l`dpNAtrdJhk\QpaNH ld$l`"Hg: k&@0+R`g k#&@0+S@H3 Q&f)I`LNuApNN$N$BS@kH2QNupC ұd"X0Pg"RA$D#Nu"X0Nu _0HpN _0HpNp"_0HqN,p"_0HqN,(* 0(iN$E 4R`Q$D 4R`QˈN DN ENu?k?<NM"UAf J@fH@NuDW?<NMXNu0,p2,rR@RANuS@SA9@p9ArNu9@pN4, 6fprta0,2,NuA4, 6f9@9Ap rt`, HHHNup`pNu)H9@Jp4NtP'J&f H LNu P&NuQ'` J,'fJ,&gHA#ȇeC! B,&LNu-W)K20, 8k8@ gJl&f"Nu , 8g"P 8 @/, 8NX  8fQ 8J,'gNupB <``L@ H)l26)z @W , Jf`CfSHj-D@Hd0H@H 0H@0`fSC\fS , @a"C\fApNNN^HP?< NA\NuH@aa/a a Nu@0 9c^Nu| PC>$Error # ][Abort]\f.B &lX)K\)ld` lp ,BQjNup(NV"l`Yd&-KNN"l`YepN&#k"C-KN"Cփk փk2##`փk"`2`$Y8gHRDD*D%H8#$c2g# HRDD%H`/&#k gH`Nq-KNu)| > > >$SHELL FILE1SIZECOUNTPASSNUM1XEOFINLOOPAREZTEMPFILE1OUTFILE1FILNAMESFILNAME SORTJUMPOPT2 SORTJUMPOPT1P****************************** GFATIP04.BAS *********************************  * *2 By John B. Holder *, GRIFJOHN r F Designed to display the possiblities with displaying 4 Disk Directories e < Includes a Fast Shell Sort Routine  RWarning: No Error checking routines are installed with this version. You must Pinstall your own. For example if a disk is write protected, the program will crash.  rT A Good project for an enterprising GFA Basic Programmer would be to incorporate : Tim Purve's Sort Routine to this procedure. Have fun!  E F  @ JF()!For High or Med Rez!!!Sorry!FqF! F! T TRY`! "@Sorted Columnar Directory Listing by John B. Holder For GFATIP04F.J*zz F Up to 1,000 file names. Only Hard disks could go higher. c.Y8! "Writing a Temp file first....FWG tempfile.tmpF7I!M! tempfile.tmpFEFFHNow let's read the file that has the listing of current files in it. . o =`M! F EFF !ZrM F!HFEF8FF(Now let's get rid of the pesky thing!  oA tempfile.tmpFT************************************* Shell Sort of the Directory ***************  * *actual sorting  * E% FiLThis next series of periods on the screen shows the activity of the sort.  h$Y !  " Now Sorting."FF #ZF#EGF."F#EGHFSEFE F |F# #jJF -F F ## JF-F# FH# ! Fg EF-F|FH ! F #6F #F E% F "FFF:5 We are fully sorted now......F {pFp for effect only. n(!!!FFYF FLet's display the directory in columns and in Graphic text format. &EGH@F!%0EG@F'!# ! F&'>!# ! F EF $FG %@JFeBY!H "*Please Press a key to display next page..."FEa F &F BHere is where we find out some goodies about the current disk! a e eTY!H "< Please Wait Because I'm Calculating Vital Statistics......."F {pFnY !H " Total of A  files Free Disk Space = A  Press space bar to quit..."FEa F FYF $FFqFe of program. NThis is not supposed to be a screamer. As a matter of fact the program has Vbeen slowed down a bit to allow you to see what is happening. It works just great Pwith hard disks as well as floppys. You can speed it up by taking out all of @the unnecessary narration print lines and the sort periods...  hR There is a fast way to do a columnar sort, but it is a bit above the level of eP this GFATIP file series. You may prepare the directory totally in memory if R so desired, but the concepts are a bit complicated. Perhaps in a future file?  sB This file should help you to build on some sound fundamentals. N*************************************************************************** SSRpDP**#R#`4Q` Efv*oM! m HPHUBg?<JNA(m)m -:gS)@ -OK1PC#HN2Hx?<HNA@)@l/?<HNA)@h&@)@XЬl)@d)@`ARCpr Ѝ"QHN(ALNHz2?< NA\pdAxr0XQ)K\NN :><|a4g RGj`a(0GVfA1G<ap??<?<NM\Nu??< NMXNu&8*:EENuHn 2$4BBNuAd RdQRB BbABJk 0NuJBjBBXNu 0Nu 2$NuE`B<gJEgEjCDEDF Fe( F dF8BCHC` F0bFHC8v` HD8HDkDуdQRBNuDdBDA@kgAр[SBk0NuJlJBk&Nu0g H@rB JkЀ[` BbNuJBj prtNuHPAJgPpr$< _Nup _NpNNuCD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NupB <``L@ H)l26)z @W , Jf`CfSHj-D@Hd0H@H 0H@0`fSC\fS , @a"C\fApNNNHP?< NA\NuH@aa/a a Nu@0 9c^Nu| PC>$Error # ][Abort]\f.B &lX)K\)ld` lp ,BQjNup(N Division by zeroOverflowNumber not integer|-2147483648 .. 2147483647Number not byte|0 .. 255Number not word|0 .. 65535Square root only|for positive numbersLogarithm only for|numbers greater than zeroUndefined error Out of memory Function or command|not yet implemented String too long|max. 32767 characters Not GfA-BASIC V1.0 program Program too long|memory full|NEW Not GfA-BASIC program|file too short|NEWArray dimensioned twiceArray not dimensionedArray index too largeDim index too largeWrong number of indicesProcedure not foundLabel not foundOn Open only|"I"nput "O"utput "R"andom|"A"ppend "U"pdate|allowedFile already openFile # wrongFile not openInput wrong|not numericEnd of file reachedToo many points for|Polyline/Polyfill/Polymark|max. 128Array must have|one dimensionNumber of points too|large for arrayMerge - Not an ASCII fileMerge - Line too long|aborted ==> Syntax error|program aborted!Undefined label"Out of data#Data not numeric$Syntax error in data|unpaired quotes%Disk full&Command not allowed|in direct mode'Program error|Gosub not possible(Clear not allowed in|For-Next-loops or|Procedures)Cont not possible*Parameter missing+Expression too complex,Undefined function-Too many parameters.Parameter wrong|must be a number/Parameter wrong|must be a string0Open "R"|Record lenght wrong2Not an "R"-File3Only one Field per|Open "R" allowed4Fields larger|than record lenght5Too many Fields (max. 19)6GET/PUT|Field string lenght changed7GET/PUT|Record number wrongMENU error?RESERVE error@Pointer (*x) errorZLOCAL error[FOR error\Resume (next) not possible|Fatal, For oder Locald GFA BASIC V 2.0| Copyright 1986|GFA Systemtechnik GmbHf2 bombs - bus error|Peek or Poke possibly wrongg3 bombs - adress error|Odd word adress! Possibly at|Dpoke, Dpeek, Lpoke or Lpeekh4 bombs - illegal instruction|executed in machine codei5 bombs - divide by zero|in 68000 Machine Codej6 bombs - CHK exeption|68000 interrupted by CHKk7 bombs - TRAPV exeption|68000 interrupted by TRAPVl8 bombs - privilege violation|68000 interrupt by|execution of a|priviliged instructionm9 bombs - trace exeptionGeneral errorDrive not readyUnknown commandCRC error|disk check sum wrongBad requestSeek error|track not foundUnknown media|boot sector wrongSector not foundOut of paperWrite faultRead faultGeneral error 12Write protectedMedia change detectedUnknown deviceBad sector (verify)Insert other disk|(request)Invalid function numberFile not foundPath not foundToo many open filesAccess deniedInvalid handleOut of memoryInvalid memory block adressInvalid drive specificationNo more filesGEMDOS range error|seek wrong?GEMDOS internal errorInvalid executable file formatMemory block growth failure"l`Yd&-KNN "l`YepN?<NNTA6NA6N<&<x*<NpfN-XHxNFor High or Med Rez!HPNSorryr"_ N+@HNNprNN@Sorted Columnar Directory Listing by John B. Holder For GFATIP04N <CLNNprNNWriting a Temp file first.... NA HPN tempfile.tmp"_NpIN^HPN tempfile.tmpr"_NLBmpNA N8/N CLNA N<&<x*<NA NPpN$VHgN.`C A 0NN tempfile.tmpNZAN,VNhYN`NsN^NuNVBn:.EIBtPRn nfI* -EI* -EI* -EI* -EI* -Ez-E=| Bn=|BnBn <I* "NB=|N=|=|=|Bn=|z-E <I* "NB=|4=|=|=|Bn=|(mI* -E <I* "NB=|Bn=|BnBn <I* "NBN pL?09XnNAN^NuNV/-+NI (Gz+WBn:.IJ4PgRn`=yXn n d:.I0PN(z:. HEBEHE HEx0D8.I@Rnz:. HEx0D8.I@RnI TGzWBn:.I8.nGP@Rn:.IJ4Pg`N+_N^Nu OAbrpNGNuF'/NNn-/=-/H"Q ,IL?/^>/^Nf,oNsF'/NNn-/=-/H"Q G*- =/^Nf,oNs/NNn-/=/-/H _"h$",HL?/^>/^Nf,oNsF'SSfWWNsSf>NsSfF NsSfNqNsSf N0NsNhBBB 9X!B*H$C! `N <L? <NAN`WNsNVH(. ,. dF<gBEVBBGVB0G|b.f ؆dRE`kgb|HDkSEjؼdREBJfBEJEnB`|mpN(-D LN^Nu |oNNVH(. ,..HD:|glM||HF>|gXO||G|~mF H@HFB@H@2Ё"HAHFЁHD؀kSEؼdREJEk|m pN(B` -D LN^NuNVH(. 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T(_N\/ ?.?<?.?. ?. ?.NO (_:,yiSEHŋixPE:.Hŋ Hĉd9D/ ?.?,?,?,?,aO (_N/ ?.?< ?.?. ?. ?.NO (_:,yiSEHŋixE:.Hŋ Hĉd9D/ ?.?,?,?,?,a|O (_Nl/ ?.?.?. ?. ?.HnN&.O(_J.g`N/ ?.?<HlHlHlHlN~O(_/ ?.?<HlHlHlHlN~O(_:,Hŋi=Eznll zn9E:,Hŋi=EzPnll zPn9EN/ ?.?.?. ?. ?.HnN&.O(_/ ?.?<HlHlHlHlN~O(_/ ?.?<HlHlHlHlN~O(_N(N$ 8|<l\*N^NuNV?.aTN^NuNVBn:.?.BgHyXN%PN&N" .F^vN^NupN@NVBnHn?<:9i E?:9i E??<,?<Z?<HyXNAOJ9ggJRyi?./<UNDB\Bn?.?<HHyXNIP?.NHTRn nfRn nf^N^NuNU`pN@NVUHx@<N,\JfpN(ByiNVN Jyig`NNURN^Nu Marathon Demo Program At Marathon Computer Press, We Go The Distance For Creative Computing!<@ *lD P2         (           ** D8D&"2         "            (    &     "     . . &     " 0       B& j6@  @ $$$ $ 2 R : :Z N ".N$< *6,6*>B&" 0@"$ : ,        dP L         D.,,<:4  :N^4  : P02   J4       & F  ,,  4|r $d(>&& 0X "4 <"(< x2* |(2(8,p J(|( ^ ^2&&>&&\ &   6   & GfABASIC &*******0000RAREZYKPROGNAMETEMPUSE PROGRNAMEOUTMAIN: GFATIP05.BAS Using EXEC by John B. Holder , June 14,1987 ( V 1.0  N You will be able to understand the EXEC command by studing this code and Jby reading the accompanying GFATIP05.TXT file. It really isn't tough.  y y.This Program's Main Screen and body follow l hLPlease run this demo in ONLY Medium Resolution or High Resolution or the n"Screen will be distorted!!!!!! d c(!!!FM6'H!H!  Using EXEC by John B. Holder F$Y !p " Options are:Fu0Yh!0 "The GFATIP05.BAS ProgramF @Y ! "(Run the Marathon Demo Program = Press F1FtY ! "ORFDY!( ",To Exit This Demo Program Press The SpacebarF XFE F F(,)!For Med or High|Rez ONLY!!! OK !FqF! F!FFMF FqF FF+FX FEa F ;F  F1 Pressed eYF 4JF%!!FEGGF  VFEGGF %!!F F!!! !FF 6You must close all of the windows to exit the demo.  oEDEMO.PRGFG e. Marathon Demo.Prg O& was 6 Developed using TDI Modula-2/ST 8 0272-742796(UK), (214)340-4942(USA)  H Note: It is a run time requirement to make the above Notification. n a oLWe need to reserve quite a bit since we are dealing with a lot of windows  eJX  (F We reserve enough for the program and the Stack to Fit.  n6In this instance we choose to Load and Go, Option 0  nD!!!F You may have to experiment a bit to find the right B combinations to work with your programs.  @X  (Fs Take it all back except the Basepage. YFFF F.FG } }}`Ql` Efv*oM m HPHUBg?<JNA(m)m -:gS)@ -OK1PC#HNHx?<HNA@)@l/?<HNA)@h&@)@XЬl)@d)@`ARCpr Ѝ"QHNFALNHz2?< NA\pdAxr0XQ)K\NN*......N ,`NuJrBjNuHz?<&NN\NzCAp$L Qp Nf9lrBlJpNNfpMNf9@pdAr 0Q0tr N9lNupealp`NuaNJHz?<&NNBWNANC2A@p222NrҌ0<NB0,rNurA9Ar`v C9Cr`rt9@9A9BNrrҌpsNB0,Nu9@N`rDҌpsNBNuC2 @ e @}bA@p222Nr,Ҍ0<NBNu pa2|a>:><|a4g RGj`a(0GVfA1G<ap??<?<NM\Nu??< NMXNuHn 2$4BBNuAd RdQRB BbABJk 0NuJBjBBXNu 0Nu 2$NuE`B<gJEgEjCDEDF Fe( F dF8BCHC` F0bFHC8v` HD8HDkDуdQRBNuDdBDA@kgAр[SBk0NuJlJBk&Nu0g H@rB JkЀ[` BbNuJBj prtNuHPAJgPpr$< _Nup _NpNNuCDEJEgJBgJjBEBQ*HE?<>0rHGGdHGGdSWDуdi\?<>0rHGGdHGGdSWDуdiN?<>0rHGGdHGGdSW2 H@N?<,>CEdGH@0r`?<`JBgVB&8TTDуdQRBNuDAр&AdRAрAрDуNuprt|=|  g +g -f .g20  b 0e 9b da`RF` .f 0e 9b dajSF` Eg efX +g -f 0e 9oSH`00  b&Hz0  b E Do`HJjDDDS4</NJFkSFk&aQN`Ha"FFaQL8N6.JgtBnNupr$<NuJBk4<rpAC v JBgJjv-| Bb BkH>aaNRFBdL8?N<JBga2SF Be BgQRB`ApdR e <rRF&0xafEv+0JFjDFv-Hƌd0BFHF 0HF0ANuprt|`2:HQ A dJf`CfSHj-D@Hd0H@H 0H@0`fSC\fS , @a"C\fApNNNPHP?< NA\NuH@aa/a a Nu@0 9c^Nu| PC>$Error # ][Abort]\f.B &lX)K\)ld` lp ,BQjNup(NV"l`Yd&-KNN"l`YepN&#k"C-KN"Cփk փk2##`փk"`2`$Y8gHRDD*D%H8#$c2g# HRDD%H`pNfpNjpNnp Np2r2NN:  Using EXEC by John B. Holder NNlpr#N.NR Options are:NNlp rN.NRThe GFATIP05.BAS ProgramNNlprN.NR(Run the Marathon Demo Program = Press F1NNlpr(N.NRORNNlprN.NR,To Exit This Demo Program Press The SpacebarNN?<NNTANANzNfNHxNFFor Med or High|Rez ONLY!gHPN: OK r"_ N.+@*NPANA4NXAN&<x*<NfN.NP`NPNpNANAN&<x*<NfNN|AN&<x*<NfNpNrpNvpNzA G0NA G0pNrpNvpNzprNA N"<NNzN:DEMO.PRGCN`NNH <(r$<L8N2NNBgHmA HPA NjNN&<(x*<N6H <r$<L8N2NNN|N\ANN~NPP&>&& June 14,1987 GFATIP05.DOC by John B. Holder Senior Software Engineer Marathon Computer Press Asst. Sysop on GEnie's MichTron Roundtable USING THE EXEC COMMAND IN GFA BASIC This is the fifth in a planned series by this author on getting the most out of your GFA Basic Investment. In this Tip file we will briefly cover the EXEC command and some of it's possibilities and peculiarities. There are several possibilities with this command, however I will brush on just a few. With the EXEC command you can either load and execute or load and wait for a subsequent execution time. Since the upcoming book by GFA Systemtechnik will go into detail of how to load a program and execute it on call, I will skip over that option. The immediate load and go is the most common usage of the EXEC command so that will be the mode discussed in this doc file and in the GFATIP05.BAS and GFATIP51.BAS files. 1. To simply load a program and execute it from a running application we would do something like this: Reserve Fre(0)-Spaceneeded Exec 0,"Your.Prg","","" Now you may ask how much is needed? Well, you must reserve enough for the entire program you are loading to fit into a block of memory & you must also allow enough room for it's stack and data storage area as well. This is a process of dynamic memory allocation for your called program. So now you might ask, what is the point that I start at? How much do I give it? Well, once again you have to experiment a bit here to find just the right amount. Start out a little higher than you think you need first, and then run your basic program and work the reserved memory down until you have the minimum required to execute it successfully. If you have not allocated enough memory the load and go will fail, and the program will not run. In that case, just allocate more memory and try a run again. Now once you have successfully accomplished the allocation of memory and the execution of your called program, YOU MUST return the memory to the memory pool by doing this: Reserve Fre(0)+Spaceneeded-255 If you do not return the memory, it will be retained by the system and will continue to reduce itself if the program is called repeatedly. Not only that, the parent program will not have the memory resource following the return of control without the restoration function mentioned above. The GFATIP05.BAS and GFATIP51.BAS files will show you how this MUST be done. 2. Other Possibilities: If you would like to call a TTP program and pass in a command to it you must use the following calling convention: Suppose the command is ah new.arc *.bas (For ARC.TTP) Command$="ah new.arc *.bas" Command_length=Len(Command$) Command$=Chr$(Command_length)+Command$+Chr$(0) Reserve Fre(0)-Spaceneeded Exec 0,"Your.Prg",Command$,"" Reserve Fre(0)+Spaceneeded-255 That's all there is to it. Essentially, what we did was formulate a command in our mind (it must be a legal one for the program you are passing it to), place the command into a string variable, find out the length of the string, reconstruct the command as this: Length of the command, Actual Command, A null Byte for Padding Other than that, the format is the same as that which the other flavor of EXEC command uses. 3. Peculiarities: If you are calling a compiled GFA Basic program from a parent interpreted Basic program, many times following the return from the child (compiled basic program you called), you will be presented with an alert box asking if you would like to continue or quit. This is because the compiled GFA Basic program is passing the interpreted program a signal that says "Let's end". It is sort of like pressing the Control+Shift+Alternate keys. This peculiarity goes away if you compile the program. In other words, if all of your programs are compiled (Parent, and Child), then you will not have this problem. This is not a problem if you don't mind having your program interrupted during development. Now you see why I have included a Demo Program written in Modula 2 for an example. This way those of you using Interpreters only can run the GFATIP05.BAS file without interruption. Since Modula 2 uses a different exiting sequence, this "Break" does not arise. To see the Break example run GFATIP51.BAS. You will see the difference as ICON.PRG is a compiled GFA Basic program. The Icon Demo came from the GFA Basic Companion's Source Code Libraries. The GFA Basic Companion will be available at a Software Dealer near you or directly from MichTron soon. I hope this helps many of you out. If you are interested in getting some questions answered on a live basis, why not stop in for one of our weekly GFA Basic Conferences on GEnie at 10:00PM EST, 7:00PM PST every Saturday. A lot of GFA Experts and Enthusiasts stop by each week. We'll be looking for you. GfABASIC &*******0000ZAREZYKPROGNAMETEMPUSE PROGRNAMEOUTMAIN: GFATIP51.BAS Using EXEC by John B. Holder , June 14,1987 ( V 1.0  N You will be able to understand the EXEC command by studing this code and Jby reading the accompanying GFATIP05.TXT file. It really isn't tough.  y y.This Program's Main Screen and body follow l hLPlease run this demo in ONLY Medium Resolution or High Resolution or the n"Screen will be distorted!!!!!! d c(!!!FM6'H!H!  Using EXEC by John B. Holder F$Y !p " Options are:Fu0Yh!0 "The GFATIP51.BAS ProgramFlHYp! "1Run the GFA Basic Companion Icon Demo = Press F1FY ! "ORFDY!( ",To Exit This Demo Program Press The SpacebarF XFE F F(,)!For Med or High|Rez ONLY!!! OK !FqF! F!FF{FMF FqF FF+FX FEa F ;F  F1 Pressed eF 6You must close all of the windows to exit the demo.  o0EICON.PRGFa A compiled GFA Basic Program m e eJX $F We reserve enough for the program and the Stack to Fit.  n6In this instance we choose to Load and Go, Option 0  nD!!!F You may have to experiment a bit to find the right B combinations to work with your programs.  @X $Fs Take it all back except the Basepage. YFFF F.F; } }}`,Ql` Efv*oM m HPHUBg?<JNA(m)m -:gS)@ -OK1PC#HNHx?<HNA@)@l/?<HNA)@h&@)@XЬl)@d)@`ARCpr Ѝ"QHNFALNHz2?< NA\pdAxr0XQ)K\NN*......N ,`NuJrBjNuHz?<&NN\NrCAp$L Qp N^9lrBlJpNN^pMN^9@pdAr 0Q0tr N9lNupealp`NuaNJHz?<&NNBWNANC2A@p222NrҌ0<NB0,rNurA9Ar`v C9Cr`rt9@9A9BNrrҌpsNB0,Nu9@N`rDҌpsNBNuC2 @ e @}bA@p222Nr,Ҍ0<NBNu pa2|a>:><|a4g RGj`a(0GVfA1G<ap??<?<NM\Nu??< NMXNuHn 2$4BBNuAd RdQRB BbABJk 0NuJBjBBXNu 0Nu 2$NuE`B<gJEgEjCDEDF Fe( F dF8BCHC` F0bFHC8v` HD8HDkDуdQRBNuDdBDA@kgAр[SBk0NuJlJBk&Nu0g H@rB JkЀ[` BbNuJBj prtNuHPAJgPpr$< _Nup _NpNNuCDEJEgJBgJjBEBQ*HE?<>0rHGGdHGGdSWDуdi\?<>0rHGGdHGGdSWDуdiN?<>0rHGGdHGGdSW2 H@N?<,>CEdGH@0r`?<`JBgVB&8TTDуdQRBNuDAр&AdRAрAрDуNuprt|=|  g +g -f .g20  b 0e 9b da`RF` .f 0e 9b dajSF` Eg efX +g -f 0e 9oSH`00  b&Hz0  b E Do`HJjDDDS4</NJFkSFk&aQN`Ha"FFaQL8N6.JgtBnNupr$<NuJBk4<rpAC v JBgJjv-| Bb BkH>aaNRFBdL8?N<JBga2SF Be BgQRB`ApdR e <rRF&0xafEv+0JFjDFv-Hƌd0BFHF 0HF0ANuprt|`2:HQ A dJf`CfSHj-D@Hd0H@H 0H@0`fSC\fS , @a"C\fApNNNHHP?< NA\NuH@aa/a a Nu@0 9c^Nu| PC>$Error # ][Abort]\f.B &lX)K\)ld` lp ,BQjNup(NV"l`Yd&-KNN"l`YepN&#k"C-KN"Cփk փk2##`փk"`2`$Y8gHRDD*D%H8#$c2g# HRDD%H`pNxpN|pNp Np2r2NN  Using EXEC by John B. Holder NN~pr#N.N. Options are:NN~p rN.N.The GFATIP51.BAS ProgramNN~prN.N<1Run the GFA Basic Companion Icon Demo = Press F1}NN~pr(N.N.ORNN~prN.N.,To Exit This Demo Program Press The SpacebarNN?<NNTANzANzNfNHxN"For Med or High|Rez ONLY!gHPN OK r"_ N +@*NHANpNALNXAN&<x*<NfNFNH`NHNpNANzAN&<x*<NfN$NzNICON.PRGCNJNN~H <r$<L8N*NNBgHmA HPA N|NN~&<x*<N.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փk փk2##`փk"`2`$Y8gHRDD*D%H8#$c2g# HRDD%H`N\pr N.NSample Icon ProgramNN\prN.NPress the Right Mouse ButtonNN\pr N.N To Quit...NN\p r N.N6This Demo Taken From The GFA Basic Companion LibrariesNN\p r N.N# By John B. HolderbNANXNNANXBmBmBm pNNA NTN ANTNANTA N&<x*<NgNAN&<x*<N8pJBgp/AN&<x*<N>pJBgp/AN&<x*<N8pJBgp/AN&<x*<N>pJBgp/A N&<x*<NpJBgp$VHgA N&<x*<NfN&AN&<x*<N&fNAHNXN&ANXA N&<x*<NgjN~A 0pN6pN:pN>pNlpNpfrfNz <"<NpfrfNz <"<NpNbpNlpNpnrxNzp}rsNTp}rsNzp}"<NTp}"<Nzpn"<NTpn"<NzpnrxNTpNlpNp~rtNzp~"<NTp~"<Nzpo"<NTpNlpNA 0 <r$<&<x*<ANANroN| <r$<ANNNrqNVN`NqNqpNlpNp{r{Nzp{"<NTpNbN\prN.NIcon is now selected 4NpNN~BmpN6pN:pN>pNlpNpdrdNz <"<NpdrdNz <"<NpfrfNz <"<N <rPNz <"<N <rPNz <"<NpnrxNzp}rsNTp}rsNzp}"<NTp}"<Nzpn"<NTpn"<NzpnrxNTpNlpNp~rtNzp~"<NTp~"<Nzpo"<NTpNlpNA 0 <r$<&<x*<ANANroN| <r$<ANNNrqNVN`NqNqpNlpNp{r{Nzp{"<NTpN*pN.pN2pN~N\prN.NIcon is not selected 4N <rZNzNFloppy Drive ANTN~N\" .  to..  tGFATIP06TXTt p'MULTI02 PRGt z4 July 4, 1987 GFATIP06.DOC by John B. Holder Senior Software Engineer Marathon Computer Press Asst. Sysop on GEnie's MichTron Roundtable This is the 6th in a planned series of GFA Tip files. The topic of this issue is "Multi-Tasking with GFA Basic, To Be or Not to Be". Before we get into the nitty gritty of the subject, a bit of background is necessary first. If you are an experienced programmer with a background in Multi-Tasking operating systems such as UNIX then please excuse the intro to the subject. Multi-Tasking Myths-vs-Reality Myth: When Multi-tasking on a one CPU system, you actually run several concurrent processes all at the same time. Reality: A single CPU system that Multi-Tasks actually allows several jobs to be started and be scheduled concurrently, however the CPU's time is actually shared among the processes. This is where you might have heard the term "Time-Sharing System". The operating system creates several shells for ongoing processes, and switches among the active scheduled processes in such a manner as to give the impression of simultaneous execution. There are several excellent software packages that use this scheme of process "sharing" on the ST. Most notably are David Beckemeyer's MT C Shell, Flight Simulator, and Silent Service to name a few. So the big question at this point is, "Why Not GFA Basic Too?" Well, the answer is "It is possible if several factors are taken into consideration and worked out properly." So, now let's get on with the background of a Multi-Tasking Operating System or Application. At the heart of any Multi-Tasking application is what is known as a Kernel. The Kernel must control access to the computer, manage memory assets, maintain the file system, and allocate available resources to the calling procedures or users. It is analogous to a traffic cop. This is the heart of the system. Here is where all of the control of the CPU takes place, and it must take place invisibly to the user, so they need not ever be aware of it's presence. Now you might ask, how does this Kernel thing know when to activate and de-activate a process? Well, that's where you as a programmer or user would step in. Typically TSS {time-sharing systems} allocate a "Quantum" to active processes. A Quantum is nothing more than a chunk of time to be used by a process. In a round-robin type of scheduler each process can be assigned the same Quantum, or the individual processes can be awarded varying Quantums based on a prioritization scheme. For example: A business is running a series of jobs on a Multi-Tasking system and the operator decides to assign a higher priority to the Payroll job for obvious reasons. By doing so, he/she in effect gives the process {Payroll} a larger Quantum. By now you might be thinking, "That's all fine and good, but that's a much more expensive system than my little ST!". This is very true, but with the speed of the MC68000, and some built in features of the ST system, coupled with the sheer speed of instruction handling provided by GFA Basic, you can actually schedule multiple processes to be handled at a single time. So without further ado, let's talk a bit about setting up limited multi-tasking within a running application written in GFA Basic. There are essentially two ways that you might initiate this type of job handling on the ST with GFA Basic. The first, {which will suit most tasks} is to use the Timer command from within a master scheduling procedure {Dispatcher}, or to call on a routine that has been written in C or 68000 Assembler and compiled or assembled to do the job for you using the C or Call commands. The method used in the example compiled program utilizes the first method. While the internal handling of the processes is undoutedly the easiest, it is also the less flexible at least in terms of running multiple programs versus multiple processes. It is doubtful that you would be able to successfully run multiple applications at once without the control of an exterior shell program {kernel}. But then again even the applications mentioned above that Multi-Task do not run several programs at once, {the exception is Beckemeyer's MT C Shell, it actually will run several applications at once from a parent Command Shell and Kernel}. So here in the next section I'll rough up a diagram of what is necessary for an application to include to make Multi-Tasking a reality. Oh by the way, this is a very rough approximation of what must happen. I'll leave the more involved details to your own ingenuity. START | Job I/O and Selection {Perhaps a CLI} | Pre-Process and assign PID {process ID's} | | The Kernel Here we assign the Quantum for Processes and dispatch the running of those processes until they are ended. / | \ Process 1 Process 2 Process 3 | As processes end, new ones may be assigned as desired. | Until no more processes are active | End of Program I told you it was ROUGH! But I think it gets the idea across nicely enough. So at this point you might ask "That's fine and dandy, but why would I ever want to Multi-Task anyway?". If you have ever felt impatient while your Terminal program sits there staring at you with it's great big pale irridescent eye while downloading a HUGE file from a BBS, and you were powerless to do anything but wait till it was finished you will understand the need and applicability of Multi-Tasking. With Multi-Tasking on your side, you could perhaps drop out and play a game while the file is finishing in the background. Or take the instance of the games {Silent Service or Flight Simulator II} mentioned above. They are both very, very involved and maintain several processes at once, thus necessitating a form of Multi-Tasking. Who likes looking at a game screen that just does one thing at a time? Not Me! I want action with things moving all over the place and sound, and, and, well you get the idea. Any one that has used or seen Tim Purves's BBS will also get an appreciation for what can be accomplished with Multi-Tasking. The little demo program I've included in this ARChive will give you a glimpse of a brand of Multi-Tasking that is possible with GFA Basic. The Processes may be independently killed by pressing either the 1,2,or 3 keys on the keyboard, or you may press the right mouse button to stop the currently active process. When you do so, an alert box appears and asks if you would like to kill the process. The number of the active process appears in the upper right hand corner of the screen and also in the alert box. At that time, you may either kill it or allow it to continue. I opted to use the AES and alert boxes so that when chosen all processes would STOP momentarily so that you could in effect see a freeze frame of the activity. I could have used a non destructive process that allowed the activity to continue while waiting for your response, but that was not the intent of the demo. If you have killed a process and desire to start it up again, just press the 1,2,or 3 keys on the keyboard. The numbers relate directly to the processes and windows represented on the screen. When all of the processes are terminated, the program will exit normally to the GEM Desktop. The Question? Why, you might ask yourself, is this guy doing this, and why has he not uploaded the source code to the demo? The answer to that is that I want to see what sort of reaction you all have about this. If there is enough interest in this subject, perhaps and I do mean maybe, I can develop a Kernel that will handle several types of scheduling for you. I'm not totally confident in that theory as of yet, but without any interest in the user and programmer community I will definitely not pursue it any further. I just thought that some {hopefully many} of you would be interested in a product that could be merged into your own programs and would {nearly} painlessly dispatch Multi-Tasking for you. Since I am not sure as to where this demo will end up, the contact points are listed below: On GEnie send Email to address = > GRIFJOHN or MCP.TECH01 and On Compuserve send Email to address = > 75766,505 At this point it is just in the idea stage, but from the above discussion and included demo program, you can see that it is possible even if in a limited fashion. Some of you may even run with the idea yourselves. If you do, I wish you all of the luck in the world, {you're going to need it, heh...heh..}. For all of you doubting Thomas'es out there, it wasn't too long ago that all I heard on GEnie was "Gee... GFA Basic sure would be nice if you could just use Dialog Boxes...", some even said it couldn't be done. That's why I wrote The GFA Basic Companion(tm). So perhaps this program's for you! At any rate, please spend a dime or two and leave me a note on one of the two mentioned billboards, or you can drop me a letter at: Marathon Computer Press P.O. Box 68503 Virginia Beach, VA 23455-9433 Your comments will be appreciated. `4R` Efv*oM m HPHUBg?<JNA(m)m -:gS)@ -OK1PC#HN@Hx?<HNA@)@l/?<HNA)@h&@)@XЬl)@d)@`ARCpr Ѝ"QHNFALN>Hz2?< NA\pdAxr0XQ)K\NNJrBjNuHz?<&NN\NCAp$L Qp N9lrBlJpNNpMN9@pdAr 0Q0tr N9lNupealp`NuaNJHz?<&NNBWNANC2A@p222NrҌ0<NB0,rNurA9Ar`v C9Cr`rt9@9A9BNrrҌpsNB0,Nu9@N`rDҌpsNBNuC2 @ e @}bA@p222Nr,Ҍ0<NBNu pa2|a>:><|a4g RGj`a(0GVfA1G<ap??<?<NM\Nu??< NMXNu&8*:EENuHn 2$4BBNuAd RdQRB BbABJk 0NuJBjBBXNu 0Nu 2$NuE`B<gJEgEjCDEDF Fe( F dF8BCHC` F0bFHC8v` HD8HDkDуdQRBNuDdBDA@kgAр[SBk0NuJlJBk&Nu0g H@rB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HpN _0HpN p"_0HqNp"_0HqNE ұeHHQ0)N$_$ZR@H`2QNu$Y0gHR@@"D%$X0P2g# R@%NupE $ $X0dP.gRG,D%pr Y2dP.gRG,D!p4Ae4v`VfANuNWHNuNVHNuH&NրN񐶀jNurNq Y Qf*d ЀЀ 2$4BBNuHRp` HRpJQfpNNq Y QfdЀЀ 0NuNNNq Y Qfd ЀЀNuNN$_& Y Qf d փփABJk 0NNN0$_& Y Qfdփփ!8NNNT$_& if"QdփփHRNNN~,Nq8DRzXEEg"7PNqR$HBJBgpNJgJigp`eetЂ`"ЀeЁdp`ЀeЀe"Ѕe$W.H@@NL"2` NqR YEjrd0` SjN$_N:ЀЀ 2$4BBN YQf "_Nq*eNN*< NqbІSGfN$_N|փփHRN^ YQf "_&Nq*eNN*<&NqbֆSGfN~$_N:ЀЀЈNp"X4g S`"QNuNuNJPgBP, d4d<e<Ѐ"ЀЁE Y0gR@2DAH!b` `ЀЀ`Ѐ"ЀЁE. l ,`2"X2g,e($UAk&QHPS Y2g RSj _b l ,"X2geb J"F\Nj" KC`e N`d \N l\Ӭ\ NupNd d3 d# d# # d# # # # d# # # # # # # # dB` # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # QNudd2d"d""d""""d""""""""dB` """"""""""""""""""""""""""""""""QNu0,p2,rR@RANuS@SA9@p9ArNu9@pN4, 6fprta0,2,NuA4, 6f9@9Ap rt`p`pNu)H9@Jp4NP'J&f H LNu P&NuQ'` J,'fJ,&gHA#ȇeC! B,&LNu-W)K20, 8k8@ gJl&f"Nu , 8g"P 8 @/, 8NX  8fQ 8J,'gNupB <``L@ H)l26)z @W , Jf`CfSHj-D@Hd0H@H 0H@0`fSC\fS , @a"C\fApNNNHP?< NA\NuH@aa/a a Nu@0 9c^Nu| PC>$Error # ][Abort]\f.B &lX)K\)ld` lp ,BQjNup(NV"l`Yd&-KNN"l`YepN&#k"C-KN"Cփk փk2##`փk"`2`$Y8gHRDD*D%H8#$c2g# HRDD%H`"X0gBPHR@@"D#Nu?<NNTAlNnAlNJ&<x*<N@fNpHxNlFor Med Rez Only!HPNl Sorry r"_ N+@NA)$NXpNpNN\NA u0ANJ&<x*<NA N^A /0ANJ&<x*<NAN^N`  Multi-Tasking Window #1 C퀖NN`  Multi-Tasking Window #2 C퀜NNpC퀸NxHxpC퀾~NzNNprN.NxGFA Basic Multi-Tasking KernalNNprN.Nby John B. HolderlNNpr2N.NxProcess Active: NprN.NxProcess 1 Output Window:NNpr+N.NxProcess 2 Output Window:NNprN.NxProcess 3 Output Window:NANXANXNzNNpNpN <r$<&<x*< NH <r$<L8NNrN <r$<&<x*< NH <r$<L8NN"<N <rN <"<~NprN <"<~N"pNpNp#rNp#"<~NpNpN <"<N <"<NN~A* 0A0 0NAHNnA퀨NNC퀨NHmp1N"_NDfN NprBN.p1NNpC퀸Np&<x*<NfN JHxtC퀸NN HxNlKill Process 1 Now?4HPN` Yes | No r"_ N+@ -SWHfN Hx <r$<C퀸NHmp2N"_NDfN!NprBN.p2NNpC퀸Np&<x*<NfN!HxtC퀸NN!HxNlKill Process 2 Now?4HPN` Yes | No r"_ N+@ -SWHfN!Hx <r$<C퀸NHmp3N"_NDfN"TNprBN.p3NNpC퀸Np&<x*<NfN!HxtC퀸NN"THxNlKill Process 3 Now?4HPN` Yes | No r"_ N+@ -SWHfN"THx <r$<C퀸NpC퀸Np&<x*<N@fN"A#`NXpC퀸Np&<x*<N@fN"A%~NXpC퀸Np&<x*<N@fN"A'NXpC퀸Np&<x*<NpJBgp/pC퀸Np&<x*<NpJBgp/pC퀸Np&<x*<NpJBgp$VHgvN~NprBN.p1NNHxpC퀾~N&<x*<NfN#HxHxtC퀾~NhpNN#pNHxHx <r$<C퀾~NhHxpC퀾~NN`HxpC퀾~N&<x*<N&<x*<NNr(NA퀖NHxpC퀾~N&<x*<NfN$HxHxtC퀾~NhHxpC퀾~N&<x*<NfN$HxHxtC퀾~NhN$HxHx <r$<C퀾~NhNATNnATNJ&<x*<NfN%zHxNlKill Process 1 Now?4HPN` Yes | No r"_ N+@ -SWHfN%zHx <r$<C퀸NN~pNNprBN.p2NNHxpC퀾~N&<x*<NfN%HxHxtC퀾~NhpNN& pNHxHx <r$<C퀾~NhHxpC퀾~NN`HxpC퀾~N&<x*<N&<x*<NN"<cNA퀜NHxpC퀾~N&<x*<NfN' HxHxtC퀾~NhHxpC퀾~N&<x*<NfN&HxHxtC퀾~NhN' HxHx <r$<C퀾~NhNAZNnAZNJ&<x*<NfN'HxNlKill Process 2 Now?4HPN` Yes | No r"_ N+@ -SWHfN'Hx <r$<C퀸NN~NprBN.p3NNHxpC퀾~N&<x*<NfN(pNpNpNHxHxtC퀾~NhN(DpNpNpNHxHx <r$<C퀾~Nh <"<N <"<eNn <"<N <"<gN"NA`NnA`NJ&<x*<NfN)HxNlKill Process 3 Now?4HPN` Yes | No r"_ N+@ -SWHfN)Hx <r$<C퀸NN~N?<NNTAlNnA H0A 0 A 0A =0AlNJ&<x*<NfN)ANJNHANJL8NAN^A퀮Np CNxp CNxBpCN,HxpCN,HxpCN,HxpCN,HxpCN,HxpCN,HxpCN,HxpCN,HxpCN,Hx pCN,Hx pCN,Hx pCN,Hx pCN,HxNl by CNPHxNl John B. Holder4CNPHxNl# 1987 Marathon Computer Press4CNPHxN` CNPHxN` InstructionsCNPHxN`& Press either the right mouse buttonCNPHxNl'or the number keys 1,2,3 to kill activeCNPHxN`(processes. The Dispatcher will continueCNPHx N`&to service the processes until all areCNPHx N`(extinguished. As you will see GFA BasicCNPHx N`(can keep several processes going at onceCNPHx Nlwith very little degradation.aCNPpN pNpNpNpNpNANF/ANF"NA NF/ANF"NnpNpNpNANJ&<x*<NN/ANJ&<x*<NN"N <r$<A N2NN/ <r$<AN2NN"NnANF/ANF"NA NF/ANF"N"pNpNpNpNpNANJ&<x*<NN/ANJ&<x*<NN"N <r$<A N2NN/ <r$<AN2NN"N"AlNJ&<x*<NfN/pNpCNNpNp NAr 00N/4pNpCNNpNpNAr 0AlNJ&<x*<NfN/AN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n/(N:XJ1&gp-@ nB .N^NuNV/.NXJ1&gpN^NupN^NuNV/.aXN^NuNV/. /.NPN^NuNV .1opN^Nu y1 .ѹ11 N^NuNV/.aX-@JgN^Nu | N^NuNV 911ѹ1#11#4j#4b#4n#4f N^NuNVa-@JfpN^Nu /./94>azP n-@Jfp-@ . dN```4`L`XJ fDA"n"`(  f*A"n"`  fA"n"`A:"n"`  fA"n"`A"n"`  f. .r/@B///r/r/N/O #1&/.aXJ1&WDHHLN^NuNV .r/@///r/rA/N/O#1&JWDHH N^NuNVJfB/./. /.aON^Nu"n QB/./. / NON^NuNVJfp//./. /.a`ON^Nu"n Qp//./. / NON^NuNVH Jf pLN^NuAJ$n"Rg pLN^Nup". /. n/(/. /p/pB/N/OLN^NuNVJgp@`p?r$.". v/A////./ n/(v//-@N/O-@Jj #1&pN^Nu .N^NuNVBp/N/P n pN^NuNVB .l& n HH/r/r/N/O R` .N^NuNVB .l& n HH/r/r/N/O R` .N^NuNVv . lS`p}@A r//r/r /N/Op /p/p/N/O .HHr-Ax-@| .|T".xl>6@w f| w .wf .xUDN^Nu .xU n wRx` .| }l n  .|RN^NuNVB .lP n @HH fp /p/p/N/O .HH/r/r/N/O R` .N^NuNVJg .`pN^NuNVB . l" @8nJf @8n N^NuR`pN^NuNV nBN^NuNV. am zn aAN^Nu. N^NuNV. HH/aX.HH/@aX/fp`pN^NuNVp-@p-@p-@-@ n JgR`B . nJg n@JgR =g ,f .S".f .N^Nu .R.HH n HH//-@a2PJfB. ,g =f p-@p-@ .,fRR`^Jg .S".f .N^NupN^NuNVH p-@r-Ar -A n-@-@-@ -f pR-@ nHH/@R @4vgh 0fp0-@ nHHR-@ nHHR"@4vg$ .r N0FHHRЁ-@` n .fHRB nHHR"@4vg$ .r N0FHHRЁ-@` n lf pR-@B nHHrHkfNf`ne``g`Pc`*s`o`Xx`u`8d`Jg"n QX-P` "n QX-PJj(p-@` Jg"n QX-P` "n QX-Pp -@ .r N0-AJjDS .0". .r N0-@Jf fS .-A .r -A-H`vJg"n QX-P` "n QX-Pp-@S . @4B . .-@JfA .r-A-H`Jg"n QX-P` "n QX-Pp -@S .0". .-@JfA .r -A-H` f-|"n QX"P-Iгf-|4RB .lP nJgDR`Ap-@$n"RX @-H` p-@`B`p-@` pLN^NuJgJg .ܰl-n .BJgH .S-@Jk n R"nR` .S-@Jk\ n R .` .S-@Jk n R .` .S-@Jk n R"nR` n nR LN^Nu fp-@ mp` .-@R WDHHHnHnHn// n/N+BO nPA".-@-A-HJjD fJg mp`p-@JgSp-@JgRJg* .R".Ё-@Jk .ѮJg@R`: .\ѮJj .D` .-@ coR oRJf4 .ܰo* . .S-@Jk . n R R`Jg n -R JgJjp n 0R.R-H .S-@Jk .R-@Jj n 0R ` .S-@Jk n"n RR ` n 0R ` .SJk0 .S-@Jk n"n RR ` n 0R `Jg n .R .S-@Jk: .S-@Jk n"n RR ` n 0R ` .S-@Jk n"n RR ` n 0R n .R .S-@Jk0 .S-@Jk n"n RR ` n 0R ` n ER-H Jj-R D` n +R p -@S .r N00 . .r N0-@ nJf . lR n R ` f4 .ܰo* . .S-@Jk . n R R` n nR LN^NuNPNQH0$h "N.BiBi/f$h&( S`RB3BHB3BBF4)g\jVBk Bia`Ha2Ri`tiaaSiJkSi`BBBF/gaJFf BfSi`0 RB Bkv$( Jg(<iSBk:x Bl281  9o"0 R1 1 SBjRiSCzgR$hG0 gSD6CkxQJCk0Q$hBJigS$hB2)H$L NYNXNuBfNu|H0$&҃тdRL Nu/t?<@ B m RSWfO$NuNPNQH~0pr3@3@3@3@at 0fi ` -f iaV 0m> 9n8i 3F <)i/gRi`a:<) ҆Bц` .f Jif`Ri` eg efNa +g -f ia 0m. 9n(:)iFi im?)_ f $hB`4)?)_gDBi/gT3|?Jk Si`Jig ktia\adSi`aRi`t4)?)_gN/$h$$$h$p0)L~NYNXNu,(g !|NuH$hN<L?3FS fiNu?)_g|Nu$fprt`"HBHBB/t Q$Nu//gdB Jf BB /g$RB/fJjRd R`SBgBo Bl(J?BBHB_HB&Nu/<N/p`/<N/0<HBBH@B@Or`NV#9N^NuNVH*OB1&pn@N?.*?.&?."?.?.?.?.?. NA.ML?N^NuH<*g2jD(g(jDBv㒴eRQ"jDjD`BBL %s ############################################################# # The GFA Basic .LST File Linker # # (c)1987 Marathon Computer Press # # All Rights are Reserved # # Beta Vers 1.0 # ############################################################# Now Linking Files: rwaaCan't open stdin file Can't open stdout file con:CON:prn:PRN:lst:LST:lpt:LPT:lpt1:LPT1:aux:AUX:com:COM:com1:COM1:rdr:RDR:pun:PUN:nul:NUL:null:NULL:CON:AXI:,AXO:,LST:,NIL:,CON:=*4"0123456789ABCDEF ((((( H ((((( H _32KERRNO4Z_INAME0_DOS0FREOPEN IO_CONOU CLOSE_FWRITEIO_LSTOU_FRMVXCEXITLSEEKPRINTFCXVDF,ALLMEM&CXM330FSETBUFARGV5_DNBS3B_FLSBF GETSCB!BANNERRSTMEM_NUFBS5z_FOPENIO_CONINCXVFD+B_BUFSIZ4^PUTSARGC5CREATUNLINK4FINDARG!WRITEPFCLOSE $BLDMEM._FSEEK^_MAIN_CXGEM/FOPEN_OSERR1&CXFNM5/_FCLOSE:IO_DISCI_PFMT"RLSML_MNEXT1STRCMP0_FILBF _MBASE1_ONAME0SBRK_CTYPE4v_MNEED4VLSBRKRBRK_STACK5FREESCB!R_MSIZE1_BASEPAG1*SETNBF REMOVEX_FPERR9CXD330GETMEM_FCREATSHOWFILEj_FREADMAIN_IOB6 EXIT^_UFBS9CXFXT5._MELT4j_FMODE5~IO_NIL!IO_AUXOUHCXFERR/FPUTSd_TSIZE1"CAPITALC!`COMPCH!_IOMODE4rSIZMEM_POOL4bERRORP_EXITjDEVNAMES4>RLSMEMOPENREAD"GETMLIO_AUXIN*B H*"4 *&( (:"  .  "  (    PV ( $  :$  :":V:l&$@j$&:P(J.z    ,$ , Xd`$  J $2 40 & 0  F H 4 T<@HF D@.x" August 15, 1987 GFATIP07.DOC by John B. Holder Senior Software Engineer Marathon Computer Press Asst. Sysop on GEnie's MichTron Roundtable This is the 7th in a planned series of GFA Tip files. The topic of this issue is source code control and .LST file linking. Before we get into the nitty gritty of the subject, a bit of background is necessary first. In most of the heavy duty languages such as C, Modula 2, Pascal, and Assembler there is usually a utility that will either help you to track a project's progress as you develop it and thereby allowing total control over a modular development project. In the UNIX(tm) world there are many utilities to aid you in this pursuit. They are TOUCH, MAKE, and DIFF to name just a few. Since Marathon Computer Press is always working on a multitude of projects at any time, it is easy for one of our staff programmers to be involved in more than one project at a time. Speaking for myself, I am sometimes working on 3-4 at a time, so source code control becomes a paramount concern. How many times have you been working on a programming project, and have to set it aside for a week or two, then when returning you don't remember where you were at or file names appear different? If you've been programming for more than just a short time, this will occur rather frequently unless you are much more organized than the bulk of us. How does this pertain to this GFA Tip file? Well, I personally found a need for some sort of scheme to store my various GFA Basic source code files when they began to approach 3 Megabytes, so I decided to devise a storage & linkage scheme. Since my GFA Environment is on an ATARI SH204(tm) hard disk, I chose not to use ARC.TTP to archive my files since room was not really a concern. The main concern for me was keeping track of the massive amounts of files, and then how to bring them all together in a programming project without having to use the GFA Basic editor to first Save a .LST file then load a .BAS file and merge the two and save the new .BAS file composed of the two parts. Sound pretty complicated.... Well it's not really, but then again anything that will save time is very important to me. Being in the computer software business I have learned to associate time with money. I would like to offer a few suggestions to you and make a few points concerning source code control before going into the mechanics of GFALINK.TTP. Suggested DO's 1. Always set the current Date & Time on your system before starting a programming session. 2. Set up separate directories for your .LST, .BAS, and .PRG files. ( And use them religiously! ) 3. Keep good control over .BAK files and delete them when they are no longer necessary. 4. Move files that you no longer really use to a backup storage floppy diskette. ( Makes more room to work with on your primary working drive ) By following the above suggestions, you will have about 60% of the battle licked, but there is more... With the introduction of PASCAL in the early 70's, C in the mid 70's and Modula in 1976 people were introduced to structured programming. Some of the concepts presented by Prof. Niklaus Wirth of Swiss Federal Institute of Technology, (ETH, Eidgenossische Technische Hochschule) have established him as the father of the Structured Languages. His most notable accomplishments include PASCAL and his latest successor to that language, MODULA 2. These languages set themselves apart from the earlier languages such as FORTRAN (1956), and BASIC (Circa 1962), by differing radically from these venerable old beasts in a multitude of ways. In the earlier languages the primary Control Structure was the GOTO command. The use of these structures caused the execution of the programs to jump back and forth within code at any whim of the programmer, thereby making it extremely difficult both to trace the code and to identify errors. Hence, the word Structured Programming came from the Strongly Type Checked languages of Pascal and Modula 2. The use of procedures within a program allowed a logical flow of control within a program and was the tool whereby code was made infinitely more readable and maintainable. This art has improved over the years, and now Prof. Wirth's latest endeavor lends itself totally to the modular programming concept, alas the name of Modula 2. With Modula 2 everything is a Module, and procedures are the main structures within the module. You may ask, how does this pertain to GFA Basic? Well, the systems programmers at GFA Systemtechnik set out to develop a new Basic that would retain the better parts of the original forms of Basic, yet incorporate the better parts of the Structured languages such as Pascal or Modula 2. However, they did not provide any source code control utilities other than the GFA Basic Interpreter's own inherent editor. They left the control of code up to you. That's where the Linker comes in... GFALINK.TTP Instructions and usage I found it infinitely more manageable to use GFA Basic's structure to help me build libraries for use with my projects. By this I mean that I set up my environment by building little software chips in the form of procedures and put them on the shelf so to speak, ready to be pulled off the shelf and used in any project I chose. How do you accomplish this task? It's so simple, you'll be doing it in no time at all. Just develop a procedure to accomplish a specific task, such as a time changing routine, a drive map routine, or whatever. Next, snip out the procedure using the Mark Block and Write Block routines within the GFA Basic Editor. Save the procedure as a .LST file in your .LST folder, (previously established). By doing this you have created a procedure for your current project, but you have also set aside that tiny little software chip to use on another day with another project. This saves you a ton of time in either trying to reinvent the wheel in a new project or searching through reams of code you created earlier trying to find the elusive routine that you need now. This practice of building library functions or procedures to be used at a later date is a corner stone of Modula and the newest of the structured programming languages, ADA. If you want to create your own libraries from programs you have created and are currently in .BAS file format, then use the editor to snip out and save those procedures in .LST file format, ready to be merged in a future endeavor. A word of caution is in store here. You should identify all of your variables and strings within the procedure at the top either in REM statements or a series of Equates. Example: Procedure Do_this_thing Rem Created 8/15/87 A_number=100 A_string="This is the Do_this_thing Procedure" . . . Body of the procedure Return ! Do_this_thing Procedure By doing this you will have to take a bit more time, but it will save you many headaches by not having to try to find out why a variable keeps getting changed, (If it's used in another procedure). Keep track of your LOCAL variables also, because you are sure to crash your system if you call or try to use a LOCAL variable outside of the Parent Procedure. Now you might say "Gee .. Thanks for the advice, but I still don't understand what GFALINK.TTP will do for me!". For those people here is the answer: Place a copy of your GFALINK.TTP program in your .LST folder along with all of the modules that you have created, (by storing procedures in .LST file format with the GFA Basic editor). Any time in the future, if you need to use say 4 or 5 of your software chips, it's as simple as double clicking on GFALINK.TTP and entering the following on the command line: file1.lst file2.lst file3.lst newfile.lst Next click on OK and your files will be joined effortlessly for you into the file you name as "newfile.lst", or whatever you want your output file to be named. In essence it has performed a multi-file merge without using the GFA Basic Editor and having to step through the Merge+File select box+OK for each of the files you choose to "link together". Warnings: 1. Be sure to give the last file in the command line a unique name, (One different from all other .LST files within the directory), or you'll erase the old file. Also don't forget to give the "newfile.Lst" name or the last file in the link will be replaced by the newly created LINK'ed file. 2. The GFALINK.TTP file must reside in the same directory as all files to be included in the link, or the link will fail. Suggestions: For the most successful use of GFALINK.TTP, I would suggest that you get a good CLI (command line interpreter), such as MichTron's DOS Shell by Timothy Purves. Since the command line that appears from the desk top is limited, you can only merge a few files at a time in this manner. However, with DOS Shell, (or a CLI) you can enter many many more files into the link at a single time. It will all depend on the CLI and how many characters can be on a single command line. Dos Shell can allow up to 128 characters on a command line. Or you may choose to automate a GFALINK sequence with a .BAT file. A Bat file allows you to enter a number of commands in a file to be sequentially executed by the CLI when called on. For those that dabble with C, this procedure gives a GFA Basic programmer the ability to create his own form of UNIX's(tm) Make Utility. You could create a Makefile.Bat to be executed by a CLI. In this makefile you would call on GFALINK.TTP to link several modules for you and then chain to either the compiler or interpreter. You will have to refer to the instructions that come with your CLI to see how to set up .BAT files and execute GEM programs. For example DOS Shell uses the command RUN to execute a GEM(tm) program such as the GFA Basic Compiler or Interpreter. Technical Aspects of GFALINK.TTP Since this program is not GEM(tm) based it can be run from most CLI's without having to rename it with a .PRG suffix, and will normally not require any special pre-command to execute. The Linker itself was created with the Lattice C vers. 3.03.04 compiler. C was chosen to enable the reading of commands (file names) passed to the program from a shell (CLI). The linker will accept up to 26 files in the link, but this may be limited by the length of the file names and the command line buffer. I would suggest that you only attempt to link 10-15 files at the maximum in a single step. If you have more you can do a series of linking actions. Just use the subsequent "newfile.lst" as the first file in the second step linking command. Just be sure to name the next output file as something different that the first such as "newfile2.lst" instead of "newfile.lst" to prevent spooling on top of the first file in the successive link. The linker is very fast, but is I/O intensive. No buffers have been established so there is not a burden on memory in most cases. Very Large Files will take a long time in the link so be patient. It should still save you time compared with the GFA Basic Merge process even if you have exceptionally large .LST files in your link. It was designed to link files in the 1K to 25K size range, but will work with any size file. You will find that GFALINK.TTP will link together any data files or ASCII files you might desire to join, so you may use this utility elsewhere. It will not successfully merge GFA Basic .BAS file format files, so don't try. It'll join them for you, but the editor will not recognize any files beyond the first. Disclaimer: As with any program that writes data to your disk, you should read the operation instructions presented above thoroughly before trying to use GFALINK.TTP. It will do what you tell it to, so be sure all of the filenames are unique on output, or it'll write over an existing file. This program has been placed in the public domain as a Free of Charge utility. You accept full response for the use of the program and it's your responsibility to decide it's applicability for fitness for a particular purpose. Neither myself, nor MCP will be responsible for any damages to your equipment, files, or computer resulting from the use of this Public Domain Utility Program. (c) Copyright Notification This utility is a copyrighted utility program by the name of GFALINK.TTP. (c)1987 Marathon Computer Press, All rights are reserved. It has been placed in the public domain for the exclusive use of Legal owners of GFA Basic, and the GFA Basic Compiler only. It may not be distributed in any Public Domain program package that any fee at all is assessed. You may post it on any BBS that you choose, however if you want to sell it as a part of any package you must contact: Marathon Computer Press P.O. Box 68503 Virginia Beach, Virginia 23455 If you liked this program, drop us a letter at the above address. We'd like to hear from you. Or drop us an EMAIL letter on : Genie = GRIFJOHN CIS = 75766,505 I hope that at least some of the concepts presented in this GFATIP file will help you to be a more productive programmer, and if the GFALINK.TTP program will help you then all the much better. I've included the Press Release for The GFA Basic Companion(tm) at the bottom of this Doc file because the concept is graphically carried out by the Source Code Generator within the Companion. It's truly destined to make you change the way you think about programming in GFA Basic. Besides I thought I'd try to get a commercial in since I had your attention. Have fun! John B. Holder Press Release ***************************************************************** For further information contact: Gordon Monnier President, MichTron For Immediate Release: MichTron announces the release of The GFA BASIC Companion, a dedicated RCS package designed to create dialog boxes and more for GFA BASIC programs. GFA BASIC owners now have a new, incredibly useful tool available that will cut the time and annoyance often (if not always) associated with programming in GEM with BASIC. Already the possessors of the best BASIC available for any computer, GFA users can now build Radio Button Boxes, Dialog Boxes, Help Text Boxes, Sliders, Error Boxes, and more with The GFA BASIC Companion. They can even design their own custom boxes with the companion's amazing dialog box source code generator. Best of all, these objects, once created, are stored in GFA BASIC's ASCII.LST file format so they can be studied, modified, or merged into a GFA BASIC program. The GFA BASIC Companion Dialog box source code generator produces quick Dialog Boxes easily so even the newest programmers can give their programs an elegant, professional look, but the Custom Design Option gives the total control and creativity necessary to satisfy the hungriest of "power users". The GFA BASIC Companion will change the way you think about programming in GFA BASIC on the ST. You'll find that by using several of the GFA BASIC resident commands you can create a versatile user interface that will mimic routines available in the GEM AES, but in an adaptive format that is easier to learn and change. Altering one of these routines is simply a matter of loading the BAS. or LST. file into the GFA BASIC Editor and changing the desired portions in a real time mode that allows immediate testing of all your changes. This isn't possible in a standard RCS, such as the one included in the ATARI ST developers kit. Consider the time that will be saved and the headaches that will be cured by such an interface. Other attractions of The GFA BASIC Companion include an extensive online Tutorial that may be viewed from a window, or printed out for further study. A demonstration of this amazing product can be Downloaded from the CompuServe ATARI 16 libraries or from GEnie's Michtron Roundtable. If you would like to take a look at the capabilities of The GFA BASIC Companion, you may send for a Demo Disk. Specify color or monochrome and send five dollars ($5) to : MichTron,Inc. 576 South Telegraph Pontiac, Michigan 48053 (313) 334-5700 The GFA BASIC Companion is an exciting addition to your library of GFA BASIC products and is available from MichTron for $49.95. -END- . + t.. + tHORSE BI2,t mHORSE2 BAS3t ` HORSE2 LST6t HORSE2 PRG:t Z.READ ME @t P 6;?;;o@?\???~|?x>??p>< 6;???_? ?>???p||?|> 6;??}g?0???w>p?x8?>|<1  6;?0?g????~<0??????<|x<8|p<`x 6;??'??????????<x0< 6;? 7>??????a?????n|<@? 6;?0???߃~????0o?|?>|~??> 6;?????<7?0'8p8<<0>? 6;?;??8p?????y?????<>p?<pGfABASIC 8HHHv "TAGXSWYQIBASANIMASCHLEIFEWARTECYCLE_ITWARTETEXTANIM,F%!!F!* F$(!!! F '>!z! LOADING...F'/!z!HorseFG r, horse.bi2 F7I!M! horse.bi2F rFF7I!M! \horse.bi2F FrEGFm'R!z!A F E_g_!M !M F r`F8MF $>!H!z! F! E FEHFE FF 6!!!F6!`!`!`F6!!!`F6!`!`!`FrFuEGFm0!F0!F s  FE;F  FE s/ FE;F  FE4!4!!Fr Clear screen area e0F Try to get rid of the screen glitches... J!4! F Here's where we get PUT horse image to the screen rESF t-F0! F tz FEzz F FE F u(F1!F  uFEF FE F uL+F1! F uH FE F FE F u)F0!F  upFEppF FE F sjF!sPRFFqF+F $\! ! !Fr$V!`! !Fr$T!@! !Fr(! !!FA.'C!`!ANIMATION with GFA-BASICF(!!!`F$'!(!Programmed by:F(!!!F*'!(!Carl-Christian MeyerF(!!!FJ'#!T!4Translated by: Thomas F. Collins, Las Vegas, NV, USAF(!!!@F@'!x!*Converted to Med Resolution by Terry WhiteF(!!!@FD' !!.GFA-BASIC: distributed in USA by MichTron Inc.F$ ! ! !GFl$!"! !GFl$!$! !BFl(!!!@F('p!+!Program-controls:Ft$(!!!@FrR' !4!<'+' = Horse moves forward ')' = Horse runs fasterFR' !<!<'-' = horse moves backward '(' = Horse runs slowerFN' !D!7 Pressing either Mouse button will exit programFo.F    zuGosub Text Deffill 0,0,8 Dim A$(9) Deftext 1,1,0,20 Text 190,125,"LOADING..." Text 350,125,"Horse" If Exist("horse.bi2") Open "I",#1,"horse.bi2" Else Open "I",#1,"\horse.bi2" Endif For T=1 To 9 Text 420,125,Str$(T) A$(T)=Input$(Cvi(Input$(2,#1)),#1) Next T Close #1 Pbox 190,100,500,140 ' A=40 Y=-100 S=5 Hidem Setcolor 3,0,0,0 Setcolor 1,7,7,7 Setcolor 2,0,0,7 Setcolor 0,7,7,7 Repeat For T=1 To 9 Add X,S Add Y,2*S If X>640 X=-187 Endif If Y>700 Y=-187 Endif Pbox Y,90,Y-2*S,150 ! Clear screen area Vsync ! Try to get rid of the screen glitches... Put Y,90,A$(T) ! Here's where we get PUT horse image to the screen B$=Inkey$ If B$="-" Add A,5 If A>1000 A=1000 Endif Endif If B$="(" Sub S,1 If S<0 S=0 Endif Endif If B$="+" Sub A,5 If A<-10 A=-10 Endif Endif If B$=")" Add S,1 If S>30 S=30 Endif Endif Next T For G=1 To A ! Adjustable delay due to 'A' Next G Until Mousek Showm End Procedure Text Box 110,10,520,75 Box 107,7,524,77 Box 106,6,523,78 Deftext 1,5,0,16 Text 195,28,"ANIMATION with GFA-BASIC" Deftext 1,0,0,7 Text 130,42,"Programmed by:" Deftext 1,1,0,8 Text 298,42,"Carl-Christian Meyer" Deftext 1,0,0,4 Text 163,53,"Translated by: Thomas F. Collins, Las Vegas, NV, USA" Deftext 1,0,0,6 Text 150,62,"Converted to Med Resolution by Terry White" Deftext 1,1,0,6 Text 138,73,"GFA-BASIC: distributed in USA by MichTron Inc." Box 40,160,600,199 Box 38,162,602,199 Box 37,164,603,388 Deftext 1,,0,6 Text 240,171,"Program-controls:" Deftext 1,0,0,6 Text 70,180,"'+' = Horse moves forward ')' = Horse runs faster" Text 70,188,"'-' = horse moves backward '(' = Horse runs slower" Text 70,196," Pressing either Mouse button will exit program" Return `.(Q` Efv*oMt m HPHUBg?<JNA(m)m -:gS)@ -OK1PC#HNHx?<HNA@)@l/?<HNA)@h&@)@XЬl)@d)@`ARCpr Ѝ"QHN(ALNHz2?< NA\pdAxr0XQ)K\NN "6NNNNTTTJrBjNuHz?<&NN\N|CAp$L Qp Nh9lrBlJpNNhpMNh9@pdAr 0Q0tr N9lNupealp`NuaN,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,SFSGFnHGnDDDk9DBlDEk9EBlFcllGcll0,lb 0,lcNuVpmrtA)HA)HNr|<N @xepw2A$JBjDFHB t`0QBl9F)lVTAtp 9| N2(g"P@g2RADAH""l`r2oZAe 1@#)I`Nuk1@Nup NN8"l`dpNAtrdJhk\QpaNH ld$l`"Hg: k&@0+R`g k#&@0+S@H3 Q&f)I`LNu?<?<NAXJgJgNAH@B pNA NuApNN$N $BS@kH2QNupC ұd"X0Pg"RA$D#Nu"X0NuNU@k0NupNu _0HpN _0HpNE ұeHHQ0)N$_$ZR@H`2QNu$Y0gHR@@"D%$X0P2g# R@%NupE $ $X0dP.gRG,D%pr Y2dP.gRG,D!p4Ae4v`VfANuNWHNuHRp` HRpJQfpNNq Y Qfd ЀЀNuNN&$_& if"QdփփHRN0NN~,Nq8DRzXEEg"7PNqR$HBJBgpNJgJigp`eetЂ`"ЀeЁdp`ЀeЀe"Ѕe$W.H@@NL"2` NqR YEjrd0` SjN" KC`e N8`d \N l\Ӭ\ NupNd d3 d# d# # d# # # # d# # # # # # # # dB` # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # QNu"p`tdbDA0Hg<<R@f|0HN *JFk*HQ/??<?NAXfX ENuJkpNp`p`\F( &I.` ??<NMXJ[j E&DNup`pJ@gHzZ?<&NN\NuB?< NA\Av ACLElp"Jg X\QC"C!/:@?< NA\NuLH!NuHx`(Hx`"Hx`Hx`Hx`Hx` Hx`Hx !4VxH A6@ Ni LHL|1R/:?< NApdK`HaJLxNNu)H9@Jp4NhP'J&f H LNu P&NuQ'` J,'fJ,&gHA#ȇeC! B,&LNu-W)K20, 8k8@ gJl&f"Nu , 8g"P 8 @/, 8N  8fQ 8J,'gNupB <``L@ H)l26)z @W , Jf`CfSHj-D@Hd0H@H 0H@0`fSC\fS , @a"C\fApNNNRHP?< NA\NuH@aa/a a Nu@0 9c^Nu| PC>$Error # ][Abort]\f.B &lX)K\)ld` lp ,BQjNup(N Division by zeroOverflowNumber not integer|-2147483648 .. 2147483647Number not byte|0 .. 255Number not word|0 .. 65535Square root only|for positive numbersLogarithm only for|numbers greater than zeroUndefined error Out of memory Function or command|not yet implemented String too long|max. 32767 characters Not GfA-BASIC V1.0 program Program too long|memory full|NEW Not GfA-BASIC program|file too short|NEWArray dimensioned twiceArray not dimensionedArray index too largeDim index too largeWrong number of indicesProcedure not foundLabel not foundOn Open only|"I"nput "O"utput "R"andom|"A"ppend "U"pdate|allowedFile already openFile # wrongFile not openInput wrong|not numericEnd of file reachedToo many points for|Polyline/Polyfill/Polymark|max. 128Array must have|one dimensionNumber of points too|large for arrayMerge - Not an ASCII fileMerge - Line too long|aborted ==> Syntax error|program aborted!Undefined label"Out of data#Data not numeric$Syntax error in data|unpaired quotes%Disk full&Command not allowed|in direct mode'Program error|Gosub not possible(Clear not allowed in|For-Next-loops or|Procedures)Cont not possible*Parameter missing+Expression too complex,Undefined function-Too many parameters.Parameter wrong|must be a number/Parameter wrong|must be a string0Open "R"|Record lenght wrong2Not an "R"-File3Only one Field per|Open "R" allowed4Fields larger|than record lenght5Too many Fields (max. 19)6GET/PUT|Field string lenght changed7GET/PUT|Record number wrongMENU error?RESERVE error@Pointer (*x) errorZLOCAL error[FOR error\Resume (next) not possible|Fatal, For oder Locald GFA BASIC V 2.0| Copyright 1986|GFA Systemtechnik GmbHf2 bombs - bus error|Peek or Poke possibly wrongg3 bombs - adress error|Odd word adress! Possibly at|Dpoke, Dpeek, Lpoke or Lpeekh4 bombs - illegal instruction|executed in machine codei5 bombs - divide by zero|in 68000 Machine Codej6 bombs - CHK exeption|68000 interrupted by CHKk7 bombs - TRAPV exeption|68000 interrupted by TRAPVl8 bombs - privilege violation|68000 interrupt by|execution of a|priviliged instructionm9 bombs - trace exeptionGeneral errorDrive not readyUnknown commandCRC error|disk check sum wrongBad requestSeek error|track not foundUnknown media|boot sector wrongSector not foundOut of paperWrite faultRead faultGeneral error 12Write protectedMedia change detectedUnknown deviceBad sector (verify)Insert other disk|(request)Invalid function numberFile not foundPath not foundToo many open filesAccess deniedInvalid handleOut of memoryInvalid memory block adressInvalid drive specificationNo more filesGEMDOS range error|seek wrong?GEMDOS internal errorInvalid executable file formatMemory block growth failure"l`Yd&-KNN8"l`YepN&#k"C-KN"Cփk փk2##`փk"`2`$Y8gHRDD*D%H8#$c2g# HRDD%H`A*nN pN,pN0pN4p CNNJpN pN$pN(pNtp}"<NpN LOADING...Npp}"<^NpN$Horse4NpN$ horse.bi2&N$NJBfN&XpINHPN$ horse.bi24r"_NN&xpINHPN \horse.bi2r"_NA 0 <r$<ANp}"<NpANNNpAN/prNN/p"NCNN"N`NqNqpNpd"<Np <"<NA 0A$ 0A 0N\pp@pW?<?<NN\pp@pW?<?<NN\pp@pW?<?<NN\pp@pWBg?<NN\A 0 <r$<AN <Ѝ/AN _N` <$Ѝ/ANNn _N`AN&<x*< N8fN(0A 0A$N&<x*< N8fN(`A$ 0A$NrZNrANNnA$NNHN"<NNvA$N??<ZANCNN"NNC6N0Hm6p-N"_NfN). <Ѝ/ <r$< _N`AN&<x*< N8fN).A z0 Hm6p(N"_NfN)~ <Ѝ/ <r$< _N\ANzN>fN)~BmHm6p+N"_NfN) <Ѝ/ <r$< _N\AN&<x*<N>fN)A 0Hm6p)N"_NfN*J <Ѝ/ <r$< _N`AN&<x*<N8fN*JA p0N`|NqN$VHgHNzNRNRp rnNppK"<NprkNppM"< NprjNppN"< NpN pN$pN(pNtp"<NpNANIMATION with GFA-BASICNppN pN$pN(pNtp*"<NpNProgrammed by:NppN pN$pN(pNtp*"<*NpNCarl-Christian MeyerNppN pN$pN(pNtp5"<NpN4Translated by: Thomas F. Collins, Las Vegas, NV, USANppN pN$pN(pNtp>"<NpN*Converted to Med Resolution by Terry WhiteNppN pN$pN(pNtpI"<NpN.GFA-BASIC: distributed in USA by MichTron Inc.Np <r(Np <"<XN <r&Np <"<ZN <r%Np <"<[NpN pN(pNt <"<NpN$Program-controls:4NppN pN$pN(pNt <rFNpN<'+' = Horse moves forward ')' = Horse runs fasterNp <rFNpN<'-' = horse moves backward '(' = Horse runs slowerNp <rFNpN$7 Pressing either Mouse button will exit program4NpN NR%&0@&4@&@In this ARC file, there are five files: 1. This READ.ME file, which can be shown to the screen or printer. 2. HORSE.BI2, the Medium-resolution version of the Horse image data. 3. HORSE2.BAS the GFA-BASIC source. 4. HORSE2.LST the ASCII-listed version of the GFA program, able to be listed to the screen or printer for your viewing. 5. HORSE2.PRG the compiled GEM-runnable program. I have taken the HORSE.BAS program from the original GFA-BASIC program disk, which was for monochrome systems only, and converted it to run on color systems, using the medium resolution mode of the ATARI ST! The HORSE.BAS file must be run with either GFABASRO.PRG or GFABASIC.PRG. DO NOT USE ST BASIC TO RUN THIS PROGRAM!!!! This program, when run, will show on-screen animation techniques using GFA-BASIC, from MICHTRON (USA). The HORSE.BI2 file must reside in the same directory or the disk's root directory. Follow the on-screen prompts for usage instructions. I hope you like GFA-BASIC as much as I do! Terry White, VAST/EAST member in the Washington,DC area July 26, 1987. GfABASICh. JJp l8z9p9:P:P:\:;;;(;D;D;D;DD0DOLENFULLATTR FILECOUNT FILESCOUNTEDCOUNTTEMPTIMESIZE GEMDOS_ERRORSTATUS BOX_1_XHI BOX_1_YHI BOX_1_XLO BOX_1_YLO BOX_1_XHI1 BOX_1_YHI1 BOX_1_XLO1 BOX_1_YLO1 BOX_2_XHI BOX_2_YHI BOX_2_XLO BOX_2_YLO BOX_2_XHI1 BOX_2_YHI1 BOX_2_XLO1 BOX_2_YLO1 BOX_3_XHI BOX_3_YHI BOX_3_XLO BOX_3_YLO BOX_3_XHI1 BOX_3_YHI1 BOX_3_XLO1 BOX_3_YLO1FOLDERFILEATIMMERBCBUFFILE_NAMEXTFILENAMEFULLNAMEA FORM_MONTHPATH SEARCH_PATHERRDTAFILE_PTRATTRIB FILECOUNTDATEATTRCOUNTLENFULLFULLSEPFILESIZE FOLDERCOUNT FILESCOUNTED FOLDERSCOUNTFOLDERSCOUNTEDDAYTEMPDATEMONTHYEARTEMPTIME ATTRIBUTE ATTRIBUTESERRREPORTSTATUS GEMDOS_ERROR COUNTFILE DOS_ERRORD0D1D3FETCH_DIRECTORY_ITEM_COUNTFOLDERSFILESFOLDERFILE COUNTFOLDERFOLDERSCOUNTES ITEM_COUNT NUM_FILES NUM_FOLDERSNUM_FILESCOUNTEDFILESIZEMONTHSFILENAMEFILESIZEFILEEXTEXT FULLENAMEFULLNAMEMONTHDAYMONTHS FORM_FILENAMEFORM_EXT FORM_FILESIZESTRFORM_DAY FORM_HOURS FORM_MINUTES FORM_SECONDS FORM_MONTH FORM_HOUR FORM_MINUTE FORM_SECONDEVERY_MONTH_OF_THE_YEARFILESIZETIMEDATEATTRMONTHYEARDAYSECONDSMINUTESHOURS OH_SKIP_IT OOOOH_SKIP_IT OH_SKIP_IT1GET_NEXTCATALOG_TO_ARRAYSBOX_1DRAW_BOXBOX_2BOX_3FORMATYF! 4 layout the array for the various directory data lEFI 8 These ararys are for "raw" data from the directory. FD Use data from THESE arrays for sorting , etc... as these are NOT N padded out with spaces or 0's . These are filled by the CATALOG_TO_ARRAYS - procedure. L NOTE : TIME%() & DATE%() arrays! Each element in these contain a single N integer number. These numbers should be used to make TIME and DATE J sequence comparisons (if such a thing is desired) by simple <> AN comparisons. That way you don't have to break down the secs, mins, hP yrs, months, etc yourself to compare times to times and dates to dates.  e8* ! ! ! ! ! ! ! ! F* ! !  F   H These arrays are for actual final dump to be viewed by human beings. L They have been padded with spaces or 0's and justified. These are filled  by the FORMAT procedure.  *  !  !  !  ! F* ! ! F  " EM*.*!H! F M F L Here we spill the Arrays that have been filled with our directory data! rR DDF <-------- -49 means NO MORE FILES, so we start dumping. EFFeZ  " "  " "  " " " "  ", " " " ":" ":" F4F4  F F n F$! THE VOLUME NAME IS " ".F) F&! THIS DISK HAS NO VOLUME LABEL F  F$! WE HAVE "  " ENTRIES...F8! CONSISTING OF " " FOLDER(S) and " " FILES. FF F " What do you think this is for?  LF cannot find!F F  eP---------------------------------------------------------------------------- . T ":Here is where the RAW info is put into GLOBAL arrays :  ON Filename$() Ext$() <---------- filename & ext broken up into these 8 Filesize%() <----------------------- size of file t< Attr%() <-------------------------- file attribute : oP 16=folder 8=volume 0=normal etc.... L Time%() Date%() <---------- integers, right off the disk .$ --------- --------- -$ Seconds%()0-29 Day%()1-31 & Minutes%()0-59 Month%()1-12 & Year%()1980-2044 Hours%()0-23  "0NOTE : Three other GLOBAL variables used are: @ Folderscounted% f> Filescounted% %L Fetch_directory_item_count% . &What this procedure needs GOING IN:  P Search_path$:String which contains path and file name. Can use wildcards. 4 example: "C:\DEGAS\PICTURES\*.P?C  L Attributes% :Integer which contains what attributes should be included H when searching for entries. You may not want folders, P or volume labels, etc.The procedure will not pick up any item H whose attribute is not selected. Set bits as follows: Lbit 0 1 2 3 4 5 P write protect Hidden system file volume label Folder Write & cls N ($01) ($02) ($04) ($08) ($10) ($20) l"Normal files are $00 (all off) 0Pexample: if you want normal & protected files,folders,and volume labels,then P Attributes%= ($00 hex) OR ($01 hex) OR ($08 hex) OR ($10 hex) = 25 decimal  @What this procedure has COMMING OUT (pointer to an integer): eD Gemdos_error%: Messege from Gemdos. -49 means finished Okay.  O <    <    +!! F h!!!!F<h!!!!F!  E FEF FE T P notice we start the filecount @ 1, not 0. We will use 0 for the volume name  lP the next 2 statements set up a 44-byte buffer(Buf$) and its' address (Dta%) E0 F Ez F lP Gemdos function $1A sets the disk transfer address. See ST INTERNALS, p.112 1P! F GR Default path string and its' memory location. Terminate with a null (chr$(0)) EB F Ez F DF Set file attributes we are looking for. See p.134 of ST Internals. N Here we set bit 1 for read only, bit 4 for volume, bit 5 for subdirectory 0EHHF  HJ Note this mid$ command. I had to put this in to clear out the filename J section of the DTA buffer, otherwise the previous characters were not wR erased and a new smaller name would be simply added to the older larger name. N You don't believe me? Awww. Comment this out, run it, and you'll know what P I mean. For more info on the DTA buffer contents, see p.135 of ST INTERNALS. &!p!P E F IJ Now we start dipping into the directory. This is the SFIRST function, RR otherwise known as Gemdos $4E. See p.134 of ST INTERNALS. Remember (I didn't) P that BEFORE you can use this function you have to tell Gemdos where you want N the info to go by calling SETDTA as we did above with Gemdos $1A. Note the N pointer to our search path(File_ptr%) goes in first then the Attributes we N are seeking (Attrib%). Use this function to get the ball rolling with the N first directory entry. Then, each subsequent entry and all its' properties L can be called up every time a call is made to the SNEXT function, below. E!! F cP The D0 will contain any error codes resulting from either an SFIRST or SNEXT L call. Here we are checking to see if no files have been found (as if you H couldn't figure that one out). See p.139 of ST INTERNALS for Gemdos e< error codes. Any error always returns a negative number.  F!file not foundFqF F eNThe Get_next routine is envoked to get the next directory item. I am doing gPit an oddball way, first I get the contents from the DTA buffer, then I make .Na call to SNEXT and refill it again. That way I can use the REPEAT...UNTIL eNloop which is fastest for the compiler to execute. I know because I tested eNit against the other loop commands, and REPEAT is the speed demon. So here eNwe are fetching from the buffer what the above Gemdos $4E call put in, then HGet_next fetches the new directory entrys' info into the DTA Buffer. n h ----------------------  JWe fetch the file attribute (read only, subdir, hidden, etc) from byte i821 in our DTA buffer. Notice, Peek = BYTE operation. n E2(( F 1LHere we grab the filename PLUS extender found in the DTA buffer from byte 431 thru byte 43 (that's 12 bytes from 31 folks). E?@x@@ F NLet's not use those wierd entries which are just "." or ".." that appear in Lthe directories. I can't figure out what those are for, can you? They are Lalways listed as SUBDIRs (file attribute= 16) and I don't know of anyone <who would name thier files with an extender only. So .... $ V#  #;@ . F-F- F hJHere we try to seperate the extender from the main filename. If the dir Lentries are to be sorted, the seperate extenders may be nessesary. Also, t@I prefer to lay out the filenames so they line up. I do this Jby padding with spaces. Note how this is done with the LEFT$ function. h E6 FEC@. F@ F <------------- does the filename contain a period? H ^ F<---- is this a sub-directory? Add parentheses. "  EF04 F <---- add one to our subdirectory count  .FEF  F<<----- is this a VOLUME label? Only 1 per dir! 6 EF so we asign it to the 0 cell in the array 6-F- and we don't care to pad this one. e *FE, now we are down to just a regular file.  E?@@ FD Below we want to find a null at the end of the extender and 2 strip it out. It interferes with padding.   C @B F" !C @B ! EB F F E?@@ F4 FA F F N BFE OK, so the filename DOES NOT have an extender. It's now simpler. m &  F<---- SUBDIR? a E()F4 FA >FE,  F<<---- volume label? U  EF-F :FE  EF<---- normal file l4 FA F F F < E4PP F<---- Note, longword for file size! 18 E3@@ F<---- Note, word for date and... * E300 F<---- ... for time  @ Now we extract time and date info and put'em into an array. 4 E #x FDAY are bits 0-4 (1-31) d E F3!F0 E#p FMONTH are bits 5-8 (1-12) 3 E F3! F> E##~~ w FtYEAR is bits 9-15 (add 1980) 6 E #x FSECONDS are bits 0-4 (0-29) d,2 !Fmultiply by two for correct val - E F3!F2 E#| FMINUTES are bits 5-10 (0-59) 3!F2  E#x FHOURS are bits 11-15 (0-23)  4F|FF F JNow we clear the filename section of the buffer, as mentioned earlier. e&!p!P E F oLThis is the SNEXT function I was talking about. This puts the next entry .into the DTA buffer. cE F---------------  eLHere is the big loop. We keep putting directory entry info into our array Puntil D0 (Gemdos error code) is negative, which PROBABLY means no more entrys Nbut we should stop no matter what the error, so we just test for any error. F---------------  JWe fetch the file attribute (read only, subdir, hidden, etc) from byte i821 in our DTA buffer. Notice, Peek = BYTE operation. n E2(( F 1LHere we grab the filename PLUS extender found in the DTA buffer from byte 431 thru byte 43 (that's 12 bytes from 31 folks). E?@x@@ F NLet's not use those wierd entries which are just "." or ".." that appear in Lthe directories. I can't figure out what those are for, can you? They are Lalways listed as SUBDIRs (file attribute= 16) and I don't know of anyone <who would name thier files with an extender only. So .... $ #  #;@ . F-F F hJHere we try to seperate the extender from the main filename. If the dir Lentries are to be sorted, the seperate extenders may be nessesary. Also, t@I prefer to lay out the filenames so they line up. I do this Jby padding with spaces. Note how this is done with the LEFT$ function. h E6 FEC@. F@ F <------------- does the filename contain a period? H  F<---- is this a sub-directory? Add parentheses. "  EF04 F <---- add one to our subdirectory count  bFEF L F<<----- is this a VOLUME label? Only 1 per dir! 6 EF so we asign it to the 0 cell in the array 6-Fs and we don't care to pad this one.  ^FE, now we are down to just a regular file.  E?@@ FD Below we want to find a null at the end of the extender and 2 strip it out. It interferes with padding.  @C @B F" !C @B ! EB F F E?@@ F4 FA F F N vFE OK, so the filename DOES NOT have an extender. It's now simpler. m &  F<---- SUBDIR? a E()F4 FA rFE, D F<<---- volume label? U  EF-FE nFE  EF<---- normal file l4 FA F F F < E4PP F<---- Note, longword for file size! 18 E3@@ F<---- Note, word for date and... * E300 F<---- ... for time  @ Now we extract time and date info and put'em into an array. 4 E #x FDAY are bits 0-4 (1-31) d E F3!F0 E#p FMONTH are bits 5-8 (1-12) 3 E F3! F> E##~~ w FtYEAR is bits 9-15 (add 1980) 6 E #x FSECONDS are bits 0-4 (0-29) d,2 !Fmultiply by two for correct val - E F3!F2 E#| FMINUTES are bits 5-10 (0-59) 3!F2  E#x FHOURS are bits 11-15 (0-23)  4F|F- JNow we clear the filename section of the buffer, as mentioned earlier. e&!p!P E F oLThis is the SNEXT function I was talking about. This puts the next entry .into the DTA buffer. cE F FEF S B.F ------------------------- End of CATALOG_TO_ARRAY procedure m    L ------------------------------------------------------------------------ 0This procedure formats for "pretty printing"  h  a>  needs integer, Total count of files u +% FB Now we're going to format everything and put them into arrays *@@ F  EJANF  EFEBF  EMARF EAPRF  EMAYF@ EJUNF` EJULF EAUGF ESEPF  EOCTF0 ENOVF@ EDECFhF EFF$  E;  @ F  E;  @ F$  E= A @` F  E= A @ F E F<We don't need to format years, that's always four digits!  E=00A  @ F E=00A @ F E=00A @ F4F %FF F.F *l X0660103030566 9[....................................................] FiguresandprogramsincludedinthisSampleChapter: Figures: Figure3-1.OrganizationofScreenMemoryforMonochromeDisplay. Figure3-2OrganizationofColorScreenMemory Figure3-3.CartesianCoordinateSystem Figure3-4PolarCoordinateSystem Figure3-5.RasterCoordinateSystem Figure3-6.NormalizedDeviceCoordinate(NDC)System Figure3-7.TheMandelbrotPrimitive Figure3-8.MandelbrotFigure Figure3-9.ANotherSegmentoftheMandelbrotBoundary. Programs: Program3-1.LINEDRAW.PRG Program3-2STRING.BAS Program3-3.KALEIDO.BAS Program3-4.DRAGON.BAS Program3-5.MANDELBROT.BAS Program3-6.NEOWRITE.BAS Program3-7.NEOLOAD.BAS Chapter3 STGraphics Duringthelate1950sandearly1960s,theMassachusettsInstitute ofTechnoloy(MIT)wasthecenterofthecomputerworld,an academiccommunityactivelyinvolvedintheresearchand constructionofsupercomputersystems. In1963,IvanSutherland,ayounggraduatestudentworkingon hisdoctoraldissertationatMIT,couldoftenbeseenworkingfar intothenightattheterminalofagiantmainframecomputer.He wasn'taloneinhislabors.Otherstudentsdoingresearchon computershadtousethelate-nighthours,whenthemainframes weren'tbeingusedforotherpurposes,forexploringthelimitsof thisfledglingscienceofcomputers;thetechnologyfor microcomputershadnotevenbeendeveloped. Sutherlandwroteandrewrotehislinesofcode.Aftermuch revision,hewasfinallysuccessful.Themonitordisplaycleared, andagreenlineappeared:Thefirstcomputergraphic,astraight line,hadbeenproducedbythegiantmainframe.Notmuchby today'sstandards,butthisoccasionmarkedthebeginningofa wholenewartform--computergraphics. ThissinglestraightlineevolvedintotheSketchpadline- drawingprogram.Sutherland'searlydrawingprogramallowedthe usertopointatthescreenwithalightpentosketchobjects. Thissimplesystemwasthepredecessoroftoday'scomplex computer-assisteddrawing(CAD)programs. Alothadtohappentocomputers,however,before sophisticatedcomputergraphicscouldbecomeareality.Fora whilecomputersremainedtheexpensivetoolsofgovernmentand universities.In1965,IBMintroducedthefirstmass-produced cathoderaytube(CRT),butthepricewasmorethan$100,000for theCRTonly.Thispricetagmadeentryintocomputergraphics practicallyimpossibleforallbutafewspecializedusers.In 1968,Tektronicsintroducedthestorage-tubeCRT,whichdisplayed adrawingbyretainingtheimageuntiltheuserreplacedit.This typeofdisplayeliminatedtheneedforcostlymemoryandhardware tostoreanddisplaytheimage,butthesellingpriceof$15,000 stillplacedtheCRTfarbeyondthemeansofmostusers. Itwasn'tuntilthelate1970sandearly1980sthatthe microcomputerindustryexploded,andcomputerwarsbroughtthe priceandpowerofthepersonalcomputerwithinthereachofthe middle-incomeperson. Soon,powerfulgraphicsprogramssuchasDEGASandNEOchrome hadintroducedmanypeopletothisnewartform,andsomeeven discoveredhiddentalents.Andnowthatcomputerarthasbecome accessibletosomanypeople,thosepeoplewanttomakethebest possibleuseofitspotential. Inthischapter,we'lltakeyoubeyondDEGASandNEOchrome, showingyouhowtodevelopandusethepowerfulgraphicsroutines builtintotheST.Previously,exploitationofthesefeatureswas ratherdifficult.MostprogrammersresortedtoCorassembly languageprogrammingwhensophisticatedgraphicswererequired. GFABASICdeliversthepowertofullyutilizethegraphics potentialofyourST.Stunninggraphicsareeasilyobtainedusing theGFABASICinterpreter,whiletheGFABASICcompilerallowsyou todeveloparcade-qualitygamesinBASIC,thenexecutethe programsfromtheGEMDesktopwithyourprogramrunningatspeeds rivalingthoseofassemblylanguage. ComputerGraphics Computergraphicsisagenerictermwhichreferstoanyimage createdwithacomputer.Thiscoversawiderange,fromasimple lineonamonitor,tointricatepicturesdevelopedwithdrawing programs,andmore.Somecomputerscientists,forinstance,are usingcomputerstocontrollaserswhichproduceholographic images.PerhapsthescenefromStarWarswhereC3POandChew-baka areplayingachesslikegamewithholographicimagesisn'teven thatfar-fetched. Themotionpictureindustry,inrecentyears,hasused computergraphicsextensively.ThetransformationoftheGenesis planetinStarTrekII,TheWrathofKhan,wasaneffectproduced withfractalgraphics--oneofthemostfascinatingareasof computergraphics(andonewhichwe'llexplorelaterinthis chapter).DisneyStudiosmergedrealactionwithcomputer- generatedgraphicsinthemovieTRON.TheLastStarfighterhas25 minutesofspectacularcomputerimagery,witheachframerequiring dozensofalgorithmsandhundredsofintricatedesigns.Infact, suchmovieshavecontributedtothebirthofanewindustry devotedtoenhancingcomputer-generatedgraphicstechnology,with oneoftheleadersinthisnewindustrybeingLucasfilm,apioneer inspecialeffectssincetheStarWarstrilogy. AlthoughholographicimagingandHollywood-typespecial effectsarebeyondthescopeofthisbook,itwillshowyoua fascinatingworldopentothosewhoknowthepoweroftheST. GraphicsCapabilities Goodgraphicsrequireaminimumofahigh-resolutiondisplayanda largenumberofcolorstoworkwith.Somerumorsarebeginningto circulateaboutcomputersforhomesandbusinesseswithmonitors capableofdisplayinguptoonemillion--1000X1000-- pixels.Currentlyonlydedicatedgraphicsworkstations,suchas theSunortheCrayII,offersuchcapabilities,andbothofthese arepricedfarbeyondthehomeenthusiast'sbudget.Althoughthe STdoesn'thavethecapabilitiesofadedicatedgraphics workstation,itiscapableofdisplayingupto256,000pixels,for afractionofthecost.Plus,thepaletteof512colorsmakesit idealforproducingcolorful,excitingdisplays. InordertoprogramgraphicsontheST,it'snecessaryto understandalittleaboutthewaythescreenisdisplayed.Onthe monochromescreen,eachpixel(pictureelement)isrepresentedby asinglebitofmemory.Eachbitwillbeeithera0ora1, indicatingwhethereachpixelisofforon,respectively.Screen memoryisorganizedsothatthefirstbyterepresentsthe8 pixels,ordots,atthetopleftcornerofthescreen.Each succeedingbyterepresentsthenext8pixelsinsuccession.Each screenlineconsistsof640pixels,sothefirst80bytes(80 times8)representthetoprowofthescreen.Sincethereare400 linesofpixelsverticallyonthescreen,atotalof256,000bits areusedtorepresentthemonochromescreen.Thismeansthat 32,000bytesofscreenmemoryareusedtostorethedisplay. BinaryDecimal 000 011 102 113 Figure3-1OrganizationofScreenMemoryforMonochromeDisplay. Colorscreenmemoryisorganizedinmuchthesamewayas monochromescreenmemory,butinsteadofsinglebitsrepresenting singlepixels,groupsofbitsareusedtorepresenteachpixel.In mediumresolution,apixelmaybeoneoffourcolors.Twobitsare usedtocreatethefourpossiblecolors: Thefirstbyteofscreenmemoryrepresentsthefirstfour pixelsattheupperleftcornerofthescreen.Thetwohigh-order bitsspecifythecolorinthefirstpixel,thenexttwobits representthecolorinthesecondpixel,andsoon.Thereare640 pixelsperrow;eachrowrequires160bytesofmemory.Sincethere areonly200verticalrowsofpixels,only32,000bytesofmemory arenecessarytostoreascreen. Inlowresolution,apixelcanbeoneof16colors,sofour bitsarerequiredtorepresentasinglepixel. 0000=01000=8 0001=11001=9 0010=21010=10 0011=31011=11 0100=41100=12 0101=51101=13 0110=61110=14 0111=71111=15 Eachbytedescribesthecolorofonly2pixels.Butagain, sincethereareonly320pixelsperline,and200verticallines, only32,000bytesarerequiredtorepresentafullscreen. Figure3-2OrganizationofColorScreenMemory Asmentionedpreviously,theSTiscapableofdisplaying512 colors,butonly16colorsmaybedisplayedatonetime(inlow resolution).Eachvaluestoredincolormemorycorrespondstoa hardwarecolorregister. InGFABASIC,thecommandCOLORdefinesthecolortobeused byagraphicscommand.Ifyoudonotspecifyacolorbeforea graphicscommand,eitherthedefaultcolororthecolorlastused isselected.Usually,thedefaultcoloriscolor1,whichhasa defaultvalueofblack,0. GraphicsProgrammingTechniques Entirebookshavebeenwrittenaboutthevariousphasesof computergraphics.Eachsectionofthischaptercouldbedealt withinmuchgreaterdetail.Instead,we'regoingtointroduce you,quicklyandpainlessly,tographicstechniques,pointyouin therightdirection,andthenleaveyoutotheexcitementof discoveryasyouexplorethisworldwithyourstaunchally,GFA BASIC. Aswithanyvoyage,somepreliminaryattentiontodetailmust beundertaken.Afterall,tousethegraphicscommands,youmust atleastbeabletotellthecomputerwhereyouwanttheobject you'redrawingtoappear. Thereareseveralcoordinatesystemsinuse,butthetwomost commonaretheCartesiancoordinatesystemandthepolar coordinatesystem. IntheCartesiancoordinatesystem,thetwo-dimensionalplane isassignedtwoaxes:thehorizontalaxis,usuallylabeledx,and theverticalaxis,usuallylabeledy.Byconvention,thepositive directionofthex-axisistotheright,butthepositive directionofthey-axiscanbeeitherupordown,dependingonthe application.Ingeometryandmostothermathematicalapplications, thepositivedirectionofthey-axisisup,butonmostcomputer systems,thepositivedirectionisdown.Pointsintheplaneare representedbyorderedpairs(x,y),wherexisthedistanceofthe pointfromthey-axisandyisthedistanceofthepointfromthe x-axis.Thepoint(0,0)iscalledtheoriginbecauseitisthe pointwherethexandyaxesintersect,thepointfromwhichall otherpointsintheplanearelocated. Thelocationoftheoriginisanotherdisputedaspectofthe Cartesiancoordinatesystem.Ingeometry,theoriginis traditionallylocatedinthelowerleftcornerofthedisplaywith thepositivexandyaxesextendingtowardtherightandtopof thedisplay,respectively.However,onmostcomputers,theorigin islocatedintheupperleftcornerofthescreen,becauseofthe waythemonitordrawsthedisplay.Anotherpossiblelocationfor theoriginisthecenterofthedisplay.Thisorientationmakesit easytographbothnegativeaswellaspositivevalues-- somethingtheothertwosystemsignore.Eitheroftheselocations isequallyvalid,andconversionfromoneorientationtotheother issimple,sothechoiceofwhichsystemtouseisusuallyleftup totheuser. Figure3-3.CartesianCoordinateSystem Figure3-4PolarCoordinateSystem TheCartesiancoordinatesystemcoorespondscloselywiththe realworld,whichmakesitidealformostapplications,butin situationswhererotationisnecessary,theCartesiancoordinate systemisdifficulttouse.Twosystemsofreferencingarein commonusewithcomputers:thenormalizeddevicecoordinate(NDC) system,andtherastercoordinate(RC)system .TheNDCsystemaddressesthegraphicsdisplayindependentofthe device'sdisplaysize,whiletheRCsystemaddressesthedevicein actualdisplayunits.TheRCsystemisthesystemusedonmost microcomputers.Withthissystem,thescreenisdividedintorows andcolumnsofdots,orpixels.Thepixelsinthetoprowhavea vertical,ory,coordinateof0.Theycoordinateincreasesasyou movetowardthebottomofthescreen.Thebottomrowofthescreen hasaycoordinatevalueof199onacolorsystemand399ona monochromesystem.Theleftmostcolumnofpixelshasahorizontal, orx,coordinateof0. Thexcoordinateincreasesasyoumovetowardtherightedge ofthedisplay,whereeachpixelintherightmostcolumnhasthe valueof319oncolorsystemsinlowresolutionand639inmedium orhighresolution.  Figure3-5.RasterCoordinateSystem TheSTalsosupportstheNDCsystem.It'sdifficulttowrite asingleprogramthatwillworkwiththedifferenttypesof devices,becausealmosteverygraphicsoutputdevicehasa differentmaximumhorizontalandverticalresolution.That'swhere theNDCsystembecomesexpedient. TheNDCsystemofferstheprogrammerameansbywhichgraphics drawnononecomputerscreenorprinterwilllookthesamewhen drawnonothercomputerscreensorprintersofdifferent resolutions.WiththeNDCsystem,allgraphicsoutputissentto animaginarydevicethatis32,768pixelswideand32,768pixels high.ThesepixelsaregroupeddifferentlyfromthoseundertheRC system.Theyaxisbeginswith0atthebottomofthescreen,and movesuptothetoprowofpixelsnumbering32,767.AsintheRC system,thexaxisisnumberedfromlefttoright.Theleftmost columnofpixelsis0,andtherightmostcolumnis32,767. Twocoordinate-referencingsystemsononecomputermayseem difficulttograsp,butusuallyyou'llonlybedealingwiththeRC systeminGFABASIC.YoushouldbeawareoftheNDCsystem,asit doeshavevaluewithGDOSandsomeVDIfunctions. Figure3-6.NormalizedDeviceCoordinate(NDC)System Resolvingaproblem TheSTmaybeconfiguredinlowresolution(320x200pixels) andmediumresolution(640x200pixels)withacolormonitor,orin highresolution(640x400pixels)withamonochromemonitor.It's veryeasytoincludeasimplecheckfortheresolutionmode,then useprogrammodulesapplicableforthresolution.It'seven possibletoaffectachangeofresolutionfromGFABASICbyusing anXBIOSfunction.Attheveryleast,youshouldincludeacheck inyourprogramtodeterminewhichmodeofresolutionthecomputer isdisplaying.Ifnecessary,youcanthendisplayanAlertbox informingtheuserthattheprogramrequiresadifferent resolution.Goodprogrammingpracticedictatesthatyourprogram becompatiblewithdifferentsystems,ifpossible.Especiallywith programsthatusegraphics,theeffectyou'velaboredtocreate willbelostifthepropermodeofresolutionisn'tselected. XBIOSisagroupofextendedinput/outputfunctionswhichare availabletotheprogrammer.FormoreinformationaboutXBIOS routines,refertoAppendixF.GFABASICmakesthesefunctions availabletoyoubyusingthesamebindingsasthoseusedby programmersworkinginC.RefertoAppendixFforalistofthe XBIOSfunctionsandbindings. Tochecktheresolutionofasystem,XBIOS4,calledgetrezin mostliteratureabouttheST,canbeused. PROCEDUREcheck_rez ' rez=XBIOS(4) ' RETURN Thisprocedurewillreturnthescreenresolutioninthe variable,rez: 0=lowresolution(320x200,16colors) 1=mediumresolution(640x200,4colors) 2=highresolution(640x400,monochrome) Tochangeresolutionmodes,usethefollowingprocedure.Define rezequaltothevalueofthedesiredresolutionthencall set_rez.(Note:highresolutionisonlyavailablewitha monochromemonitor.) PROCEDUREset_rez ' dummy=XBIOS(5,L:-1,L:-1,W:rez) ' RETURN Switchingfrommediumtolowresolutionwillpresentnospecial problems.However,whenyouforceaswitchfromlowresolutionto mediumresolution,graphicscommandswillnotappearontheright sideofthescreen.Theoperatingsystemstillassumesthatvalues greaterthan319forXareoffthescreen.Meanwhileallgraphics withXcoordinateslessthan320,willbeshown,ontheleftside ofthescreen.UsingthePRINTcommandtodisplaytextshould presentnoproblem. GFABASICGraphicsCommands Asthefollowinglistofgraphicscommandsillustrates,GFA BASICprovidesapowerfulandeasytouseprogrammingenviornment. MoreinformationaboutthesecommandscanbefoundinChapterTwo, GFABASICCommandsandFunctionsorinAppendixA,QuickReference GFABASICGlossary. BITBLT BOX CIRCLE CLEARW CLOSEW CLS COLOR DEFFILL DEFLINE DEFMARK DEFMOUSE DRAW ELLIPSE FILL FULLW GET GRAPHMODE HARDCOPY HIDEM INFOW LINE MOUSE MOUSEX MOUSEY MOUSEK OPENW PBOX PCIRCLE PELLIPSE PRBOX PLOT POINT POLYLINE POLYFILL POLYMARK PUT RBOX SETCOLOR SGET SHOWM SPRITE SPUT TEXT TITLEW VSYNC Graphicsona2-dimensionalsurface ThesimplestofthegraphiccommandsinGFABASICaretheline drawingcommands.ThesimplestoftheseistheLINEcommand. Remember,thecoordinatesusedbytheLINEcommandandtheother GFABASICgraphicscommandsareintheRasterCoordinate(RC) System. Figure3-7.SimplegraphicproducedbyProgram3-1usingGFA BASIC. Thefollowingshortprogramdemonstratestheeasewithwhicha simplegraphicscreencanbedevelopedusingtheLINEandBOX commands. GFABASIClistingsforthisbookhavebeenproducedbyfirst selectingthediritemontheEditor'smenubar,thenentering, DEFLIST0,whichcausesallcommandsandfunctiontobedisplayed (andprintedLLIST)inallcapitolletters.Variablenamesand namesofprocedureswillbeinlowercaseletters. Program3-1 LINEDRAW.PRG 'SimpleLineDrawingDemo ' LINE0,100,150,100 LINE500,100,640,100 BOX150,50,500,150 LINE325,25,150,50 LINE325,25,500,50 BOX295,80,355,150 BOX175,90,255,130 LINE215,90,215,130 LINE175,110,255,110 BOX390,90,470,130 LINE430,90,430,130 LINE390,110,470,110 ' Inordertomakethescreenalittlemoreinteresting,we'll useDEFFILLtoselectapatternstyleandcolorstobeusedbythe FILLcommand.FormoreinformationaboutDEFFILL,oranyotherGFA BASICcommand,refertoChapterTwo. DEFFILL3 ' FILL5,195 ' DEFFILL1,3 FILL330,30 ' DEFFILL1,2 FILL5,5 ' DEFFILL2,2 FILL155,55 ' DEFFILL2,1 FILL310,115 Theimageproducedwillonlyflashonthescreen,then disappearastheeditscreenreappearswhentheprogramends.We needtoplaceGFABASICintoaloopwhichrepeatsuntilwedecide it'stimetoexittheloop(andtheprogram)andsendasignalto theinterpretter.AllthatisneededisaREPEAT...UNTILloop whichwillwaitforanykeytobepressed.Whenakeyispressed, theprogramends. ' REPEAT UNTILINKEY$<>"" END Generally,we'llbediscussingeachroutineusedinaprogram, ratherthantheindividualcommandsusedtoobtainthedesired result.Ifamoredetailedexplanationofacommandorfunctionis needed,refertoChapter2orAppendixA. StringArt Onlyashortstepfromlinedrawingisaninterestingartform, StringArt.StringArtmaybeeitherasuccessionofpoints connectedbylines,orasequenceoflinesdrawnonthescreen. ComputergeneratedStringArtmayeventaketheformoflines dancingaroundthescreen,asinthisprogram.STRING.BASwill draweachscreenandthenwaitfortheusertopressakeybefore continuing.Thelastscreenpromptstheuserforapositive number.Thisnumberdetermineshowmanypetalstodrawonarose. Originallyweintendedthisparttoworkonlywithintegers, butwediscoveredthatsomeveryinterestingpatternsdevelopif youentercompoundnumbers(numberswithafractionalpart).Try severaldifferentvalues.STRING.BASwilldisplaytherosefor eachandthenwaitforyoutopressakey.Ifyou'dliketostop thedrawingprocesstoanytime,pressakey.Whenthedrawinghas stopped,pressingakeywillpromptyouforanewnumber.Enter0 toexitSTRING.BAS.TheLINEcommandisusedtodraweachofthe screens. Program3-2.StringArt ThefirstthingStringArtdoesischeckthecurrentscreen resolutionandsettheglobalvariablesx_sizeandy_sizetothe widthandheightofthescreen,respectively. 'WhatresolutionistheSTin? 'xbios(4)returns0iflow,1ifmedium,and2ifhigh resolution rez=XBIOS(4) ' 'setx_sizetothewidthandy_sizetotheheightofthescreen ' IFrez=0 x_size=320 y_size=200 ENDIF IFrez=1 x_size=640 y_size=200 ENDIF IFrez=2 x_size=640 y_size=400 ENDIF ' STRING.BASiswrittensothateachscreenisdrawnbya separateprocedure;thismakesiteasytodeletesomeofthe existingscreensoraddnewonesofyourown.Aftereachscreenis drawn,STRING.BASwaitsforanykeytobepressedbeforeitclears thescreenanddrawsthenextscreen. GOSUBscreen_1 GOSUBwait_key CLS GOSUBscreen_4 GOSUBwait_key CLS GOSUBscreen_2 GOSUBwait_key CLS GOSUBscreen_3 GOSUBwait_key CLS GOSUBscreen_5 ' END TherestofSTRING.BASconsistsoftheproceduresusedin calculatingoractuallydrawingthefigures. ' ' 'PROCEDUREwait_key ' 'Thissubroutinepausestheprogramuntiltheuserpressesa key. ' PROCEDUREwait_key REPEAT UNTILinkey$<>"" RETURN!endofwait_key Thefollowingprocedureconvertstheradiusandthetavaluesof polarcoordinatestoCartesiancoordinates.Seethesectionon coordinatesystemsearlierinthischapterfordetails. ' ' 'PROCEDUREpolar_to_rect ' 'Thisprocedureconvertsfromthepolarcoordinatesystemtothe 'rectangularcoordinatesystem.Passr(radius)andthetato 'polar_to_rectanditwillreturnthexandyvaluesintheGLOBAL 'VARIABLESxandy. ' PROCEDUREpolar_to_rect(r,theta) x=r*COS(theta) y=r*SIN(theta) RETURN!endofpolar_to_rect ThisroutineisusedtodrawtwoofthescreensinSTRING.BAS, bycalculatingthevaluesnecessaryfortheendpointsoftheline totracealimacon.Procedurelimaconisusedintheprocedures screen--1andscreen--2.Thefirstparameteroflimaconisthe anglethetaforwhichtheradiusistobecalculated.Thenexttwo parametersareconstantswhichmodifytheshapeofthelimacon. Youmightfinditinterestingtoplayaroundwiththeseconstants. ' ' 'PROCEDURElimacon ' 'Thisprocedurereturnsthevalueofr(radius)necessarytodraw 'alimacongiventheangleofthetaandtwoscalingfactors,mandn. 'NOTE:risaGLOBALVARIABLE. ' PROCEDURElimacon(theta,m,n) r=m+n*COS(theta) RETURN!endoflimacon Procedurerosegeneratesoneoftheprettiestpatternspossible usingpolarcoordinates.Itsoutputisusedinscreen5. ' ' 'PROCEDURErose ' 'Thisprocedurereturnsthevalueofr(radius)necessaryto draw 'arosegiventheangletheta,thenumberofleaves,n,anda scaling 'factorm.ndeterminesthenumberofleavesintherose.Ifnis even, 'thentherosewillhave2npetals;ifnisodd,therewillben leaves. 'NOTE:risaGLOBALVARIABLE. ' PROCEDURErose(theta,n,m) r=m*COS(n*theta) RETURN endofrosedenominatorisusedinscreen--5todeterminehow muchoftheflowertodraw.Thedenominatorreturnedbythis procedureisusedtocalculatetheupperlimitofthefunction beforeitisplotted. ' ' 'PROCEDUREdenominator ' 'Thisroutinereturnsthedenominatorofanumberwitha fractionalcomponent. ' PROCEDUREdenominator(num) LOCALk LOCALa LOCALb ' k=1 found=0 a=num GOSUBdenom(a) IFfound=0 a=num/SQR(2) GOSUBdenom(a) ENDIF IFfound=0 a=num/SQR(3) GOSUBdenom(a) ENDIF IFfound=0 a=num/SQR(5) GOSUBdenom(a) ENDIF IFfound=0 a=num/PI GOSUBdenom(a) ENDIF IFfound=0 a=num/PI^2 GOSUBdenom(a) ENDIF IFfound=0 a=num/EXP(1) GOSUBdenom(a) ENDIF IFfound=0 a=num*PI k=PI GOSUBdenom(a) ENDIF IFfound=0 a=num*PI^2 k=PI^2 GOSUBdenom(a) ENDIF IFfound=0 k=1 ENDIF ' d=b*k RETURN ' ' 'PROCEDUREdenom ' 'Thisroutineactuallycalculatesthedenominatorofthefraction. ' PROCEDUREdenom(a) LOCALc LOCALdun c=ABS(a) b=1 REPEAT dun=0 b=b/c c=(1/c)-INT(1/c) IFb>100000 dun=1 ENDIF UNTILc<1.0E-06ORdun<>0 IFdun<>1 b=INT(b) found=1 ENDIF RETURN Theremainingfiveproceduresactuallydrawthescreens.Each ofthemiswelldocumantedinthecodesowewon'tgointodetail onthem. ' ' 'PROCEDUREscreen_1 ' 'Thisproceduredrawsthefirstscreenusingtheprocedures, 'NOTE:thefollowingvariablesareGLOBAL:rez,x_size,andy_size. ' PROCEDUREscreen_1 LOCALsteps LOCALy_scale!yscalingfactor LOCALx_scale!xscalingfactor LOCALl_limit!lowerlimitoffuntion LOCALu_limit!upperlimitoffunction LOCALx_inc!xorthetaincrement IFrez=0 steps=1000*PI ENDIF IFrez=1 steps=2000*PI ENDIF IFrez=2 steps=4000*PI ENDIF ' y_scale=y_size/2 l_limit=0 u_limit=2*PI x_scale=x_size/2 x_inc=x_scale/steps ' FORtheta=l_limitTOu_limitSTEPx_inc GOSUBlimacon(theta,y_scale*3/4,y_scale*3/4) GOSUBpolar_to_rect(r,theta) x1=x y1=y GOSUBlimacon(theta,y_scale*3/4,-y_scale*3/4) GOSUBpolar_to_rect(r,theta) x2=x y2=y IFrez<>1 LINEx1+x_scale,y1+y_scale,x2+x_scale,y2+y_scale ELSE LINEx1*2+x_scale,y1+y_scale,x2*2+x_scale,y2+y_scale ENDIF NEXTtheta RETURN!endofscreen_1 ' ' 'PROCEDUREscreen_2 ' 'Thisproceduredrawsthesecondscreenusingtheprocedures, 'NOTE:thefollowingvariablesareGLOBAL:rez,x_size,andy_size. ' PROCEDUREscreen_2 LOCALsteps LOCALy_scale!yscalingfactor LOCALx_scale!xscalingfactor LOCALl_limit!lowerlimitoffuntion LOCALu_limit!upperlimitoffunction LOCALx_inc!xorthetaincrement IFrez=0 steps=250*PI ENDIF IFrez=1 steps=500*PI ENDIF IFrez=2 steps=1000*PI ENDIF ' y_scale=y_size/2 l_limit=0 u_limit=2*PI x_scale=x_size/(u_limit-l_limit) x_inc=x_scale/steps 'ferp FORtheta=l_limitTOu_limitSTEPx_inc GOSUBlimacon(theta,y_scale*9/14,y_scale) GOSUBpolar_to_rect(r,theta) x1=x y1=y GOSUBlimacon(theta,y_scale*9/14,-y_scale) GOSUBpolar_to_rect(r,theta) x2=x y2=y IFrez<>1 LINEx2+x_size*15/16,y2+y_size/2,x1+x_size/16,y1+y_size/2 ELSE LINEx2*2+x_size*15/16,y2+y_size/2,x1*2+x_size/16,y1+y_size/2 ENDIF NEXTtheta RETURN!endofscreen_2 ' ' 'PROCEDUREscreen_3 ' 'Thisproceduredrawsthethirdscreenusingtheprocedures, 'NOTE:thefollowingvariablesareGLOBAL:rez,x_size,andy_size. ' PROCEDUREscreen_3 LOCALsteps LOCALy_scale!yscalingfactor LOCALx_scale!xscalingfactor LOCALl_limit!lowerlimitoffuntion LOCALu_limit!upperlimitoffunction LOCALx_inc!xorthetaincrement IFrez=0 steps=500*PI ENDIF IFrez=1 steps=750*PI ENDIF IFrez=2 steps=1000*PI ENDIF ' y_scale=y_size/2 l_limit=0 u_limit=8*PI x_scale=x_size/2 x_inc=x_scale/steps ' FORi=l_limitTOu_limitSTEPx_inc x1=SIN(i)+1 x2=SIN(i-3*PI/4)+1 y1=COS(i*3/4)+1 y2=COS((i-3*PI/4)*3/4)+1 LINEx1*x_scale,y1*y_scale,x2*x_scale,y2*y_scale PAUSE1 NEXTi RETURN!endofscreen_3 ' ' 'PROCEDUREscreen_4 ' 'Thisproceduredrawsthefourthscreenusingtheprocedures, 'NOTE:thefollowingvariablesareGLOBAL:rez,x_size,andy_size. ' PROCEDUREscreen_4 LOCALsteps LOCALy_scale!yscalingfactor LOCALx_scale!xscalingfactor LOCALl_limit!lowerlimitoffuntion LOCALu_limit!upperlimitoffunction LOCALx_inc!xorthetaincrement IFrez=0 steps=250*PI ENDIF IFrez=1 steps=500*PI ENDIF IFrez=2 steps=1000*PI ENDIF ' y_scale=y_size/2 l_limit=0 u_limit=5*PI x_scale=x_size/2 x_inc=x_scale/steps ' FORi=l_limitTOu_limitSTEPx_inc x1=SIN(i)+1 x2=SIN(i-3*PI/4)+1 y1=COS(i*5/6)+1 y2=COS((i-3*PI/4)*5/6)+1 LINEx1*x_scale,y1*y_scale,x2*x_scale,y2*y_scale PAUSE1 NEXTi RETURN!endofscreen_4 ' ' 'PROCEDUREscreen_5 ' 'Thisproceduredrawsthefifthscreenusingtheprocedures, 'NOTE:thefollowingvariablesareGLOBAL:rez,x_size,andy_size. ' PROCEDUREscreen_5 LOCALsteps LOCALy_scale!yscalingfactor LOCALx_scale!xscalingfactor LOCALl_limit!lowerlimitoffuntion LOCALu_limit!upperlimitoffunction LOCALx_inc!xorthetaincrement IFrez=0 steps=500*PI ENDIF IFrez=1 steps=1000*PI ENDIF IFrez=2 steps=4000*PI ENDIF ' y_scale=y_size/2 l_limit=0 x_scale=x_size/2 ' PRINT"Thisroutinedrawsflowerswiththe" PRINT"numberofpetalsthatyouspecify." PRINT"Ifyouenteranoddnumber,n,aflower" PRINT"withnpetalswillbedrawn.Ifyou" PRINT"enteranevennumber,n,aflowerwith" PRINT"2npetalswillbedrawn.Flowerswith" PRINT"largenumbersofpetalslooklike" PRINT"filled-incircles,sokeepyournumber" PRINT"small.Youcanstopthedrawingatany" PRINT"bypressingakey.Whenthedrawinghas" PRINT"stopped,pressanykeytocontinue." PRINT REPEAT INPUT"Inputapositivenumber(0toquit)";n UNTILn>=0 WHILEn>0 CLS u_limit=1 d=1 IFINT(n)<>n found=0 GOSUBdenominator(n) u_limit=d ENDIF IFODD(n*d)ANDODD(d) u_limit=PI*u_limit ELSE u_limit=2*PI*u_limit ENDIF steps=2000*PI*n x_inc=x_scale/steps theta=l_limit a$="" WHILEtheta<=u_limitANDa$="" GOSUBrose(theta,n,y_scale)!rosereturnsr GOSUBpolar_to_rect(r,theta)!polarreturnsxandy x1=x y1=y GOSUBrose(theta-PI/(3*n),n,y_scale) GOSUBpolar_to_rect(r,theta-PI/(3*n)) IFrez=1 LINEx1*2+x_scale,y1+y_scale,x*2+x_scale,y+y_scale ELSE LINEx1+x_scale,y1+y_scale,x+x_scale,y+y_scale ENDIF theta=theta+x_inc a$=INKEY$ WEND GOSUBwait_key PRINT"PreviousNumber=";n;"(";n*d;"/";d;")" REPEAT INPUT"Inputapositiveinteger(0toquit)";n UNTILn>=0 WEND RETURN!endofscreen_5 Kaleidoscope Here'sacolorfuldemonstrationprogramreminiscentoftheLava Lampspopularduringthe1960s.Youmayhaveseenaversionofths programrunningontheCommodoreAmiga,orevenaClanguage versiononthST.KALEDIOSCOPE.BASrunsfromtheGFABASIC interpretter.Thisprogramalsodemonstratestheuseofsomenew graphiccommands.Notethat"!"separatesacommentfromthe commandonthesameline.Also,the'markisusedinlineswhich containonlyacomment.Inthisprogramyou'llseecolorspelled twoways;colorandcolour.ColorisaGFABASICcommandwhich setsthecolortobeusedbyagraphicscommand,andthein-line Syntaxcheckerwillinterpretitassuch.Oftentousea descriptivelabelorvariablename,it'sadvantageousto deliberatelymis-spellaword.Besuretokeeptrackofsuchmis- spellings,andmis-spellthewordthesamewayeverytime. Program3-3.KALEDIO.BAS Beginbyreservinganareaofmemorytoholdthealternate palettecolors. DIMpalette(15),pal(15),pal2(15) ' shape=0!Initialshapeisacircle. HIDEM!Hidemouse ' ' 'Checkforlowresolution ' IFXBIOS(4)<>0 alrt$="KALEIDOSCOPEonlyworksin|LowRes(320X200Pixels)" ALERT3,alrt$,1,"Oops!!",b END ENDIF Next,setupanalternatecolorpalette.Eachcoloris representedbythreehexadecimalnumbers,representingthethree colorgunsofanRGB(Red,Green,andBlue)monitor,rangingfrom 0foragunwhichisturnedoff,to7foragunatthehighest outputlevel.Youcanexperimentwiththenumbersonthefollowing tabletoobservetheeffectsofdifferentnumbersonthedisplay. (FormoreinforamtionaboutcolorsandtheSETCOLORcommand,refer toChapter2.) YoucanusetheControlPaneldeskaccessorytogetinstant feedbackonmixingcolors.Whenyouuseittomixcolorsusing differentlevelsofred,green,andblue,thepaneldisplaysthese colorlevelsasnumbersfrom0to7.Thedesktop,andtheCOntrol Panel,willchangecolorsasyouchangethesettings.It'sbestto writedownthenumbersdisplayedasyouproceed,asitmaybecome necessarytoturnoffyourSTandrebootinordertorestorea readablescreen.Usethesenumbersasthehexadecimalvaluesin thefollowingtabletoinstallthecolorsinyourcolorpalette, asdemonstratedbelow. ' ' 'Setupcolortable ' pal2(0)=&H555 pal2(1)=&H700 pal2(2)=&H60 pal2(3)=&H7 pal2(4)=&H5 pal2(5)=&H520 pal2(6)=&H50 pal2(7)=&H505 pal2(8)=&H222 pal2(9)=&H77 pal2(10)=&H55 pal2(11)=&H707 pal2(12)=&H505 pal2(13)=&H550 pal2(14)=&H770 pal2(15)=&H555 ' Nowwe'lldisplayanAlertboxcontainingtheprogramtitleand afewpiecesofnecessarypreliminaryinformation.Usually,you won'twanttouseanAlertboxfordisplayinganythingexcepta warning,butinthiscaseverylittleinformationisrequired. Noticethatasyoutypeinthetextforthevariablealrt$the screenwillscrolltotheleft.Whenyoumovetothenextline,a dollarsignisdisplayedatthepointwherethetextexceedsthe 80characterscreenlimit.Thisdollarsignsignifiesthatmore textexistsonthisline . ' 'Displaytitlebox ' alrt$="Kaleidoscope|LeftButtonRestarts|RightButton ChangesShape|BothButtonsEndProgram|" ALERT1,alrt$,1,"Okay",b ' Sinceweplantotamperwiththecolorscheme,itwouldonlybe politetoprovideameanstoresetthecolorswhenweendour program. GOSUBsave_palette' 'Setcolor0,5,5,5!Setbackgroundtogray. ' GOSUBset_colour!Installnewpalette ' start:!Here'stherealstartingpoint ' GOSUBrestore_palette!Wewanttorestorecolorsformultipleruns 'otherwiseprintmightbehardtoread. CLS ' 'Dosomemorestartupstuff. ' PRINTAT(1,10); INPUT"Howmanypixels/step(1to10)";stp$ IFstp$="" GOTOstart ENDIF stp=VAL(stp$) ' IFstp<1ORstp>10!Checkforvalidrange. GOTOstart ENDIF ' minr=stp CLS FORcolour=1TO12 DEFTEXTcolour,17 GOSUBtitle NEXTcolour c=0 Thenextfewlinesdeterminethestartingpointforthefirst itemtobedrawn. x=INT(RND(1)*320) x1=x y=INT(RND(1)*179)+20 y1=y r=minr dr=1 ' 'Mainprogramloopfollows: ' REPEAT ' GOSUBnew_x GOSUBnew_y ' DEFFILLc INCc IFc>15 c=1 ENDIF IFdr=1 INCr ENDIF IFdr=0 DECr ENDIF IFr=20 dr=0 ENDIF IFr=minr dr=1 ENDIF '  Nowdeterminewhichshape,circleorsquaretodraw;thendisplay thatshapeonthescreen. IFshape=0 PCIRCLEx,y,r ELSE PBOXx,y,x+r,y+r ENDIF ' GOSUBchange_colour ' k=MOUSEK UNTILk<>0 ' 'Leftmousebuttonpressed? ' IFk=1 GOTOstart ENDIF ' 'RightMousebuttonpressed? ' IFk=2ANDshape=0 shape=1!Changeshapetorectangle GOTOstart ENDIF ' IFk=2ANDshape=1 shape=0!Changeshapetocircle GOTOstart ENDIF ' PAUSE35!Systemneedsasecor2here. CLS GOSUBrestore_palette SHOWM END ' Nowweneedtofindanewvalueforx. ' PROCEDUREnew_x ' IFx1>=319 SUBx,stp ELSE ADDx,stp ENDIF ADDx1,stp IFx1>=643 x1=stp x=stp ENDIF RETURN ' Nextweneedanewyvalue. ' PROCEDUREnew_y ' IFy1>199 SUBy,stp ELSE ADDy,stp ENDIF ADDy1,stp IFy1>375 y1=28 y=28 ENDIF RETURN ' Thefollowingprocedureisausefulroutineyou'llseeoftenin thisbook.Itsavesthepaletteassetupbytheuserfromthe ControlPanel,sothatthedefaultcolorsmayberestoredwhenthe programends. 'SaveOriginalColorPalette ' PROCEDUREsave_palette LOCALi ' FORi=0TO15 palette(i)=XBIOS(7,W:i,W:-1) pal(i)=palette(i) NEXTi ' RETURN ' ' Here'stheprocedurewhichrestoresthedefaultcolorpalette. You'llseethisoneusedagain,too. ' 'RestoreOriginalColorPalette ' PROCEDURErestore_palette LOCALi ' FORi=0TO15 SETCOLORi,palette(i) NEXTi RETURN ' Togivetheillusionofconstantmovementonthescreen, we'regoingtorotatethecolorpalette.Thisproceduretakescare oftherotationsequence. PROCEDUREchange_colour ' temp=pal(1) FORi=2TO15 pal(i-1)=pal(i) NEXTi pal(15)=temp ' FORi=1TO15 SETCOLORi,pal(i) NEXTi FORi=0TO15 pal(i)=XBIOS(7,W:i,W:-1) NEXTi RETURN ' Hereisanotherroutinetodazzlethebeholder.Thisprocedure setsupthetitle"Kaleidoscope"toalternatecolorswithcolor cycling. PROCEDUREtitle IFcolour=1 TEXT95,7,"K" ENDIF IFcolour=2 TEXT105,7,"a" ENDIF IFcolour=3 TEXT115,7,"l" ENDIF IFcolour=4 TEXT125,7,"e" ENDIF IFcolour=5 TEXT135,7,"i" ENDIF IFcolour=6 TEXT145,7,"d" ENDIF IFcolour=7 TEXT155,7,"o" ENDIF IFcolour=8 TEXT165,7,"s" ENDIF IFcolour=9 TEXT175,7,"c" ENDIF IFcolour=10 TEXT185,7,"o" ENDIF IFcolour=11 TEXT195,7,"p" ENDIF IFcolour=12 TEXT205,7,"e" ENDIF RETURN ' Theset_colorprocedureisusedtoinstallourcustompalette whentheprogramintializes. PROCEDUREset_colour FORi=0TO15 dummy=XBIOS(7,pal2(i)) NEXTi RETURN TheDragonPlot Fractalshavebeenreceivingagreatdealofattentionin mathematicsandcomputergraphics.They'rebeingusedfor everythingfromsimulatingrandomplantgrowthtogenerating realisticplanetarylandscapesinsciencefictionfilms. Understandingfractalsmaynotbeasexcitingasseeingthem inaction,butsomeexplanationshouldprovehelpfultoyour programming.ThewordfractalwascoinedbyBenoitMandelbrot,a pioneerintheirstudy,todenotecurvesorsurfaceshaving fractionaldimension.Theideaoffractionaldimensioncanbe illustratedasastraightcurve(aline)whichhasonlyone- dimension,length.Ifthecurveisinfinitelylongandcurvesin suchamannerthatitcompletelyfillsanareaoftheplane containingit,thecurvecanbeconsideredtwo-dimensional.A curvepartiallyfillinganareahasafractionaldimensionbetween 1and2. Manytypesoffractalsareself-similar.Thismeansthatall portionsofthefractalresembleeachother.Thisoccurswhenever thewholeisanexpansionofsomebasicbuildingblock.Inthe languageoffractals,thisbasicbuildingblockiscalledthe generator. Thegeneratorinthenextprogramconsistsofanumberof connectedlinesegments.Thecurvesplottedbythisprogramarethe resultofstartingwiththegeneratorandthenrepeatedly replacingeachlinesegment,accordingtoadefinedrule.The numberofcyclesislimitedbythescreenresolution.Selecttoo highanumberofcycles,andtheprogramwillalsoslowdowntoa crawl.Eventually,thescreenwillbefilledbythefractal generator,asportionsareplottedoffthescreenaswell. Thissimpleprogramwhichbeginsourexplorationoftheworld offractalsplotsaparticulartypeoffractalwhichMandelbrot labeleda"dragonplot."Thisprogramillustratesaself- contactingcurve.Aself-contactingcurvetouches,butdoesnot cross,itself.Thegeneratorconsistsoftwo-linesegmentsof equallengthformingarightangle.Duringeachcycle,the generatorissubstitutedforeachsegmentonalternatingsidesof thesegments.(EventhoughGFABASICexecutesfasterthanmost interpretedlanguages,it'sstillslow,andthat'spartofthe fascinationofthedragonplot--watchingasyourSTplotsthe figure,andnotingtheareasofsimilarity. DRAGON.BASbeginsbyaskingyoutoenteranevennumberof cycles.Whenaplotiscomplete,pressinganykeyclearsthe screenandreturnsyoutothestartingprompt.Trystartingout withtwocycles,thenfour,thensix,andsoon.Asyouaddmore cycles,moretimeisrequiredtofillinthedragon. Program3-4.DRAGON.BAS DIMsn(20) in: CLS PRINT"Enteranevennumberofcycles(2-20)" INPUT"orenterazerotoquit:";nc$ nc=VAL(nc$) IFnc=0 END ENDIF IFnc<2ORnc>20 GOTOin ENDIF IFEVEN(nc)<>-1 GOTOin ENDIF l=128 FORc=2TOncSTEP2 l=l/2 NEXTc x=85 y=100 CLS COLOR3 PLOTx,y FORc=0TOnc sn(c)=0 NEXTc rot_seg: d=0 FORc=1TOnc IFsn(c-1)=sn(c) d=d-1 GOTOrotate_it ENDIF d=d+1 rotate_it: IFd=-1 d=7 ENDIF IFd=8 d=0 ENDIF NEXTc IFd=0 x=x+l+l GOTOseg ENDIF IFd=2 y=y+l GOTOseg ENDIF IFd=4 x=x-l-l GOTOseg ENDIF y=y-l seg: COLOR3 DRAWTOx,y sn(nc)=sn(nc)+1 FORc=ncTO1STEP-1 IFsn(c)<>2 c=1 GOTOnext_seg ENDIF sn(c)=0 sn(c-1)=sn(c-1)+1 next_seg: NEXTc IFsn(0)=0 GOTOrot_seg ENDIF PRINTAT(7,23);"Pressanykeytocontinue" REPEAT UNTILINKEY$<>"" GOTOin TheMandelbrotSet Youcanseefractalsinnatureinmanyplaces.Theclouds, coastlinesdisplayedinsatellitephotographs,andevenaleaf willrevealfractals.We'veseenoneformofcomputer-generated fractalsinProgram3-5,thedragonsweep.Nowwe'llexploreone ofthestrangestandmostbeautifulareasoffractalgeometry,the Mandelbrotset. TheMandelbrotsetconsistsofcomplexnumbers,numberswitha "real"and"imaginary"part.Theseterms,realandimaginary,have historicalsignificanceinmathematics,butarenolonger relevant.Acomplexnumbertakestheformof6+3i;6isthereal partofthenumber,and3irepresentstheimaginarypart(hence thei).Eachcomplexnumbercanberepresentedbyapointonthe two-dimensionalplane. TheMandelbrotsetislocatedatthecenterofatwo- dimensionalsheetofnumberscalledthecomplexplane.Whena specificoperationisappliedrepeatedlytothenumbers,the numbersoutsidethesetretreattoinfinity.Theremainingnumbers moveaboutwithintheplane.Neartheedgeoftheset,thenumbers moveaboutinapatternwhichmarksthebeginningoftheareaof instability.Thisareaisastonishinglybeautiful,complex, infinitelyvariable,andyetsomehow,strangelysimiliar. TheuniquefactorinnumberswithintheMandelbrotsetisthat valuesinthesetnevergrowlargerthan2asthemathematical operationisperformedonthem.PointswithintheMandelbrotset arerepresentedinourprogrambyblackpixels.Thecolorsofthe otherpointsaredeterminedbycountingthenumberoftimeseach complexnumberisoperatedonbeforeitsvalueexceeds2.This countisconvertedintoacolor. Formoreinformationonthetheoryoffractals,seeTheFractal GeometryofNature,byBenoitMandelbrot. Figure3-8.TheMandelbrotPrimitive Figure3-8showsarepresentationoftheentireMandelbrotset. YoucanreproducethisfigurebyrunningMANDELBROT.BAS,and selecting100iterations,anXCenterof.75,andaYCenterof0. Choosearangeof2forviewingthecompleteimage.Onceyou've becomesomewhatfamiliarwiththegeneralcoordinatesofthe Mandelbrotset,tryexploringtheboundaryareabyselectingxand ycoordinateslocatedontheboundary,andthenselectingsmaller valuesfortherange.Program3-5,MANDELBROT.BAS,wasusedto generatetheimagedisplayedinFigures3-8,3-9,and3-10.Onlya black-and-whiterepresentationwaspossibleinthebook,butthe setgeneratedbyProgram3-5isquitecolorful.Someother interestingareastoexplorefollow. Figure3-9.MandelbrotFigure Figure3-10.AnotherSegmentoftheMandelbrotBoundary. X-CenterY-CenterRange -10.320.3 -10.28950.0005 -0.970.2760.0001  Inthisprogram,we'llbeintroducingseveralnewprocedures whichcanbeusedinyourownprograms.We'llshowyoulaterhow tomergetheseproceduresintoyourprograms. Program3-5.MANDELBROT.BAS DIMpalette(15),pal2(15) Themousepointerwillbeinthewayonthepicture,sowe'll justturnitoff. ' HIDEM ' We'llchecktoseewhichresolutionisinuse,thengivea warningifthemachineisn'tinlowresolution.Thisprogramwill workinanyresolution;itjustlooksbestwith16colors,so we'llallowittocontinueiftheuserdoesn'twanttoquit. ' rez=XBIOS(4) IFrez<>0 alrt$="Fractalslookbestin|LowResolution" ALERT1,alrt$,1,"Continue|Quit",b IFb=2 END ENDIF ENDIF ' Nextwe'llestablishdefaultvaluesfordifferentscreen resolutions. IFrez=0 screen_height=200!Lowresscreen screen_width=320 ENDIF ' IFrez=1!Mediumresolutionscreen screen_height=200 screen_width=640 ENDIF ' IFrez=2!Highresolutionscreen screen_height=400 screen_width=640 ENDIF ' 'MainLoopbeginshere ' We'veusedthisroutinebefore.Itsavesthepalettesoyoucan restoretheoriginalcolorslater.It'sagoodprogramming practicetocleanupafteryourself.Ifyouchangethepalette, thenexittotheGFABASICeditor,youmayfindyourselfstuckon ascreenthatisimpossibletoread. GOSUBsave_palette ' Here'sthemainloopwhichcontrolstheprogram. DO ' GOSUBvalues IFrez=0 GOSUBset_new_colors ENDIF GOSUBcalculate IFrez=0 GOSUBrestore_palette ENDIF GOSUBdisplay_it ' LOOP We'llputanENDinhere,buttheprogramneverreallyexits fromtheDO...LOOP.Otherproceduresarecalledandexecutedfrom procedurescalledbytheDO...LOOP,buteverythingwithinthis programactuallyoccurswithinthisloop. ' END ' display_itisaprocedurewhichdisplaysinformationaboutthe calculationsforthisparticularportionoftheMandelbrotsetand offerssomeoptionswhichmaybeselectedbypressingakey. Usuallythisprocedurewillbeencounteredafterthecalculations fordisplayingthefractalarecomplete. PROCEDUREdisplay_it ' display: CLS PRINTAT(1,3);"FractalImage" PRINTAT(1,5);count;"IterationsCalculated." seconds=INT((time_finish-time_start)/2)/100 min=INT(seconds/60) IFmin<=0 min=0 ENDIF seconds=ABS(INT((secondsMOD60)*100)/100) PRINTAT(1,7);min;"Minutesand";seconds;"Secondsrequired." PRINTAT(1,8);"Numberofiterations:";iteration_limit PRINTAT(1,10);"XCenter:";x_center PRINTAT(1,11);"YCenter:";y_center PRINTAT(1,12);"Scalingfactor:";range PRINTAT(1,14);"Minimumrealvalue(xmin):";real_min PRINTAT(1,15);"Maximumrealvalue(xmax):";real_max PRINTAT(1,16);"Minimumimaginaryvalue(ymin):";imag_min PRINTAT(1,17);"MaximumImaginaryvalue(ymax):";imag_max PRINTAT(1,19);"Press:" PRINTAT(5,20);"toViewFractal" PRINTAT(5,21);"

toPlotnewFractal" PRINTAT(5,22);"toSave.NEOfile" PRINTAT(5,23);"toQuit" ' keywaitsfortheusertopressakey.Thenthekeyvalueis storedina$,andevaluated,andtheproperbranchistaken.UPPER isaGFABASICcommandwhichconvertsanyvalueina$to uppercase.FormoreinformationaboutanyGFABASICcommands, refertoChapter2. key: REPEAT a$=INKEY$ UNTILa$<>"" ' IFUPPER$(a$)="V" SGETscreen2$ IFrez=0 GOSUBset_new_colors ENDIF SPUTscreen1$ REPEAT UNTILINKEY$<>"" GOSUBrestore_palette SPUTscreen2$ ENDIF ' IFUPPER$(a$)="P" GOTOfinito ENDIF ' IFUPPER$(a$)="Q" SHOWM CLS END ENDIF ' IFUPPER$(a$)="S" ' Here'sahandyprocedurethatsavesthescreenintoa NEOchrome-compatiblefile.Followingthisprogram,we'llgiveyou asimpleroutinewhichcanbemergedwithyourprograms,andshow youhowyoucanusethisroutinetoloadscreensinyourown programs. IFrez<>0 CLS ALRT$="MustbeLowRes|forNeochromefiles" ALERT1,alrt$,1,"OKAY",b ENDIF GOTOnot_neo ' SGETscreen2$ default$="C:\*.NEO" FILESELECTdefault$,"",infile$ CLS IFinfile$=""!equals""ifCANCELselected GOTOnot_neo ENDIF GOSUBset_new_colors SPUTscreen1$ OPEN"o",#1,infile$ ' 'Firsttwobytestozero ' FORi=0TO2 OUT#1,0 OUT#1,0 NEXTi ' 'Savecolorpalette ' FORi=0TO15 hi=INT(pal2(i)/256) lo=pal2(i)-256*hi OUT#1,hi OUT#1,lo NEXTi ' 'Colorcyclinginfo(notneeded) ' FORi=0TO89 OUT#1,0 NEXTi ' 'Savescreeninfo ' BPUT#1,XBIOS(3),32000 ' CLOSE SPUTscreen2$ GOSUBrestore_palette ' not_neo: ' ENDIF ' GOTOdisplay ' finito: ' RETURN ' valuesacceptsinputfromtheuserforthevaluestobe examinedfortheMandelbrotboundaries. PROCEDUREvalues ' CLS INPUT"Numberofiterations";iteration_limit INPUT"CenterX";x_center INPUT"CenterY";y_center INPUT"ScaleRange";range real_min=x_center-(range/2) real_max=x_center+(range/2) imag_max=y_center+((range/2)*0.77) imag_min=y_center-((range/2)*0.77) CLS RETURN ' Thenextproceduredoestherealwork.Thecomplexnumberis evaluatedasdefined.Severalarbitaryvalueswereselectedfor constants.Youmayfinditinterestingtochangevalues,suchas max_limit,toobserveanychangesinthefigureplotted. time_startisusedtocalculatethetimeittooktocompletethe plot. NotethateventhoughGFABASICisoneofthefastest interpretersavailable,fractalscantakealotoftimetoplot. Mostdesignswilltakeoveranhourtocomplete.Thecloserthe complexnumbersaretotheMandelbrotset,themorecalculations arerequiredbeforetheresultexceeds2.Therefore,moretimeis required. PROCEDUREcalculate ' time_start=INT(TIMER) max_limit=100000000 count=0 real=(real_max-real_min)/(screen_width-1) imaginary=(imag_max-imag_min)/(screen_height-1) FORy=0TOscreen_height FORx=0TOscreen_width lreal=real_min+x*real limag=imag_min+y*imaginary re=lreal im=limag depth=0 calc_loop: INCcount x1=re^2 y1=im^2 im=2*re*im-limag re=x1-y1-lreal INCdepth IF((depth=iteration_limit)OR((x1+y1)>max_limit)) GOTOfinished_yet ELSE GOTOcalc_loop ENDIF finished_yet: IF(depth"" GOSUBbreak ENDIF NEXTx NEXTy ' 'Savescreenintoscreen1$ ' SGETscreen1$ ' time_finish=INT(TIMER)!timeofcompletion ' RETURN ' Ifakeyispressed,wemuststoptoevaluateit.We'llalso displayaninterimscreenwithsomeinterestinginformation. PROCEDUREbreak ' SGETscreen1$ time_finish=INT(TIMER) IFrez=0 GOSUBrestore_palette ENDIF CLS PRINTAT(1,3);"FractalImage" PRINTAT(1,5);count;"IterationsCalculated." seconds=INT((time_finish-time_start)/2)/100 min=INT(seconds/60) IFmin<=0 min=0 ENDIF seconds=ABS(INT((secondsMOD60)*100)/100) PRINTAT(1,7);min;"Minutesand";seconds;"Secondsrequired." PRINTAT(1,8);"Numberofiterations:";iteration_limit PRINTAT(1,10);"XCenter:";x_center PRINTAT(1,11);"YCenter:";y_center PRINTAT(1,12);"Scalingfactor:";range PRINTAT(1,14);"Minimumrealvalue(xmin):";real_min PRINTAT(1,15);"Maximumrealvalue(xmax):";real_max PRINTAT(1,16);"Minimumimaginaryvalue(ymin):";imag_min PRINTAT(1,17);"MaximumImaginaryvalue(ymax):";imag_max PRINTAT(1,19);"Press:" PRINTAT(5,20);"toContinuePlot" PRINTAT(5,21);"toReturntoMainMenu" ' keyit: REPEAT a$=INKEY$ UNTILa$<>"" ' IFUPPER$(a$)="E" x=screen_width y=screen_height SPUTscreen1$ GOTOfinit ENDIF ' IFUPPER$(a$)="C" IFrez=0 GOSUBset_new_colors ENDIF SPUTscreen1$ GOTOfinit ENDIF ' GOTOkeyit ' finit: RETURN Thecalculationsarecompleted;nowit'stimetoplotthe point.Depthisequaltothenumberofiterationscalculatedon thenumberwhichrepresentst hepoint. ' PROCEDUREdraw_point ' colour=depthMOD16 COLORcolour IF(depth>100) PLOTx,y ELSE GOSUBgreater_than_two ENDIF RETURN ' PROCEDUREgreater_than_two ' IFdepthMOD2 PLOTx,y ENDIF RETURN ' set_new_colorschangesthecolorpalettebyinstallingthe colorswe'veselectedintothehardwareregisterforthepalette. PROCEDUREset_new_colors ' 'Setupcolortable ' pal2(0)=&H0 pal2(1)=&H75 pal2(2)=&H765 pal2(3)=&H401 pal2(4)=&H410 pal2(5)=&H530 pal2(6)=&H241 pal2(7)=&H62 pal2(8)=&H474 pal2(9)=&H744 pal2(10)=&H731 pal2(11)=&H165 pal2(12)=&H14 pal2(13)=&H750 pal2(14)=&H423 pal2(15)=&H601 ' ' FORi=0TO15 SETCOLORi,pal2(i) NEXTi RETURN ' We'veseenthenexttwoproceduresbefore. ' 'SaveOriginalColorPalette ' PROCEDUREsave_palette LOCALi ' ' FORi=0TO15 palette(i)=XBIOS(7,W:i,W:-1) NEXTi RETURN ' ' ' 'RestoreOriginalColorPalette ' PROCEDURErestore_palette LOCALi ' FORi=0TO15 SETCOLORi,palette(i) NEXTi RETURN SavingaScreeninNEOchromeFormat Here'sasimplelittleroutinesimilartotheoneusedin MANDELBROT.BAS.Thisprogramcaneasilybemergedwithanyofyour programs. Program3-6.NEOWRITE.BAS ProcedureSave_neoscreen 'Reserveanareaofmemoryforthealternatepalette. ' DimPal2(15) ' GosubSave_palette Hidem ' SgetScreen1$ ' Rez=Xbios(4) IfRez<>0 Cls Print''MustbeLowResolutionforNeochrome'' Repeat UntilInkey$<>'''' Cls SputScreen1$ GotoNot_neo Endif ' Default$=''A:\*.NEO'' FileselectDefault$,'''',Infile$ Cls SputScreen1$ Open''o'',#1,Infile$ ' 'Firstthreewordstozero ' ForI=0To2 Out#1,0 Out#1,0 NextI ' 'Savecolorpalette ' ForI=0To15 Hi=Int(Pal2(I)/256) Lo=Pal2(I)-256*Hi Out#1,Hi Out#1,Lo NextI ' 'Colorcyclinginfo(notneeded) ' ForI=0To89 Out#1,0 NextI ' 'Savescreeninfo ' Bput#1,Xbios(3),32000 ' Close ' Not_neo: ' Endif ' ' Finito: ' Return ' 'SaveOriginalColorPalette ' ProcedureSave_palette LocalI ' ' ' ForI=0To15 Pal2(I)=Xbios(7,W:I,W:-1) NextI Return ' Afteryou'vesavedascreeninaNEOchromeformat,you'llneeda routinetodisplaythescreenwithoutloadingNEOCHROME.PRG. Here'saroutinetoloadanyNEOchrome-formatscreen.Withaminor alteration,youmayloadanyscreenintoyourprogramswithout usingthefileselectorbox. Program3-7.NEOLOAD.BAS DIMpalette(15),pal2(15) ' GOSUBsave_palette ' Here'sthemainloop.Usetheseproceduresasapplicableinyour programtoload.NEOfiles.Refertotheuser'sguideforDEGAS EliteforinformationonhowtohandleaDEGASfile.It'sjustas simple. main: ' GOSUBcheck_rez GOSUBchoose_pic HIDEM GOSUBload_colour GOSUBinstall_colour GOSUBshow_pic ' g$='''' REPEAT g$=INKEY$ UNTILg$<>'''' ' CLS ' GOSUBrestore_palette ' IFUPPER$(g$)=''Q'' END ENDIF ' SHOWM GOTOmain ' ' PROCEDUREcheck_rez ' rez=XBIOS(4) IFrez<>0 alrt$=''NEOLOADonlyworksin|LowResolution.'' ALERT3,alrt$,1,''Exit'',b END ENDIF ' RETURN ' PROCEDUREchoose_pic ' ThenextsectionwasincludedtoallowyoutoselectaNEOchrome- formatfileusingthestandardGEMfileselector.Ifyou'dliketo loadapredeterminedfile,omitthisprocedureanddefine Filename$asthenameofthedesiredprogrambeforecalling ProcedureLoad_colour. ' disk$=''*.NEO'' FILESELECTdisk$,'''',filename$ IFfilename$='''' END ENDIF ' RETURN ' PROCEDUREload_colour ' OPEN''I'',#1,filename$ temp$=INPUT$(38,#1) Thefirstsixbytesofthefiledon'tmatter,sowe'llstripthem off. colour$=MID$(temp$,7,32) CLOSE#1 ' Next,we'llbreakdownthetwo-bytecolorvaluesintovalueswhich wecanassigntoouralternatepalette,andinstallthecolors. palnum=0 count=0 REPEAT hibyte=ASC(MID$(colour$,count,1)) INCcount lobyte=ASC(MID$(colour$,count,1)) INCcount pal2(palnum)=(hibyte*256)+lobyte INCpalnum UNTILpalnum=15 ' RETURN ' ThefollowingXBIOSroutinechangesthehardwarepointertothe palettetopointtothevariableColour$.Changingthispointer installsthenewpalette. PROCEDUREinstall_colour ' VOIDXBIOS(6,L:VARPTR(colour$)) ' RETURN ' Here'salittletrickforloadingthepicture.XBIOS(2)isan XBIOSfunctionwhichreturnsthelocationofthephysicalscreen. Thiswillvaryfor520sand1040s.Actually,we'recheatingabit here.Weknowthatthefirst128bytesofaNEOchromefilecontain informationwe'renotinterestedin(informationconcerningthe resolution,whichisneverused,thecolorpalette,andthecolor rotation).Whatwe'lldoisignorethisinformationandbegin loadingthepictureintoanabsolutememorylocation128bytes lowerthanthebeginningofscreenmemory.Thisareaisn'tusually usedforanything,andprovidesaneasywaytostripoffthe unneededbytesandloadthepictureimage. PROCEDUREshow_pic ' physbase=XBIOS(2) BLOADfilename$,physbase-128 ' RETURN ' 'SaveOriginalColorPalette ' PROCEDUREsave_palette ' FORi=0TO15 palette(i)=XBIOS(7,W:i,W:-1) NEXTi ' RETURN ' PROCEDURErestore_palette ' FORi=0TO15 SETCOLORi,palette(i) NEXTi ' RETURN GreatGraphics Asyouhaveseenfromthesesimpleexamples,GFABASICmakes graphicsprogrammingeasy.It'snotnecessarytoresorttoPEEK's andPOKE'stoachievethespectacular.Thisisonlythestarting point.AsyoucontinuetoexploregraphicswithGFABASIC,you'll beamazedatthepoweryoucanunleashasusethepowerofthe 68000Microprocessor. Inthenextchapter,we'llintroduceyoutoanevenmore impressiveuseofgraphics--Animation.Soonyou'llbewriting thegamesyoudreamabout. eyoutoanevenmore impressiveuseofgraphics--Ani*. 0 29:16:02 00/11/2038 *.. 0 29:16:02 00/11/2038 GFATIP04.BAS 3516 00:15:22 11/20/1985 GFATIP04.PRG 13369 00:15:28 11/20/1985 GFATIP04.TXT 1795 00:15:36 11/20/1985 TEMPFILE.TMP 0 18:22:00 05/29/1985 GFAGRAF DOC - a chapter from a canceled book. As the name implies this file covers graphics and GFA BASIC. GFATIPxx - the "xx" is for folders GFATIP01 - GFATIP07. This is a collection of very good tips on getting things done with GFA. HORSEMED - the medium resolution version of the horse and rider galloping across one's monitor. TINY_GFA BAS - read in a Tiny type file from GFA 3316 1455 GfABASIC*J   F IXDATALXYCPTRIIIPDATARESIXPTRTFIPACODALEPIDATAPDATARESRESLCODELDATACOPTRDAPTRIXIYXXICODECOVALIIXPICIXDATAPIWORDPICPTRLCPTRPTRPICPWORDICPICIXXIXPTRPTRCOPTRDAIXCODELABEL1JLBGETDATAPUTDATAFIXITE FfE:\gfabasic\*.tn*! !F 6 FF FE! F palette 4E! F code table and data table length $Ez ! F code table buffer $Ez! F data word buffer 7I!M!F EqM FM!z !FFM!z !FF$E3z F length of code table >E3z  Fg length of data area (sometimes 2 * length) $M!z !Fg read in code table e*vLF handle iffiness on data length m(M!z !Fe read in the data words hvF8MF 2Ez F remove pointer evaluation from loops 2 Ez F6 Fr res 3,4,5 = 0,1,2 + color rotation data 1!F FE F EF "FF Epi1F EGpF6 !3z   F  F F jF Epi2Fb EGF6 !3z   F F F F F! Epi3F 6!3z F  F&)!unknown resolution!! OK !FF! F F! F!2Ez! F decompressed picture goes here d Ez F EFEF EFEF( E9F want to know how long it takes g ,F E2 F&  F  0= 16 bit repeat count s" E#2  2 F0!F,F EG F,F  FG $F & V F 1= 16 bit string length " E#2  2 F0!FN EG F,F,F 8 FF  F*  F  2..127 = repeat count 4FF,F EG F,F  FG4 F  128..255 = two's complement string length 4FF E F EG F,F,F  FG F F FFF$ E9 F2 compute decompress time Time = " H"FEa F wait for keypress 2F  try to display (no resolution adjustment) z !F E6 F*E?@@  F7O!M!F M!z !FM!z !FM!z !zzF8MFz<6!`!`!`Fs restore my original palette 6!`!!F6!!@!F 6!!!FF!+F` E3 F0 !F.FE+F  !F0 !F  zF0 !F1 !zF  F0 !F1 !F FE FE.FE+FFF.FF .  t-..  tCONVERT BASt .'CONVERT TXTt 8GfABASICFt..BV@@@ R%Z%%&N&N&x&&&&'N'N'NbVFL FILELENGTHN_OBJDPEEKSADRIN_PNTSPEEKRNN_LOOPSN_TRIFLAGEFILENAMEAFILENLFILEZF_NFLGALTNU_FILENSADRN_OBJIN_PNTSNAM_ADRVECT_ADRDLOOPN_LOOPSN_LOOPN_TIMOOFFSETN_PTSN_TRI TEMP_OFFSETTRI_ADR FILELENGTHGFA_PNTSXYZ GFA_LINESGFA_SURFLIN_CNT LIN_COUNTD LINE_COUNTFLAGCAD3DGFANXYZBNCAD3DGFAABCDCAD3DGFANXYZLSTRIABCDOBJ_ADDRNOSELECTGET_FILEGET_NAMEGET_PNTSGET_VECTGET_TRIS GET_TRIVECT ERROR_CHKWRITE_SURFACES WRITE_LINESWRITE_ONLY_EDGES WRITE_EDGESABCABACABCBCCBWRITE_ALL_EDGESWRITE_ALL_SURFACES L======================================================================== L# # L# CAD 3D II ------> GFA OBJECT # L# # L# PROGRAM BY STEVEN SEIDL # L# # L# # L========================================================================  =HGFA Object, GFA BASIC, CAD 3D II, and Michtron are all tradmarked or = copyrighted titles or names.  iHThis program source code has been intentionally made simple. It is a Lfunctional program, but with few if any bells and whistles. Please feel Jfree to modify it as you see fit, I hold no claim to any copyright, but Nrequest if you use it as part of your own program, that you give GFA-BASIC, NGFA-Object, Michtron, and Antic's CAD 3D II (by Tom hudson) proper mention Jas all of the above contribute to the success of the Atari ST computer.  =L========================================================================  =MF s<E3 FTDetermine number of CAD 3D II objects in file. < Sadr% = the start address of B file.  Number of objects: "FD1!Fobjects are numbered 0 to n in file (as opposed to 1 to n)  Hmake room for arrays (max size for CAD 3D II is 30000 points, you can Hincrease the "A,B,C, AND D arrays if a need exists, and you have the spare memory.  p* ! F2* @ ! @ ! @ ! @ F*  F E@0!F Offset for pallet, ect. info that I don't need.  E pMain program loop  a. EGF aPEIPlease select option:|1. Edge only line data|2. All line and surface dataF)!!! OPT# 1|OPT# 2!F aEF aMF  D Give a file name for the new GFA Object ASCII file  if\*.ASC!!Fw JF-F F 7O!M!F4 write a code on disk bM!141583F6 offset from start address 0!Fo4 Get number of points sMFB If number of points exceeds the array, let user know lMF@0 Another offset a0!F8 Get points (or coordinate data) eMFWriting pointsF 0 Another offset t0!F2 Get number of lines sMF@ If number of lines exceeds the array, let user know wMF@0 Another offset 0!FD Get option 1 or 2 line data, and surfaces (if selected) MFF Writing edges and surfacesFt0 Another offset f0!F0 Close up the file f8MF< Repeat until all objects are extracted e  FG L=========================****** Subroutines ******=====================  =LThis sub will get a CAD 3D II object file using the fileselect box, then Jfind it's file length, open it, find it's address in memory, dimmension :a array based on file length, and return to main loop. m +Ff\*.3D2!!F  JF-F F 7I!M!F EsM F8MF.* F Ez F!!F.F N===========================================================================  =NThis routine will tell user the current object name (as it was assigned in tHCAD 3D II program). It will show the object that is currently being e"converted to GFA Object format.  +F EGF EB2 F4FE FdObject name is: "       @@ ``  F.F P============================================================================ F =HThis routine will get the number of points in the current object, and Hassign that value to the GFA_POINTS variable. It will then write the 8value to disk, as required by the GFA OBJECT format. l s+FE#2 2 FEF1M!F.F N===========================================================================  =PThis routine will assign a value to the variables X, Y, and Z which are then FNwritten to disk in numerical order. x,y,z are the coordinates in the edit nPfield of GFA Object (and CAD 3D). DPEEK was not used due to the possibility FNof a fatal error (due to peeking at a improper address). The 'Sub' state- y6memts are used to give a negative number if needed.  i+F1!FE EG@H@F 6E#2 2 Fyou may wish to add :E#2 2 Fa value of 200 to the eHE#2 2  Fhx% value, and add 150 h( JF to the y% value. I $1!F"have found that if a  F+object is centered in h, TJF CAD 3D II's window, that &1!F"the above values will , F+pretty much center it l* ȐJF in GFA Objects window. 1!F FNM!zz ","zz ","zz Fxyou can enlarge or reduce & Fz+the object size by chang- 4F'ing the value '1000' to h.F.another value.  P=============================================================================  =LThis sub will get the number of triangles in a CAD 3D II file. Each tri- Nangle of course will have 3 lines (thus the variable 'GFA_Lines'). If all =Ldata is to be written, then this variable is written to disk. If not, it will be calculated later.  +FF E#2 2 FE F E F JFM!F F.F N=========================================================================== LThis sub will get the triangle data, and then convert it to edge data for Juse in GFA Object. Based upon which mode was selected, it will either oLgenerate all data, or store the data in a array for latter processing to >determine which lines should be drawn (in edge only mode). p e+F1 !FEF vEG HF >  E#2 2 F1st point of triangle p<  E#2 2 F2nd "" "" "" J  E#2 2  F 3rd "" "" "" D  E2@ Famode byte. determine which lines to draw. 2 JF If all data, then write it to disk. cM!  ","  F M!  ","  FHM!  ","  F lF> ά  `JFthese conditions determine what lines d.0!Fare to be drawn (base on mode byte). . hF Also they will accumulate the number F <  @ JFof lines to be printed. This value *0!F(total line count) is put in the dF'Lin_count' variable. p `  JF4F F F F F ̎F4 F 8 <JFbased on mode selected, program will go to 2M F a routine to write all surface data (which 6M!0Fris redundant to line data), or write only t VF0the 'edge mode' data. RJFMF F F.F N==========================================================================  =RThis sub will write only those lines which have the appropriate flag bits set. LThe flag is from the D%() array, and uses a binary 1 or 0 to specify if a Nline is to be drawn. 3 possible data points can be set, which results in 8 Lpossible conditions (max binary number '111' to min binary number '000'). PBased on the value in the current D%() array index, either none, one, two, or (three lines are written (a,b, or c). ) h+ F1!FEM!F EGHFw  L!!!! ! ! F ҚF!4F.F  + Fd%=111 M!  ","  FHM!  ","  FHM!  ","  F.F  + Fd%=110 M!  ","  FHM!  ","  FH.F  + Fd%=101 M!  ","  FHM!  ","  F.F  +Fd%=100 M!  ","  FH.F +Fd%=011 M!  ","  F%M!  ","  F%.F +Fd%=010 M!  ","  F.F +Fd%=001 M!  ","  F%.F P============================================================================  =<This sub will write all surfaces of CAD 3D II data files.  +FF M!F1!F! vEGHF M!3F M!  F M!  F M!  F >FF.F N========================================================================== = =LBased on your requirements, or memory space, you may wish to change this =Herror trap to a more appropriate one. It is quite possible that this Jprogram will generate a file to large to use in a 1 Meg ST, thus adjust 4or create your own error routine here if desired.  r+F@ \@  ;; JFFile to long to convert!FF Sorry, have to end program.F {HF qF F.FIl rI  #AcyAT kyV 6?~xV\Ğƞʜ`j6xӺ(T p>> The GFA Object conversion program Program by Steven Seidl Written in GFA BASIC Congratulations on selecting GFA Object, I am sure you will find GFA- Object will provide you with many hours of enjoyment. While GFA- Object has many powerful commands and functions which allow you to create many complex 3D designs, you may wish to view or modify a data file for a 3D object created with Tom Hudson's CAD 3D II. Files such as these can be found on networks such as GENIE or COMP-U-SERVE, or perhaps on a local BBS. This utility program gives you the capability to convert a CAD 3D II data file, into a GFA-Object ASCII format file. You may then load a file created by this program into GFA-Object, manipulate it, and save it as a GFA-Object binary file. I elected to create a ASCII file vice the GFA-Object binary file, so that with little modification, you can use CAD 3D II data in a GFA BASIC program (or other programs for that matter). Operation of this program really needs no explanation. You just select a CAD 3D II data file (with the '3D2' file suffix) from a standard GEM fileselect box, then for each object to be converted, you enter the new name for your GFA-Object ASCII file in another fileselect box. The current object's name being converted is shown on your monitor. The only decision you must make is to select between edge-only mode, or all data mode. These two options will be explained later. Limitations of this program are as follows: 1. Since GFA Object and CAD 3D II use totally different types of object structure, it is impossible to make objects appear exactly like they appeared in CAD 3D II. CAD 3D II objects are composed of many triangles, which based on their coordinate sequence, and a mode-byte structure define how a object will appear. GFA-Object modules (or objects), are composed of points, edges, and surfaces. What the two programs do however have in common, is the fact that both must connect their lines and surfaces to x,y,z coordinate points. 2. Only CAD 3D II files can be converted by this program, it will NOT work with CAD 3D version 1. 3. Since GFA-Object does not utilize the color structure of CAD 3D II, the portion of a '.3D2' file that pertains to colors is ignored. Likewise, the light source settings from a '.3D2' file are ignored also, due to the different implementation in GFA-Object. The only option that you must select from, is a alert box that will ask you to select either all lines and surfaces, or edges only. The difference between the two files created is as follows: Edges only: In this mode, all coordinate points are generated to file, but only lines (or edges) that have the proper mode-byte flag are generated. No surfaces can be created in this mode since GFA- Object surfaces must be outlined by a edge. This type of data file is much smaller due to the reduced amount of generated data. All line and surface data: In this mode, all data is generated and written to disk. Each triangle in the '3D2' file is assigned as both as series of 3 edges, and as a surface with 3 corner points. Due to the vast amount of data generated in this mode, assure that you have adequate disk space for the ASCII file. Objects of this type are best viewed with GFA-Object's hidden-line removal option enabled. A commented source code file is included with the file conversion program so that you may tailor it to your own needs. You must have GFA-BASIC to execute the source code. This program is by no means a model example of programming, but should serve as a device to illustrate conversions of binary to ASCII data files. If demand warrants further development, such as improved hidden-line removal, I will consider a future version of this program. Voice any comments you may have concerning this on the GENIE network's MICHTRON RT, of which I am a frequent patron. One final note, this program could also be utilized to transfer CAD 3D version II data files to GFA-Object, with the final destination of GFA- Draft+. GFA Draft+ will do the necessary conversions once you have loaded a ASCII file into GFA-Object. I sincerely hope this program is of some benefit to you, Steven E. Seidl >>> pp >>>> pp >> >> p(88 p(88  Ppp(8>8>.  t=..  tDIAMOND BASt >P DIAMOND DATt G)DIAMOND DEMt R!GfABASIC"^t v t**BHrATESTWAITFLIPDTADTA1ITBBASLINBO1X1INITLINORLINXORY1X2Y2X1ADRB61PAGE1PAGE2LIN3LAGE1LAGE2INIT0BOX1ADRXSYSZTBBASPTTBODITCLER1CLER2CPYPGADRXYTBPP1P2TBLDOITNZROTSYOZ0ZOY0YNZNVEKTOROEFRMTFRMOFRMARPTRLEERLERRN1N2OELEPEOEADRLEADRPEADRKMBOLLBOOLBUSINGN0OTBXX1OKNNN3FFFCDEFQOBXRFLIFYRFZRFSCFLMAMBA11PVPBLVPFLFMXMYYXLBXOMSPUNLOELILOEOBJLOEXXYYZZVZ1Z2YVZVXVXBYBZBXHYHP1XP1YP1ZP2XP2YP2ZPXYI1ENVMERKES2C1C2C3C0GATREZENVCOMFILTNN2N1KMCABXYZX1Y1X2Y2GPP0P1ADRTBOINITVEKTORLINXORLINORFLIPPAGE1PAGE2OFRMTFRMWAITARPTRCPYPGLEERBXX1TBLTBPSTLEADRPEADROEADROBSCFXRFYRFZRFLIFQBOOLLFPFMSPUNEINPUNLOELININLINLOELIEINLILOEOBJEINOBJLOEBOSXX1LINEINVONBISFEOKZZPUNSUCZZVZZBI1OB0OB1S0ZRF0XRF0YRF0OBJ1ZRF1S1SCIJYS2BIXACOLLINNXORYROTXROTOUTDRAWDPPEKATENDPUNKTMOBJXROTYROTZROTSCALECOLORROTPOSENDPUNKTCOLSCLAEMXROTRANDOMLOOPSCHLEIFEPUNKTELINIEN HAUPTMENUE1 EDITORMENUE EDITORMENUE2GMENKK2HAUPTHAUPT1HAUPT2PUNKTE1PUNKTE2PUNKTE3PUNKTE4HAUPT3PZOBJECTEGRAPHIKZEIGENLADEN HAUPTMENUEPLPDPHPEPVPLIPDRPHIPEIPVEPLOPUNKTEELINIENNHAUPT0PRPUNKTEPLI1EIN21PHI1PHI2LLI1LHI2LHI1OLI1OHI2OHI1GZE1EIN31GZE0GEDOUTVEKTORCOVEKTORBWSDDE0DATAGETTBBASGETTBASBODRAWLADELADERFORMINIT0GETTABINITINITIALISIERUNGHEADHEADLINELISTENWAITUMW0UMW1UMW2PRINTERNOTREADY TABELLEVOLL TABELLENENDEERRORERRFEHLERPUNKTELINIENOBJEKTEGRAPHIKZEIGENLADEN HAUPTMENUECLRBPLPDPHPEPVPZMENUEPLIEIN2INT0PHIPDRPEIPVEPLOTABELLEISTVOLLATARIDISKDLAIDSCDDEDQIDLALLILDRLHILEILVELLOOLIODROHIOEIOVEOLOGEDGZEEIN3EINP2EINP3EINL2EINL3EINO2EINO3WINFGFE1GZE2GZE3GZE4GZE5GZE6GZE7GZE8GZE1GZE11GZE22GZE21GZ22GZEAGZE31GZE32GZE41GZE42GZE51GZE52GZE61WINVBWINVB1WINVB2WINVB3WINVB4WINVB5WAITMWAITPWINABWINAB1WINAB2WINAB3WINAB4GED1GED2GED3GED4GED5GED6GED7GED8GED9PRINTERFALSCHEEINGABEGEDC KEINOBJEKTGED10GEDPGED11GEDLGEDZDDE1DDEEDDELDDE2DDEZDDE3DDE4DDE5DDE6DDE7 KEINPUNKT KEINELINIEDLODMOVEKTORCOVEKTORBWDDE8DDE9DDE10DRUCKERNOTREADYDDE0CLIPPINGWINDOWE F0, F Initialisierung der Arrays und Adressen  8,闝!!"@ !G F Setzen des Clipping-Windows k<JF^!"@ !GFeFZF&\! GFA VECTOR Demonstration F[F FF JF.)!You must be in Med Rez!!! Sorry !JFTYF!F! FF JF^!"@ !GFMeFZF&\! GFA VECTOR Demonstration Fr[F FF 8 diamond.dat!@F Nachladen des Datenfiles p F. Endlosschleife . "Y! "GFA VECTOR DEMO:F:\Y !` "EAs you can see, GFA VECTOR is a GEM! If you always wanted to programFZY!p "H3D objects but didn't want to tackle assember code, then this is the oneFNY! ">p>>>>p>>>>p>>>>ppp>> >>(8>8> @p(88 >>p(8>8>>>8>8>p88>> p8>8>E..8Tehmmm ....8Tehmmm77Sdil~~~-7777Sdil~~~==Us !"#$====UsTTrDD !"#<TTTTrD    ! $#"'%&('#$,)!*10/.543261706/7.6574637288889:;<>@ABCDEFGHIJK=?KLMOQP8\]YXTUZ[UTWV^_`dcbhgfehljkmponqrstquovrntpuwxy~{|}   -$#,%&('#$()"*-+0/.543211706/7.6574637269:;<=>?@ABCDEFGHIJKLLMNMNNQRRS\]XTYZ[UTWVU_`dcbagfeiljkiponmrstqupvrosmqvxyz{|}~ddddddFFd "PP"!!!!<<<<<##((((##   ##    ##((dddddxd  ,,F!!  FF((((##  ##    ##(((ddddddFFLLLL LLP""P 2c6((((((((77777777AAAAAAAAFFFFFFFFqq??ÏB!ssB!?À??@B!|ssB!0> Ã 0>??@GfABASIC"^t < ^^: ATESTWAITFLIPDTADTA1ITBBASLINBO1X1INITLINORLINXORY1X2Y2X1ADRB61PAGE1PAGE2LIN3LAGE1LAGE2INIT0BOX1ADRXSYSZTBBASPTTBODITCLER1CLER2CPYPGADRXYTBPP1P2TBLDOITNZROTSYOZ0ZOY0YNZNVEKTOROEFRMTFRMOFRMARPTRLEERLERRN1N2OELEPEOEADRLEADRPEADRKMBOLLBOOLBUSINGN0OTBXX1OKNNN3FFFCDEFQOBXRFLIFYRFZRFSCFLMAMBA11PVPBLVPFLFMXMYYXLBXOMSPUNLOELILOEOBJLOEXXYYZZVZ1Z2YVZVXVXBYBZBXHYHP1XP1YP1ZP2XP2YP2ZPXYI1ENVMERKES2C1C2C3C0GATREZENVCOMFILTNN2N1KMCABXYZX1Y1X2Y2GPP0P1ADRTBOINITVEKTORLINXORLINORFLIPPAGE1PAGE2OFRMTFRMWAITARPTRCPYPGLEERBXX1TBLTBPSTLEADRPEADROEADROBSCFXRFYRFZRFLIFQBOOLLFPFMSPUNEINPUNLOELININLINLOELIEINLILOEOBJEINOBJLOEBOSXX1LINEINVONBISFEOKZZPUNSUCZZVZZBI1OB0OB1S0ZRF0XRF0YRF0OBJ1ZRF1S1SCIJYS2BIXACOLLINNXORYROTXROTOUTDRAWDPPEKATENDPUNKTMOBJXROTYROTZROTSCALECOLORROTPOSENDPUNKTCOLSCLAEMXROTRANDOMLOOPSCHLEIFEPUNKTELINIEN HAUPTMENUE1 EDITORMENUE EDITORMENUE2GMENKK2HAUPTHAUPT1HAUPT2PUNKTE1PUNKTE2PUNKTE3PUNKTE4HAUPT3PZOBJECTEGRAPHIKZEIGENLADEN HAUPTMENUEPLPDPHPEPVPLIPDRPHIPEIPVEPLOPUNKTEELINIENNHAUPT0PRPUNKTEPLI1EIN21PHI1PHI2LLI1LHI2LHI1OLI1OHI2OHI1GZE1EIN31GZE0GEDOUTVEKTORCOVEKTORBWSDDE0DATAGETTBBASGETTBASBODRAWLADELADERFORMINIT0GETTABINITINITIALISIERUNGHEADHEADLINELISTENWAITUMW0UMW1UMW2PRINTERNOTREADY TABELLEVOLL TABELLENENDEERRORERRFEHLERPUNKTELINIENOBJEKTEGRAPHIKZEIGENLADEN HAUPTMENUECLRBPLPDPHPEPVPZMENUEPLIEIN2INT0PHIPDRPEIPVEPLOTABELLEISTVOLLATARIDISKDLAIDSCDDEDQIDLALLILDRLHILEILVELLOOLIODROHIOEIOVEOLOGEDGZEEIN3EINP2EINP3EINL2EINL3EINO2EINO3WINFGFE1GZE2GZE3GZE4GZE5GZE6GZE7GZE8GZE1GZE11GZE22GZE21GZ22GZEAGZE31GZE32GZE41GZE42GZE51GZE52GZE61WINVBWINVB1WINVB2WINVB3WINVB4WINVB5WAITMWAITPWINABWINAB1WINAB2WINAB3WINAB4GED1GED2GED3GED4GED5GED6GED7GED8GED9PRINTERFALSCHEEINGABEGEDC KEINOBJEKTGED10GEDPGED11GEDLGEDZDDE1DDEEDDELDDE2DDEZDDE3DDE4DDE5DDE6DDE7 KEINPUNKT KEINELINIEDLODMOVEKTORCOVEKTORBWDDE8DDE9DDE10DRUCKERNOTREADYDDE0CLIPPINGWINDOWE F0, F Initialisierung der Arrays und Adressen  8,闝!!"@ !G F Setzen des Clipping-Windows k<JF^!"@ !GFeFZF&\! GFA VECTOR Demonstration F[F FF JF.)!You must be in Med Rez!!! Sorry !JFTYF!F! FF JF^!"@ !GFMeFZF&\! GFA VECTOR Demonstration Fr[F FF 8 diamond.dat!@F Nachladen des Datenfiles p F. Endlosschleife . "Y! "GFA VECTOR DEMO:F:\Y !` "EAs you can see, GFA VECTOR is a GEM! If you always wanted to programFZY!p "H3D objects but didn't want to tackle assember code, then this is the oneFNY! "8>8888 >>@Ppp(8>8> @P(p8p8 >>@p(8>8>88A 0xx>>>>>>p>>988c rp>>>>>>p>>A886p>>>>>>p>>88>> Ì0H>>>>>>p>>88@88>>>>>>p>>>88 88>>pp>>>>p>>@88D88 >>p(8>8> (88 >>p(8>8>@?? 8>> p8>8>88>> p8>8>@!??  >> p(8>8> (88 >> p(8>8>?? >> p   0pp>>>> pp >>>> pp >>>> pp >>>> pp >>>> pp >> >> p(88 p(88  Ppp(8>8>>> p88p88 pp8>8> >> p(88 p(88  Ppp(8>8>>> pp >>>> pp >>>> pp >>>> pp >>>> pp >>>> xp>> >>  p(88??(8>8>>> p88??8>8> >>  p(88??(8>8>>> xp>>>> pp >>