@L}5 _$% l0$)$$Hȱ$ UhL" `e$$%`$%`  R@W!( L(1   Y I`  d  Ld M * @  $ % CC$$)%1 Udߥ$9%: !0 S$% DD˙`  }J)Lr d M * @  $ % CC$$)%1 Udߥ$9%: !0 S$%} DD˙`  }J)Lr J  ((  p L ()   J}L= ( L 0q A    IB JC;? D W } LL  ` W )LA!  ߰")-݆ p" } $G@LL 08`Q")<2Q0 -G$Ș݆ UL# ; p8(()(0ʥ)NQ` }$GȘ݆LU )L ݆ L GȘ ݆LL )W>Z   HH)H }p h  hyhy D L> L JJ    ! LA*` BF }7'8  M HN H` 8 Z  \LdJJ!"! GFE@F (!L }EE !E^ ^ E E7EȩEdE/EȩE  D } .L }  ;F d  ;?F7F? ( .   Z D LL d } . D  L    p  E` , d)  D L) 0BM݊L݉} ML  N݆ L NLML [ TEqEHȱEqEh 0Gȹ G} HLL GɛL  LFREE SECTORS G) *Gȩ GȽG GȌ*jj >G} C8jJ3j2CD( C202C ԠBX` N 1? l LlD:RAMDISK}.COMLu L1 L ;LHL  T`  `8  ɐ     `TU  } L ? .  t`GBJ ~DEHI B V0dV!}QDEHI VF9 ,0 ,0 s0hhL  L` H hDHEh"}DEL8HI4 0 HI,0 0  9 .G VLO#},0 L4*IJ`llD1:AUTORUN.SYSNEED MEM.SAV TO LOAD THIS FILE.D8:MEM.SAV J y08 B|DEHI$} V0 0`B;DEL`?<0LV`@ʆ v s? F0Ξ05: [ BDEHI%} VY8 B V  @  /DE `E:D8:DUP.SYSERROR-SAVING USER MEMORY ON DISKTYPE Y TO &}STILL RUN DOS B;DE J  (` 9 V⪍ ઍ  -'}LLu ÝDEHILV 9 .l 9 .l  `` s$B BH(}I|DE V BLV nB,DE JLV B V BLVDEIʩ BꭝLu }NA5W (c)1983 Action Computer Services  B JKIHiDiELV`LA*} A BLV`LAAl LA &` Fj`8冨凪` BEӅӥ+} B`ʆǪƩ Ɛee` *BƦʆǢ &Ɛeǐ NB NBLB *B'&&&8儨児,}祂*LB&&*ń8&&LB B`hihiHHȱȱLAc !#3`-}LAJJJJ`H Ah`Hȩh AL;C AL;C oAL;C wAL;C }AH8.}`HhHh CL;C BHI V䅠L;C LC AL;CԆ ؠPIPP`/} DP wAL;C 7DLC DL}ȌzK0zKu{KLK}KȌ|KyKKK|K}KLK|K}KLKzK{KLK`LK FLK ˠҢK C ~K`6WLL?}KKKLLD:*.000L mK*(mKLELD:*.001Lȑ= mK*(mKLmLD:*.002Lȑe mK@}*(mKLLD:*.003Lȑ mK*(mKLLD:*.004Lȑ mK*(mKLLD:*.005Lȑ݈ mK*(mKA}L MD:*.006Mȑ mK*(mKL5MD:*.007Mȑ- mK*(mKL]MD:*.008MȑU mK*(mKLMB}D:*.009Mȑ} mK*(mKLMD:*.010MȑK mK*(mKȱJ- H`LMM MLM`HC}M L CJ- _CH`L NJA CJi CNAJHNHNNLNNAJI L}NJNAJAJ -HJJAD} HLNNL=NNiJNNNLNNiJI LNJNiJiJ -HJJi HLNNLN`LN VF1,J0+J+Ji,E}JiG+Ji,Ji+Ji ,Ji+Ji ,JiNNLcO+JmN,JiNL=O`LiO NF}HH B GLOO C FLOANTICO C FLOSOFTWAREO C G}FLP O C FL5P P' C  FJA C  FJi C FLP H}Ph C FLP"Press for Screen, for PrinterP C CLPK:PΩ _CI}@ CeOeOIP eOISLP FL8Q$ Q C CeO`LOQJQJQISLaQ`J} FLQPRESS FOR CONTINOUS FEEDQm C FLQPRESS FOR SINGLE SHEETQ C CLQK:Qé _C@K} CKQKQIS KQICLQ FL&R R C FLWR R9 CL} CKQ`LoRjRiRkRHICL.SjRiR FLRàR C CLRK:Ré _C CM}kRkRILR CkR`jRiR FL"S S C C`L:S ȢIc GHcIH͖HN}LjSH C`3S8HSS3SLT8H3S5S5SH4S4SI L T6SHSS6SLS5Sm6SH6ScI6SLS85SO}H8H5ScIH CIcH HHi5S5S`3SLxSH C`L$TTTTTTHDTDTTLT C T TIP}L_TLTLsT TI TILsTLT TTHTL9T8TH T`LTTTTT MTTILTT`TLUTQ} !TT 7STHTILTHITIL7UHI8L7UHT8H"U"U͓TL.U DTLUTiH7͙HLUT ͓TR}L[U DTLFUH  lRTTILU CT`LU͙HLUHILUH lRT} CTILU CT`LT S}CT`LU FLUҠӠԠ΢U C ~K`L VAVAVJAJA J MV NVH fOVV LT}QVVH CVIPLV8HPHH CLVP:V~ _Cd͗HLV C UL%WLVH$H CLVE:U}V _C CVV TVVIL W lRVLWLWVILWLWLWVLVL%WLSVL2VVAVA``VVE:x888888ffffff~~`~~fl0fF>6xo~{>>888>|||f<Z}c6>8pp8?[}w><~~~<||`x`~<~~<\}0~0 ~ <~~<~~f~``~~f~~~``~~~f~~f~`~~~~f~~``~~ff8888<>>``f||f88<<w]}wk~~fff~~ff~~~f~``~~f~~~```~`~~~~fff~~ff~<ckwf~<~fff~~~~~0~<~~<^}~x|ngTTTTTT~f~``~~f~~~```~`~~~~fff~~ff~<ckwf~<~fff~~~~~0~<~~<THE DRAGON'S TAIL part I This documentation may not be copied, photocopied, reproduced, translated, or telecommunicated `} in any form, in whole or in part, without the prior written consent of Antic Publishing, Inc.The accompanying program mate a}rial may not be duplicated, in whole or in part, for any purpose. No copies of the floppy disk(s) may be sold or given to an b}y person or other entity.Notwithstanding the above, the documentation and accompanying disk(s) may be duplicated for the so c}le use of the original purchaser.Antic is a trademark of Antic Publishing, Inc.* * * * * * * * * * * * * * * * * * NOTE d}: THERE IS ADDITIONAL DOCUMENTATION ON DISK 2 SIDE B, DISK 3 SIDE A AND DISK 3 SIDE B. TO ACCESS THOSE FILES, BOOT THIS DISK e}ON THIS SIDE [ THIS IS DISK 1 SIDE B ]. THE DOCUMENATION PROGRAM WILL BOOT, ONCE YOU HAVE PRINTED THIS DISK, REMOVE IT AND IN f}SERT DISK 2 SIDE A, PRINT IT OUT. DO THE SAME FOR DISK 3 SIDE A AND DISK 3 SIDE B. YOU NOW HAVE COMPLETE DOCUMENTATION. * * g} * * * * * * * * * * * * * * * * THE DRAGON'S TAIL by Ed Churnside.1. OVERVIEW.1.1 Introduction.The Dragon's TAIL h}(Toolkit And Integrated Library), is a library of machine code subroutines designed to enhance the capabilities of Atari BASI i}C. Although many these routines were developed as part of the graphic adventure "DRAGON QUEST or a Twist in the Tail", they h j}ave been standardised and expanded to cover a wide variety of programming situations. Using these routines you will be able t k}o develop games, adventures, utilities and other programs previously beyond the capabilities of BASIC, with nothing more comp l}licated than a USR function. Both the routines and documenation assume some knowledge of programming the Atari in BASIC but s m}hould be easily understood by even a beginner. You do not need to know 6502 machine code to use these routines.The library n}is divided into a number of volumes. Each volume is concerned with a different aspect of programming on the ATARI. This packa o}ge contains the first two volumes of the library, and a Tutorial disk to help you get started.The first volume, Text, conta p}ins many general purpose routines that should be part of every programmers bag of tricks, as well as routines specifically fo q}r handling text. In addition to the routines themselves this disk contains a number of programs, games and utilities, which r}illustrated the use of the various routines.The second volume, Graphics, contains routines for graphics editing, screen com s}pression, and full screen animation. Using the programs and routines on this disk, you will be able to design anything from s t}lide shows and graphic adventures, to long animated cartoons. These animations are created using a simple screen amimation la u}nguage. This is NOT player missile animation, although that may be covered in a later volume of the library. This is NOT char v}acter set animation, although the routines in this library may be used for this purpose. This is full screen animation, which w} may be easily used for Graphics 1-7, and can be used with other Graphics and Antic modes, with a little more effort.The th x}ird disk in this set contains a long tutorial on how to use the graphics editor, to get you started creating your own animati y}ons and a guide to creating your own adventures. To illustrate some of the techniques discussed in this guide, the Basic sour z}ce code to the Graphic Adventure "DRAGON QUEST or a Twist in the Tail" has been included.1.2 Organization of the manual. {}The manual is split into three main sections. This, the first section covers material of a varied nature, which is true for |}every volume of the library.The second section, which follows this section, deals with the TEXT routines. It is primarily c }}oncerned with the routines and programs on this disk.The third section, which is on the second side of volume 2, deals with ~} the GRAPHICS routines, and the programs on that disk.In addition to the manual, two other documents are included in this p }ackage. Side 1 of the Tutorial Disk contains a step by step tutorial on how to use the powerful screen editor program in Volu }me 2. The second side of that disk contains a guide to writing your own adventures, as well as the source code to "DRAGON QUE }ST.The manual, tutorial and guide are all very detailed, containing everything you need to know to use these routines and p }rograms effectively, and many hints and techniques to code better Basic programs.1.3 File Naming Conventions.The file e }xtender (e.g. .BAS) is used to identify the type of file. Since these disks, contain, create and use files of many different }types, it is important that you know these extenders.BAS - Basic SAVE/LOAD Program.DRA - Picture File in Drawit Format.F }IL - User file needed by a program. Format varies.FNT - Character Set of font.LST - Basic LIST/ENTER Program.MAP - Symbol }Table in screen editor format.MIC - Picture file in Micro Painter Format.MMK - Picture file in Movie Maker Background forma }t.OBJ - Binary object code file.PAD - Picture File in Koala Pad, Atari Touch Tablet or Micro Illustrator format.PGM }- Screen Editor Program.PIC - Picture in Paint format.SCR - Compressed screen or animation file.SYM - Symbol Table in word } processor format.TXT - Text file.1.4 Some Terms and Notations.A Routine is any piece of code that can be accessed via } a USR function. A Module may contain one or more related routines. A Module is the smallest piece of code that you can inclu }de in your program. Routines are grouped together in this way to take advantage of common code between related routines. The }routines section of this document is in alphabetical order by module. The BUILDER utility assigns each routine a unique varia }ble name. This variable name is used throughout this document to refer to the routine and in examples.A number starting wit }h a $ is a hex number, usually followed by it's decimal equivalent in parentheses (..). When describing parameter lists, brac }kets [....] enclose optional parameters which may be ommitted. The notation D0-D7 is used when discussing bits within a byte. } D0 is the rightmost or lowest order bit, D7 is the leftmost or highest order bit.The term "word" is used in two ways in th }is document. Depending on context, a word is either a two byte memory location, low byte/high byte, in standard 6502 usage, o }r word is a text word, in standard english usage. A string is a normal basic string (e.g NAME$), which must be DIMensioned wi }thin your BASIC program. Blocks of memory used by the routines as temporary work areas are called Buffers.All types of I/O }(Input/Output) are handled via part of the operating system called CIO (Central Input/Output), using an IOCB (I/O Control Blo }ck). The IOCB number is the one following the # sign in basic I/O calls. OPEN #1,6,0,"D:*.*", GET #1,X and PUT #1,X all use I }OCB 1. Basic uses IOCB 0 for all operations to the text part of your screen, IOCB 6 is used for the graphics portion. General }ly speaking IOCB's 1-5 are available for your use.1.5 Using the Library.Any program developed using these libraries con }sists of three parts. The first part is the AUTORUN.SYS file. This file must be present and loaded for any of the routines to } work. This file must be on the disk you boot at power on. The second part is the assembler routine to be used by your progra }m. Programs can use a common routine or one specifically created for your program, using the BUILDER utility. The third part }is your program which contains the code to load the routines and calls to the routines. The BUILDER utility will also build t }his code, which can be used as built, or modified to suit your needs.I suggest you use the following steps when first using } the library, until you get used to the process.1) Format a disk.2) Write DOS to your disk3) Copy the AUTORUN.SYS file t }o your disk.4) Create a custom module using the Builder utility.5) Create the Basic support code using the Builder Utility. }6) Write your program.7) ENTER the basic support code to merge it with your program.8) Save your program to disk.9) Write } a one line program to RUN your program.10) Save the one liner to disk as AUTORUN.BAS.11) Boot your new disk.The sections } on memory usage, AUTORUN.SYS, AUTORUN.BAS and BUILDER.BAS contain much more information about this topic. To save endless re }petition, I will say no more here.1.6 Calling The Routines.The routines are all accessed by USR functions of the type } RC=USR(RTNADR,PARM1,PARM2.......)Where RTNADR is the address of the routine you wish to use, and PARM1, PARM2 etc. are th }e parameters you are passing. The parameters fall into four types, constants, variables, addresses of strings and addresses o }f work areas, which may be strings if desired.The return code is the value that variable RC will possess after the above li }ne is executed. Almost all the routines set the return code to something useful.All the routines in this library disable th }e BREAK key. This is a safety feature since pressing break during some routines can have some unpleasant and unexpected side }effects. You can disable the break key yourself from BASIC by codingP=PEEK(16):IF P>127 THEN P=P-128:POKE 16,P:POKE 53774,P }somewhere in your program. You can enable the break key by issuing a graphics command, pressing System Reset, or coding P }=PEEK(16):IF P<128 THEN P=P+128:POKE 16,P:POKE 53774,PThe System Reset key is not disabled in any way by the routines, but }you can disable it yourself by "POKE 580,1", which will cause the system to reboot the disk when Reset is pressed. "POKE 580, }0", reenables the Reset key. It is not a good idea to disable System Reset until you are completely finished coding and testi }ng.1.7 Error Handling.The byte at $C3 (195), sometimes called ERRSAVE, contains the error code of any error detected by } BASIC. This is set to 1 by any valid function or I/O call. The routines set this value to represent any error conditions the }y find. After a valid USR call to one of these routines, the error code is set to 1.The routines edit the parameters and ret }urn error codes according to what they find. A error code of 6 means that you specified the wrong number of parameters, an er }ror code of 5 or 9 means there was something wrong with a string length or address. These are really development errors. Once } you get the program written and debugged they won't occur, so the final version of your program need not check for them. Rou }tines that perform I/O to Disk, Keyboard or Printer may also return normal CIO error codes, error 170 file not found etc. The }se errors can occur for reasons beyond your control and you should always check for them in your code.BASIC also sets the w }ord at $BA (186), sometimes called STOPLN to the line number at which the error occurred, so do these routines. This means th }at a general error handling routine will work just the same for these routines and BASIC. Of course, BASIC has no idea that a }1.8 Memory Usage and Compatability.The routines will work as documented on any of the ATARI 8-Bit CPU's (XL, XE or "Old Be}ige"). They work with DOS 2.0S, DOS 2.5 and WARP DOS, which are the three Disk Operating Systems I normally use. They use sta}ndard I/O calls and should be compatible with most other versions of DOS. The routines are written for Atari BASIC in all it'}s myriad forms, they will not work with other Basics. They are all but invisible to the basic programmer. This is all you rea}lly need to know, the rest of this section contains technical information for the more advanced users.Your computers memory} starts at 0 or low memory and runs up toward high memory. The BASIC cartridge at $A000 (40960) is effectively the end of you}r memory but newer models may be able to access higher memory areas. Computer memory is often referred to by page. A page is }256 bytes long. All the addresses that have a high order byte of zero $00-FF (0-255) are on page zero, all the addresses that} have a high order byte of 1, $0100-01FF (256-511), are on page one, and so on. Four pages or 1024 bytes are usually referred} to as 1K. Any address that is exactly divisible by 1K is said to be on a 1K boundary. Boundaries are significant for some ty}pes of data.The routines in this library do not use Page Six nor any of the free page zero addresses, $CB-$D1 (203-209). T}he routines do use the Floating Point work area $D6-E7 (214-231) for temporary storage and do not conflict with Basic's use o}f this area. STOPLN $BA,BB (186,187), ERRSAVE $C3 (195) and the return code $D4,D5 (212,213) are also set by the routines. So}me of the routines use CASBUF at $400 (1024) as a 128 byte work area. This is normally the cassette I/O buffer and will cause} problems if you have a cassette file open at the time.The vector MEMLO $2E7,2E8 (743,744) normally contains the lowest add}ress available to BASIC. The value of MEMLO changes depending on machine, operating system and DOS configuration. Boot any di}sk with BASIC and type "? PEEK(743)+256*PEEK(744)" to determine this address on your computer. From that address to $1F7C (80}60) is completely unused by these routines. This space was left to accomodate different versions of DOS and OS. If you are wr}iting programs for only your own use, this space can be freely used, if not, use it with caution.The AUTORUN.SYS file loa}ds at $1F7D (8061) and is about 2K long. It changes the vector LOMEM to point after itself, so your BASIC program will now st}art at $2800 (10240). You may know that LOMEM is reset when System Reset is pressed. Don't worry, the AUTORUN.SYS routine int}ercepts System Reset and re-establishes the new LOMEM. The program BUFFER.BAS allows you to tell the AUTORUN.SYS file to rese}rve more space after itself for your use. Since $2800 is a 2K boundary, this is an ideal way to reserve space for Player Miss}ile Graphics and Character sets, which require a boundary aligned buffer. The version of the AUTORUN.SYS file that comes on t}his disk, has a 1K buffer, which is used for a redefined character set by AFRICA.BAS.Your BASIC program runs from the new L}OMEM up to the address in vector MEMTOP $90,91 (144,145). The vector MEMTOP points immediately after your program. The memory} from MEMTOP to HIMEM $2E5,2E6 (741,742) is unused by BASIC and OS and is free for use as buffers and work areas. Please note}, MEMTOP changes as strings and arrays are dimensioned, and when lines are added to your program. HIMEM changes with Graphics} mode. I usually regard the area from MEMTOP +100 (after everything is dimensioned,) to HIMEM-100 (after the graphics command} that uses most memory has been issued,) as free for my use in programs. The routines do not use this area but Basic itself u}ses a small amount of space in this area for various purposes. Always leave at least fifty bytes free or you will start havin}g strange and inexplicable problems.Many of the more experienced readers may have noticed that the AUTORUN.SYS file overlap}s with the DUP.SYS portion of DOS so you can't load the AUTORUN.SYS file from DOS. If you use a MEM.SAV file on your disks, t}hen this overlap doesn't otherwise effect you. If, like me, you scorn the MEM.SAV file, then you can't use the B-Back option }of DOS. DUP.SYS when it loads wipes out part of the AUTORUN.SYS file. If you return to BASIC via the B command and then try t}o run a program that uses the routines or press System Reset, you will certainly crash. Reboot the disk, to reload the AUTORU}N.SYS file, instead of using the B command, and you will have no problems.1.9 Saving Your Program.A word to the wise. A}ny program that uses USR functions, or even simple POKE statements has the potential to crash disastrously. The program will }freeze, the keyboard will lock up, and the System Reset key will ignore you. Your only recourse is to switch the CPU off and }on and reload the program. All your changes this session will be lost. If you have made anything other than trivial changes t}o a program, save it to disk before you run it, or your evening may end in tears.There are four easy ways to cause the drea}ded lockout. You can forget to load the AUTORUN.SYS file. You can specify the wrong routine address. You can specify the wron}g number of parameters, or you can corrupt memory either in your program or the operating system. All these routines check th}e number of parameters so you are protected to some extent but there is no way to intercept the other errors. Please take thi}s warning seriously, you will hang up the computer sooner or later, probably sooner. I am too embarrased to tell you how many} times I did, while I was testing these routines, lets just say I lost count when I ran out of fingers.There is a slight ch}ance that you could corrupt the operating system in such a way that it decided to wipe your disk for you. DON'T PANIC, this i}s a very slight chance indeed. It has never happened to me in thousands of hours of programming, and I have only heard of it }happening once. Still, there is no substitute for taking regular backups of programs and data. I usually back things up to an} archive disk on a weekly basis. This has saved me a lot of work on more than one occasion, when I lost a file through my own} carelessness.1.10 Development Software.The following products were used in the creation of this software and related d}ocumentation.All the machine code was written using MAC/65 by OSS Precision Software. It's speed and relatively thorough do}cumentation make it a pleasure to use.The Basic programs were written using good old Atari BASIC, Version C. While much can} be said, both for and against Atari BASIC, it remains the only true standard Basic that all Atari users have access too, and} is therefore the only Basic for commercial work.Atari DOS 2.0S, Atari DOS 2.5 and WARP SPEED DOS by Happy Computers Inc we}re all used at various points in time. There are many other good DOS's available, Atari DOS 3 is not one of them.The Atari }Program Text Editor (MEDIT) was used extensivly during programming. This is an excellent piece of software which really helps} when writing longer programs. Every serious programmer should have a copy.The graphics font used by AFRICA.BAS was develop}ed using The Graphics Generator by Datasoft Inc. There are many public domain and magazine character editors available these }days. Graphics Generator remains one of the best.The screens on the graphics disk were drawn using Paint by Atari and Drawi}t by Antic. There is a full discussion of various drawing programs and there uses in the graphics section of the manual.Thi}s documentation was written using ATARIWRITER+. This is a fine word processor, and a considerable improvement on ATARIWRITER.}One final point, the comments on software and other ATARI related products made in this document are my opinions and do not} necessarily represent the opinions of ANTIC or any members of their staff.1.11 Publishing Your Software.If you only i}ntend to write programs for yourself and your friends, no problem. If you wish to publish your programs in any form, there ar}e some restrictions you should know about. There are three ways you could "publish" a program, you could place it in the publ}ic domain, you could publish in a magazine or you could publish it on disk as a game or utility.Suppose you wrote a program} that used the routines, and decided to publish that program in a magazine. Anyone who bought a copy of that magazine would a}utomatically have access to my routines free of charge. Since these routines represent well over a year of my free time, I wo}uld take an extremely dim view of the situation. Don't do it!!The same scenario holds true for public domain and disk publi}shing, if the code is not protected from public scrutiny. I have no objections to you using my routines to write the most exc}iting and compelling version of Star Trek yet devised (if you do by all means send me a copy). I have no objections to your p}ublishing and reaping the rightful rewards of your labor, BUT if by buying your product the public also gain access to mine, }you are selling my work and breaching my copyright. Here are three simple rules to follow to publish programs using these rou}tines.1. The Basic code must be in an unlistable format, either by using a Basic compiler or overwriting the symbol table. }Don't worry if you don't know how to do this, the PROTECT utility which is described fully later on, will take care of it for} you.2. Somewhere in your documentation you should state "This program was developed using the Dragon's TAIL routines by Ed} Churnside, published by Antic, the Atari Resource."3. The Antic Catalog gets first refusal on any software you develop. Co}ntact the Product Manager at ANTIC for current software submittal guidelines.irst refusal on any software you develop. CoQVolume One - Text.1. What's on This Disk.This disk contains 48 machine code subroutines. The routines on this disk fall }into several categories. The general purpose I/O routines, (GBYTE, PBYTE, GWORD, PWORD, GSTR, PSTR, GSECT, PSECT and QLOAD), }perform fast efficient I/O. The input routines, (INPA, INPC, INPSTR, INPLOW, INPSTRA, and INPLOWA), get data from a keyboard  }in a variety of useful ways. The parsing routines, (PARSE, WORD, TRIM and FINDC), provide easy command parsing for utilities  }and adventures. String formatting routines, (FSPEC, HEX, DEC, DUMP40, DUMP40P, DUMP80 and DUMP80P), perform useful string bui }lding functions. The bit manipulation routines, (QAND, QOR and QXOR), perform logical operations on data blocks. The memory m }anipulation routines (DPEEK, DPOKE, MPOKE, SHUFFLE, MOVE and CLEAR), allow fast memory movement and clearing. Finally the wai }t routines, (WAIT and WAITS), provide exact timings for music and animation.Eleven of the routines on this disk are primari}ly concerned with graphics. These routines are on this disk, and are part of the Builder utility, but they will be discussed }in the graphics manual and not mentioned any further in this section.In addition to these routines the disk contains ten pr}ograms which serve a dual purpose, being both useful and acting as demos of the various routines. TAILMENU.BAS is a simple di}sk menu that will load when you boot this disk. BUILDER.BAS enables you to build custom routine libraries for your programs. }PROTECT.BAS will render your programs unlistable to anyone who doesn't know the secret password. LISTPROG.BAS formats nice ne}at program listings for your printer. HEXCALC.BAS is a full function hex/decimal calculator. WINDOWS.BAS is a demo of input w}indows using the INPSTRA routine. DUMPUTIL.BAS is a fledgeling disk utility. BUFFER.BAS allows you to alter the AUTORUN.SYS f}ile that comes with this disk. Two games complete the disk. AFRICA.BAS take you for a mini-adventure into darkest Africa, whi}le HANGMAN.BAS is a computerised version of the classic game of Hangman.2 THE ROUTINES.All the routines in this librar}y are semi-relocatable. They can be loaded anywhere in memory, and they will work just fine. However, once they have been exe}cuted, they readdress themselves to their new location, and cannot be moved. The code set up by the BUILDER utility loads the} routines into strings, and sets pointers to the routines. This will work fine under most circumstances but there is one exce}ption. A Basic program that changes itself while it executes will cause the strings to move, the pointers will no longer poin}t to the correct places, and the routines will not work. To get round this problem, just change the builder code to load the }routines at a fixed memory address instead of a string. Consult the memory usage section to find a suitable location or use B}UFFER.BAS to reserve some space. Another way would be to reload the routines from disk before you use them, reestablishing ad}dressability.2.1 AUTORUN.SYSThe AUTORUN.SYS file will load automatically when it is on the disk that is booted at powe}r up time. It loads at address $1F7D (8061) and is about 2K long. It changes an address called LOMEM, which is where BASIC st }arts, to point after itself. It also intercepts System Reset to prevent LOMEM from being reset. This file must be loaded befo!}re any of the routines will work.The AUTORUN.SYS file contains data areas used by the routines, tables and subroutines comm"}on to many routines. After the AUTORUN.SYS file has loaded, it will print "LOADING" in large friendly blue letters, and then #}run a BASIC program called AUTORUN.BAS. If there is no program of that name on the disk you will get ERROR 170 - file not fou$}nd. This message is harmless and can be ignored.The AUTORUN.BAS file contains only one USR accessable routine, QLOAD at add%}ress $1F7D (8061). QLOAD will load relocatable machine code modules into memory.The assembler programmer may find one other&} address useful, especially for writing relocatable code. QRELO $1FAD (8109) will relocate a JSR or JMP instruction. Instead '}of writing, JMP MYRTN or JSR MYRTN, write JSR QRELO or JSR QRELO JMP MYRTN-* JSR MYRTN-*If you have(} a macro assembler you may like to make this a macro. To be really technical about it, this produces semi-relocatable code. T)}he code can be loaded anywhere in memory, but it readdresses itself the first time it is executed. This means that you can pu*}t the routines anywhere you want but you can't move them about once they have been called.2.2 QLOAD - Relocatable Loader.+} RC=USR(QLOAD,FSPEC,ADDR[,LEN]FSPEC is the address of a string containing the file specification of the routine to loa,}d. ADDR is the address to load it at, and LEN, when present, is the maximum length to load. The return code is always set to -}the actual length of the routine. FSPEC and ADDR may be the same.e.g. To load a 100 byte long routine called RTN into a str.}ing.500 REM LOAD RTN510 DIM RTN$(100):RTN=ADR(RTN$)520 RTN$="D:RTN.OBJ"530 A=USR(QLOAD,RTN,RTN,100)540 IF PEEK(195)<>1 /}THEN GOTO ERRORThe LEN parameter is optional. When specifed QLOAD will stop loading after LEN bytes. This can save you from0} accidently loading too large a routine and corrupting your string table.2.3 BIT - Bit Manipulation Routines.The bit ma1}nipulation routines allow you to change to bit settings without using complicated calculations.2.3.1 QAND - Logical AND.2} RC=USR(QAND,ADDR,MASK,[,LEN])ADDR is the address of the data to be changed and LEN is the number of bytes to change. Wh3}en LEN is ommitted then ADDR must be the address of a string, and the current length of the string is used. MASK is the value4} that will be logically ANDed with each byte in the string. In a logical and operation each bit in the byte is compared to th5}e corresponding bit in the mask and is set on if both bits are on. The return code is always set to the length of the field.6}e.g To change a string from inverse video to normal text, the high order bit, D7 must be turned off. To do this AND the stri7}ng with a $7F (127).500 REM INVERSE TO NORMAL510 RC=USR(QAND,ADR(A$),127)2.3.2 QOR - Logical OR. RC=USR(QOR,ADDR,8}MASK[,LEN]This routine is identical to QAND except that the bytes are logically ORed. A logical OR operation tests each bit9} in the byte with the corresponding bit in the mask, and turns the bit on if either bit is on.e.g. To turn a string into in:}verse video, the high order bit, D7, must be turned on. This can be done by ORing the field with a $80 (128)500 REM NORMAL ;}TO INVERSE510 RC=USR(QOR,ADR(A$),128)be turned on. This can be done by ORing the field with a $80 (128)500 REM NORMAL *2.3.3 QXOR - Logical Exclusive OR. RC=USR(QXOR,ADDR,MASK[,LEN])The eXclusive OR differs from the OR in that a bit will?} be set on if it or it's corresponding bit in MASK are on, but not if both are on.e.g. To change inverse video to normal, o@}r normal to inverse, you could XOR a string with $80 (128).500 REM SWAP NORMAL WITH INVERSE510 RC=USR(QOR,ADR(A$),128)2A}.3.4 Logical Operations.Those who are not familiar with bit operations may find the preceding routines confusing. While a fB}ull discussion of logical operators is beyond the scope of this text, you may find the following points useful.The AND operC}ation is used to turn bits off. Every bit you want to turn off must be zero in your mask and every bit you wish to leave unchD}anged must be a one in your mask. i.e To turn off bits D3 and D2 you would need a mask of 11110011 or $F3 (243).The OR operE}ation is used to turn bits on. Each bit you wish to turn on must be a one in your mask, a zero in your mask leaves a bit unchF}anged. i.e. To turn on bits D7 and D6 requires a mask of 11000000 or $C0 (192).The XOR operation is used to flip flop bits,G} on becomes off, off becomes on. Each bit you wish to flip must be a one in your mask, a zero in your mask leaves the bit uncH}hanged. i.e. To flip bits D0 and D7 requires a mask of 10000001 or $81 (129).On the wall of your room is a light switch. ItI} is a simple binary switch similar to a bit. It has two values, 0 or OFF, and 1 or ON. Start with the light off and follow thJ}ese instructions. AND 1, OR 0, XOR 0, XOR 1. If your light isn't on, you are obviously still in the dark , try rereadinK}g this section.2.4 CLEAR - Clear memory. RC=USR(CLEAR,ADDR,LEN[,VAL])This routine sets memory from an address ADDR fL}or a length of LEN to a value VAL. If VAL is ommitted then zero is assumed. This routine is great for clearing data areas andM} tables. Note that value is the ASCII value, to clear to spaces use a 32. One common use of this routine is to clear the grapN}hics portion of the screen, without issuing a GRAPHICS command.e.g. To clear a graphics 7 screen.500 REM CLEAR GR 7510 SO}AVMSC=PEEK(88)+256*PEEK(89)520 RC=USR(CLEAR,SAVMSC,3200)e.g. To clear Page 6 to spaces.500 REM CLEAR P6 TO SPACES510 RP}C=(CLEAR,1536,256,32)Remember that when you change screen memory without going through CIO you must use the Internal valueQ} of the byte, not the ASCII value. The following program will list the internal/ASCII relationship.100 CLR:DIM A$(1):GR. 0R}110 SAVMSC=PEEK(88)+256*PEEK(89)120 ? "INPUT CHARACTER";130 C=SAVMSC+20*PEEK(84)+PEEK(85)+1140 INPUT A$150 ? "CHAR ";A$;"S} ASCI ";ASC(A$);160 ? " INT ";PEEK(C)170 GOTO 1202.5 DEC - Convert to Decimal. RC=USR(DEC,STRADR)STRADR is theT} address of a string containing a hex number in character format. The string may be 0-4 bytes long, if it is longer only the U}first 4 bytes will be used. The return code is set to the decimal equivalent of the number. This routine is similar in purposV}e to the VAL() function in BASIC, only for Hex instead of decimal. This routine will set the error code to three if it encounW}ters a non-valid character.e.g. Lets print 255 on the screen in a roundabout way.500 REM PRINT 255510 A$="FF":? USR(DEC,X}ADR(A$))2.6 DPEEK - Double PEEK. RC=USR(DPEEK,ADDR)This routine will set the return code to the value of the word Y}at address ADDR. I often use a call to DPEEK just to disable the break key.e.g. The address of the beginning of the screen Z}is kept in a pointer called SAVMSC $58,59 (88,89). The statement100 A=USR(DPEEK,88)is exactly the same as,100 A=PEEK(88[})+256*PEEK(89)only slightly faster and shorter.2.7 DPOKE - Double POKE Routines.The DPOKE module contains two closely\} related routines, DPOKE and MPOKE.2.7.1 DPOKE - Double POKE. RC=USR(DPOKE,A1,V1[,A2,V2....])DPOKE will POKE the wor]}d A1 with the value V1 and the word A2 with the value V2. You may specify as many pairs of parameters as you can fit on one l^}ine. The main advantage of using DPOKE over a whole slew of POKE statements is that the bytes are changed virtually simultane_}ously. This produces much crisper changes when setting multiple sound registers or setting up animation. The return code is s`}et to the value of the last word changed, before it is changed.e.g. The Statement100 A=USR(DPOKE,1536,258,1538,1)is exaa}ctly equivalent to,100 A=USR(DPEEK,1538):POKE 1536,2:POKE 1537,1:POKE 1538,1:POKE 1539,02.7.2 MPOKE - Multi POKE Routineb}. RC=USR(MPOKE,A1,V1[,A2,V2....])The MPOKE routine is identical to the DPOKE routine except that it only changes a singc}le byte if the value is less than 256. The return code will be set to the start value of the last byte or word, depending on d}the last value.e.g. The Statement100 A=USR(MPOKE,1536,258,1538,1)is exactly equivalent to,100 A=PEEK(1538):POKE 1536,e}2:POKE 1537,1:POKE 1538,12.8 DUMP - Memory Dump Routines.This module contains five routines, DUMP40, DUMP40P, DUMP80, Df}UMP80P and HEX. The first four of these routines are very similar.2.8.1 DUMP40 - Convert memory to Display format. RCg}=USR(DUMP40,RELADR,FROM,TO)TO is the address of a string to hold the converted data, FROM is the address to DUMP from. RELAq} ?B%DOS SYSB-)AUTORUN SYSB VFONT SETB[_DOC 000BODOC 001B6DOC 002B4>DOC 003B5{DOC 004B0DOC 005B.DOC 006B[DOC 007BNlDOC 008<PCTEMP 1 TAIL1DOC010TAIL1DOC011TAIL1DOC012!TAIL1DOC013TAIL1DOC014+TAIL1DOC0150@TAIL1DOC016"pTAIL1DOC017-TAIL1DOC018DR is the relative or display address of FROM. When this routine is called it takes 8 bytes from address FROM and converts thr}em into full display format. First it converts the RELADR to hex and moves it, then it moves the 8 bytes in hex format. Next s}it moves the 8 bytes in character format, replacing any bytes that cannot be displayed to a period. The resulting string, TO,t} is 34 bytes long, in character format all ready to print. The resulting output looks very like the hex dumps I see all too fu}requently on the large mainframe at work.DUMP is the ideal way to display memory on the screen, it is extremely useful whenv} testing programs that build tables. The DUMPUTIL.BAS program makes extensive use of the DUMP routines.RELADR is normally tw}he same as FROM when dumping memory. RELADR comes into play when dumping files or tables. The address you wish to print is thx}e relative address of the byte within the file, not the address of the buffer in which it is stored.e.g. To Dump the entirey} contents of memory to the screen.500 REM DUMP ALL510 FOR I=0 TO 65535 STEP 8520 A=USR(DUMP40,I,I,ADR(A$)):? A$530 NEXT z}I QXOR - Logical Exclusive OR. RC=USR(QXOR,ADDR,MASK[,LEN])The eXclusive OR differs from the OR in that a bit will2.8.2 Other DUMP routines.The other DUMP routines are almost identical to DUMP40. DUMP40P is for a 40 column non Atari prin|}ter, it changes a few more characters to periods, because they won't print properly. DUMP80 converts 16 bytes at a time and r}}eturns a 62 byte long string. This is for 80 column Atari printers and DUMP80P is for 80 column non Atari printers.2.8.3 H~}EX - Convert Characters to a Hex String. RC=USR(HEX,VAL,STRADR)This routine is the opposite of the DEC routine, and si}milar to the STR$() function, but the string is formatted in hex. VAL is the value to convert and STRADR points to a string t}o receive the result. The string formed is always 4 bytes long. Since the DUMP routines are quite long, HEX is also available} in its own module.e.g Lets reverse the DEC example and print "00FF" on the screen.500 REM PRINT 00FF510 A=USR(HEX,255,A}DR(A$)):? A$2.9 FINDC - Find Character in String. RC=USR(FINDC,ADDR,VAL[,LEN])FINDC is the simplest of the parsing} routines. ADDR is the address to start searching at, VAL is the ASCI value of the character you are looking for, and LEN is }the length to search. If LEN is ommitted then ADDR must be the address of a string and the current length of the string is us}ed. Return code is set to the position of the first occurrence of that character in the string. If the character is not found} then return code is zero.e.g. To find the first space in a string.500 REM FIND SPACE510 A=USR(FINDC,ADR(A$),32)e.g. A} good use for FINDC is to find a one character command in a table. This is very common in menu driven programs and is a very }clean fast and efficent way of coding. Suppose entries ASDFGH were valid entries, then a good structure would be:1000 REM C}OMMAND1010 W$="ASDFGH":GOTO 1100+100*USR(FINDC,ADR(C$),ADR(W$))1100 REM ERROR1200 REM A1300 REM Sand so on. This is a l}ot faster than using a slew of IF statements and uses much less memory.2.10 FSPEC - Format File Specification. RC=US}R(FSPEC,STRADR[,DRIVE[,EXT]])This routine will format a valid file specification. STRADR is the address of the unformatted }file specification and the string to hold the result. You will get a string error in ERRSAVE if the string isn't large enough} to hold the result. DRIVE when specified is the default drive number, when ommitted drive 1 is used. EXT when specifed the a}ddress of a three byte string containing the default file extender. When EXT is specified, DRIVE must be present. Return code} contains the new length of the string. It is usually a good idea to use the TRIM routine to remove trailing spaces before yo}u call FSPEC.When formatting a file specification, if the string doesn't contain a device spec then one is added. If EXT wa}s specifed then it is added too, unless the string already has one.e.g. To take an unformatted file extender and get it to }default to drive 2 with an extender of OBJ.500 FORMAT FILE SPEC510 E$="OBJ"520 A=USR(FSPEC,ADR(A$),2,ADR(E$)) Before} After TEST D2:TEST.OBJ D:FILE D:FILE.OBJ AARDVARK.SYS D2:AARDVARK.SYS D}1:DRAGON. D1:DRAGON.2.11 GPBYTE - Get/Put Byte Routines.The get/put routines are extensions of the BASIC GET and }PUT commands. They provide common I/O functions normally for disk usage. These routines can also be used with screen or print}er but they don't work very well with cassette, because they are too fast. The IOCB used must have been previosly opened. The} routines return all normal CIO error codes including End Of File. Please note that for some reason, not documented anywhere,} CIO returns a 3 when the very last byte of a file is read. These comments also apply to the GPWORD and GPSTR routines.2.1}1.1 GBYTE - Get a block of bytes. RC=USR(GBYTE,IOCB,BUF,LEN)This routine will get LEN bytes from IOCB and store them a}t BUF. The return code contains the actual number of bytes read.e.g. To read 256 bytes into page 6 from IOCB 1.500 REM RE}AD PAGE 6510 A=USR(GBYTE,1,1536,256)520 IF PEEK(195)>3 THEN GOTO ERROR2.11.2 PBYTE - Put a block of bytes. RC=USR(PB}YTE,IOCB,BUF,LEN)This routine will write LEN bytes from BUF to IOCB. The return code contains the actual number of bytes wr}itten.e.g. To write 256 bytes from page 6 USING IOCB 2.500 REM WRITE PAGE 6510 A=USR(PBYTE,2,1536,256)520 IF PEEK(195)<}>1 THEN ERROR2.12 GPSECT - Get/Put Sector.The two GPSECT routines GSECT and PSECT do direct sector I/O and ignore norma}l file handling by DOS. Please be extremely careful using PSECT, if you tell it to write a sector in the middle of a file, it} will do so, and unless that was what you intended, you can wave goodbye to your data. The section on DUMPUTIL.BAS contains m}ore information on Sectors and Disk I/O.2.12.1 GSECT - Get a Sector. RC=USR(GSECT,DRIVE,SECT,BUF)This routine will }get the 128 byte long sector number SECT from DRIVE and store it at address BUF. DRIVE is the drive number (1-8) and SECT is }the sector number (1-720 DOS 2.0S, 1-1010 DOS 2.5).e.g. To get the first directory sector, sector 361, from drive 1 and sto}re it in page 6.500 REM GET SECTOR510 A=USR(GSECT,1,361,1536)520 IF PEEK(195)<>1 THEN ERROR2.12.2 PSECT - Put Sector }to drive. RC=USR(PSECT,DRIVE,SECT,BUF)PSECT will write the 128 bytes from address BUF to sector number SECT on drive n}umber DRIVE. Using PSECT you can trash a disk full of data in the blink of an eye, please be careful.e.g. Using GSECT and P}SECT we can write a simple sector copier to make a copy of disk in drive 1 on disk in drive 2. DOS 2.0S is assumed.500 REM }COPY DISK510 FOR I=1 TO 720520 A=USR(GSECT,1,I,1536)530 IF PEEK(195)=1 THEN A=USR(PSECT,2,I,1536)540 NEXT I2.13 GPSTR} - Get/Put String.2.13.1 GSTR - Get a string. RC=USR(GSTR,IOCB,STRADR)GSTR will read a block of bytes into a string }at address STRADR using IOCB. The length used is the max length of the string and both the current length of the string and t}he return code are set to the actual length read.e.g. To read 100 bytes into string A$ on IOCB 1.100 DIM A$(100)500 REM} READ STRING510 A=USR(GSTR,1,ADR(A$))520 IF PEEK(195)>3 THEN GOTO ERROR2.13.2 PSTR - Put a block of bytes from a string}. RC=USR(PSTR,IOCB,STRADR)This routine will write a block of bytes from the string at STRADR to IOCB. The length writt}en is the current length of the string and return code is set to the actual length written.e.g. Write the contents of strin}g A$ to IOCB 2.500 REM PUT STRING510 A=USR(PSTR,2,ADR(A$))520 IF PEEK(195)<>1 THEN GOTO ERRORte the contents of strine2.14 GPWORD _ Get/Put Word Routines.2.14.1 GWORD - Get a word from device. RC=USR(GWORD,IOCB)GWORD will read a word !}from IOCB (low byte/high byte) and put value in return code.e.g. To read a word from IOCB 1.500 REM READ WORD510 A=USR(G!}WORD,1)520 IF PEEK(195)>3 THEN GOTO ERRORis exactly equivalent to,500 REM READ WORD510 TRAP ERROR:GET #1,X:GET #1,Y:A=2!}56*Y+X2.14.2 PWORD - Put a word to device. RC=USR(PWORD,IOCB,VAL)PWORD will write word VAL to IOCB. Return code is!} set to value.e.g. To write 1536 to IOCB 2.500 REM WRITE WORD510 A=USR(PWORD,2,1536)520 IF PEEK(195)<>1 THEN ERROR2!}.15 INPUT - Keyboard Input Routines.The keyboard input routines are all variants of the Basic INPUT command, but provide th!}e user with greater control and pre edited input. Once you get used to these routines you will probably never use INPUT again!}. The keybord routines will work on a Graphics 0 screen or in a text window.The Basic INPUT command has a few idiocyncrasie!}s that make it less than ideal in games and utilites. The user can enter upper, lower or inverse video at any time, and the p!}rogram has to handle it. If you are using a formatted screen with windows, the user can type CTL-Clear or SHIFT-Delete and me!}ss up the screen. If the arrow keys are used to leave and return to the current line, the INPUT command returns the entire in!}put line, prompts and all, instead of just the characters typed.The input routines create a text window on the screen, and !}keep all cursor activity within that window. They ignore unwanted keys and modify others. SHIFT-clear and CTL-Clear, clear on!}ly the window, not the whole screen. Inverse video is disabled. An address called CRSINH at 752 turns the cursor on and off. !}POKE 752,0 turns it on, POKE 752,1 turns it off, but the effect is not visible until the next screen I/O. All these routines !}turn the cursor on before the first character is input and turn it off again before returning to Basic.Although these routi!}nes use CIO to access the keyboard, and return normal CIO errors, these errors are virtually impossible to get in a tested pr!}ogram, and I usually don't bother checking for them. Some of these routines use ERRSAVE to pass back information to the Basic!} program. When control is returned to Basic, the cursor is positioned at the beginning of the following line, just like the I!}NPUT statement.2.15.1 INPA - Input a character. RC=USR(INPA,STRADR[,DEF])STRADR is the address of a string contain!}ing valid input characters. DEF is the ASCII value of the character to return if RETURN is pressed. If DEF is omitted then RE!}TURN is ignored. This routine gets a single character from the keyboard and returns it's ASCII value in return code. The curs!}or is hot, i.e the routine comes back to Basic as soon as a valid key is pressed, you don't have to type return.e.g. Get a !}Y/N answer from the user, default to "N".500 REM Y/N510 A$="YN"520 A=USR(INPA,ADR(A$),78)2.15.2 INPC - input a charac!}ter from keyboard. RC=INPC,MIN,MAX,[,DEF])INPC returns a single character from the keyboard with a hot cursor effect, !}similar to INPA. MIN is the ASCII value of the lowest key you are interested in, MAX is the ASCII value of the highest. DEF i!}s the same as for INPA. The return code contains the ASCII value typed.e.g. Input a menu selection from 0 to 9 from the use!}r, default to 0.500 REM GET MENU SELECTION510 A=USR(INPC,48,57,48)2.15.3 INPLOW Input a string from the keyboard. !}RC=USR(INPLOW,ADR[,LEN])This routine will return the specifed number of characters from the keyboard and put them, left jus!}tified, at address ADR. Return code will contain the actual number of characters. If ADR is the address of a string then the !}string length is set. This routine does not use a hot cursor, return must be pressed.The maximum length of the input is the!} shorter of the length specified, the maximum length of the string or the number of characters between current cursor positio!}n and right margin minus 1.e.g. To get a string from the keyboard.500 REM INPUT STRING510 A=USR(INPLOW,ADR(A$))2.15.!}4 INPLOWA - Input a string from the keyboard. RC=USR(INPLOWA,ADR[,LEN])INPLOWA (Automatic) is the hot cursor version of!} INPLOW. It is used to give a formatted screen effect when getting lots of data from the keyboard. Control is returned to Bas!}ic when the return key is pressed, the up/down arrows are pressed or the cursor leaves the text window. ERRSAVE (195) is set !}to inform Basic of how the routine was exited. The return key sets ERRSAVE to 1. The up arrow or exiting window to the left s!}ets ERRSAV to 2. An ERRSAVE value of 3 is set if the down arrow is pressed, or the window is exited to the right. The WINDOWS!}.BAS demo shows how you can use this routine to set up an "input form" type of screen.2.15.5 INPSTR - Input a string from!} keyboard. RC=USR(INPSTR,ADR[,LEN])This routine is identical to INPLOW but it restricts input to UPPER case. This is t!}he input routine you will use most frequently.e.g. To get a filename into string F$500 ? "Filename?";:A=USR(INPSTR,ADR(F$!}))2.15.6 INPSTRA - Input string from keyboard. RC=USR(INPSTRA,ADR[,LEN])INPSTRA is identical to INPLOWA except tha!}t it restricts input to UPPER case.2.16 MOVE - Move Memory. RC=USR(MOVE,FROM,TO,LEN)This routine will move LEN byt!}es from address FROM to address TO. The return code is set to the length moved. Since this routine is fundementally for table!} handling, string lengths will not be checked or set, even if FROM or TO are the addresses of strings. This routine guarantee!}s a non destructive move, even if the memory locations overlap. e.g. To move 256 bytes from string A$ to page 6.500 REM SA!}VE PAGE510 A=USR(MOVE,ADR(A$),1536,256)which is exactly equivalent to:500 REM SAVE PAGE510 FOR I=0 TO 255:POKE 1536+I,P!}EEK(ADR(A$)+I):NEXT Ibut a lot faster.ich is exactly equivalent to:500 REM SAVE PAGE510 FOR I=0 TO 255:POKE 1536+I,P ,n error occurred and so a TRAP statement won't detect these errors, you have to check for them yourself.e.g.400 REM NORM }AL BASIC ERROR HANDLING410 TRAP 900:OPEN #1,4,0,"P:"500 ROUTINE ERROR CHECKING510 A=USR(RTN,P1,P2):IF PEEK(195)<> 1 THEN } 900900 REM COMMON ERROR ROUTINE910 PRINT "ERROR ";PEEK(195);" AT LINE ";PEEK(186)+256*PEEK(187)920 END195)<> 1 THEN p2.17 PARSE - String Parsing Routines.The string parsing routines, PARSE and WORD, break free format text data into fixed fo%}rmat text data. These routines have two main uses, parsing input command lines so that the program can interpret the commands%} easily, and parsing output print lines for column alignment.2.17.1 PARSE - Break words out of string. RC=USR(PARSE,F%}ROM,TO,DEL,L1[,L2,L3,L4,L5])FROM is the address of the string containing the unformatted text. TO is the address of the str%}ing to contain the result. DEL is the address of the string containing the delimiter characters. L1 is the max length of the %}first word, L2 the max length of the second word, and so on. You may use PARSE to break out up to five words. The resulting s%}tring TO may be up to 255 bytes long (i.e. L1+L2+L3+L4+L5<=255). Words that are shorter than the length requested will be lef%}t justified and space padded, words that are longer will be truncated. The return code will be set to the actual number of ch%}aracters returned of the last word passed. The length of TO will be set to L1+L2+L3+L4+L5.You may use any characters as del%}imiters, (space, comma, return, etc), and you may have as many delimiters as you want. If space is a delimiter it is treated %}differently from all other delimiters. Multiple spaces are treated the same as one space, and if spaces are combined with ano%}ther delimiter, the spaces are ignored completely. This sounds awful when you describe it but it is really quite simple. Cons%}ider the following five strings. "TAKE CAKE", "TAKE CAKE", "TAKE,CAKE", "TAKE , CAKE" and TAKE ,, CAKE". If space and%} comma are used as a delimiter, the word "CAKE" is the second word in the first four examples, because any combination of a s%}pace or comma with more spaces is treated as a single delimiter. In the final string, "CAKE" is the third word, because multi%}ple commas are not ignored. This allows you to design command lines that have optional parameters, and omit them by typing mu%}ltiple delimiters. Spaces before the first word are ignored, other delimiters before the first word are not.e.g. In the a%}dventure, Dragon Quest, I was only interested in the first 3 letters of the first 2 words.500 REM GET COMMAND510 A=USR(INP%}STR,ADR(A$))520 D$=" ":A=USR(PARSE,ADR(A$),ADR(B$),ADR(D$),3,3)530 RETURN A$ Contains B$ Contains TAKE CAKE %} "TAKCAK" LOOK DRAGON "LOODRA" LOOK IN BOX "LOOIN " NORTH "NOR "e.g. A utility pro%}gram may want a 1 byte command, followed by a 1 byte sub command, followed by up to two parameters, which may be file names. %}Spaces or commas may be used as delimiters.500 REM GET COMMAND510 A=USR(INPSTR,ADR(A$)520 D$=" ,":A=USR(PARSE,ADR(A$),ADR%}(B$),ADR(D$),1,1,15,15)530 CMD$=B$(1,1)540 SCMD$=B$(2,2)550 F1$=B$(3,17)560 F2$=B$(18,32)570 RETURN2.17.2 WORD - Bre%}ak a word out of a string. RC=USR(WORD,FROM,TO,DEL,NO,L1)WORD is a close relative of PARSE. FROM, TO, DEL and L1 have %}much the same meaning and usage. NO is the number of the single word, WORD will return. Return code is set to the actual numb%}er of characters of the word returned. The "word" may be up to 255 bytes long.WORD can be used to force a string to be a ce%}rtain length. Another interesting use is to break records out of a buffer by using a delimiter of ASCII 155. You could use a %}period as a delimiter to break sentences out of a paragraph, then use comma as a delimiter to break clauses out of the senten%}ce, and so on. WORD and PARSE can easily be used to support quite sophisticated text handling functions.e.g. To look at the&} tenth word in a block of text. It may be up to 20 characters long and space is used as a delimiter.500 REM TENTH WORD510 &}D$=" ":A=USR(WORD,ADR(A$),ADR(B$),ADR(D$),10,20)e.g. To handle a text file one word at a time, using all common punctuatio&}n and spaces as delimiters.500 REM NEXT WORD510 D$=" ,.?;:!"520 A=USR(WORD,ADR(A$),ADR(B$),ADR(D$),I,20)530 I=I+1:RETURN&}2.18 SHUFFLE - Rearrange Memory. RC=USR(SHUFFLE,ADDR,LEN)SHUFFLE randomly rearranges LEN bytes starting at address&} ADDR. Return code has no special meaning. e.g. Suppose we had a standard deck of cards held in a string DECK$ with each by&}te representing a particular card. We can use this routine to SHUFFLE the deck.500 REM SHUFFLE DECK510 A=USR(SHUFFLE,ADR(D&}ECK$),52)520 RETURN2.19 TRIM - Trim Trailing Characters. RC=USR(TRIM,STRADR[,CHVAL])TRIM will remove trailing char&}acters from a string, and set the length of the string. CHVAL is the ASCII value of the character to remove. If CHVAL is ommi&}tted then space (ASCII 32) is assumed. The return code is set to the new length of the string.e.g. The WORD routine will re& }turn a single word, left justified, with trailing spaces. TRIM can be used to remove those spaces. Suppose string TEXT$ conta& }ins a list of words, of varying lengths, separated by spaces. The longest word is 16 characters long and there are 1000 words& }. Lets write a routine which will return in A$ a randomly selected word.500 REM PICK WORD510 R=1+INT(1000*RND(0)):D$=" "5& }20 A=USR(WORD,ADR(TEXT$),ADR(A$),ADR(D$),R,16)530 A=USR(TRIM,ADR(A$)):RETURN2.20 WAIT - Wait for N Jiffies. RC=USR(& }WAIT,JIFS)WAIT will pause for JIFS jiffies (1/60 Second = 1 Jiffy) and then return to Basic. It allows much more precise ti&}mings than Basic loops, for music, sound effects and animation.e.g. Pause for 1/2 second.500 REM HALF SECOND PAUSE510 A=&}USR(WAIT,30):RETURN2.21 WAITS - Wait for N Seconds. RC=USR(WAIT,SECS)WAITS is the same as WAIT, but the duration is&} specified in seconds.e.g. Pause for 10 seconds.500 REM 10 SECOND PAUSE510 A=USR(WAITS,10):RETURN data into fixed fo$j2.22 Quick Reference Summary.In Alphabetical order by routine. USR(CLEAR,ADDR,LEN[,VAL]) USR(DEC,STRADR) *} USR(DPEEK,ADDR) USR(DPOKE,A1,V1[,A2,V2....]) USR(DUMP40,RELADR,FROM,TO) USR(DUMP40P,RELADR,FROM,TO)*} USR(DUMP80,RELADR,FROM,TO) USR(DUMP80P,RELADR,FROM,TO) USR(FINDC,ADDR,VAL[,LEN]) USR(FSPEC,STRADR*}[,DRIVE[,EXT]]) USR(GBYTE,IOCB,BUF,LEN) USR(GSECT,DRIVE,SECT,BUF) USR(GSTR,IOCB,STRADR) USR(GWORD*},IOCB) USR(HEX,VAL,STRADR) USR(INPA,STRADR[,DEF]) USR(INPC,MIN,MAX,[,DEF]) USR(INPLOW,ADR[,LEN])*} USR(INPLOWA,ADR[,LEN) USR(INPSTR,ADR[,LEN] USR(INPSTRA,ADR[,LEN]) USR(MOVE,FROM,TO,LEN) US*}R(MPOKE,A1,V1[,A2,V2....]) USR(PARSE,FROM,TO,DEL,L1[,L2,L3,L4,L5]) USR(PBYTE,IOCB,BUF,LEN) USR(PSECT,DRI*}VE,SECT,BUF) USR(PSTR,IOCB,STRADR) USR(PWORD,IOCB,VAL) USR(QAND,ADDR,MASK,[,LEN]) USR(QLOAD,FSPEC*},ADDR[,LEN]) USR(QOR,ADDR,MASK[,LEN]) USR(QXOR,ADDR,MASK[,LEN]) USR(SHUFFLE,ADDR,LEN) USR(TRIM,ST*}RADR[,CHVAL]) USR(WAIT,JIFS) USR(WAITS,SECS) USR(WORD,FROM,TO,DEL,NO,L1)3. THE PROGRAMS.There are *}ten programs included on this disk for your use and entertainment. All except two of these programs use the TAIL routines. Th*}is section discusses how to use the programs and introduces some concepts for your consideration. This section does not go in*}to any detail about how the programs work. The programs are all clearly written and commented, and the source code is not pro*}tected in any way. If you want to know more about how any of the programs work, simply list them.All the programs use a lib*}rary module called TEXT.OBJ which contains all the routines on the disk. Since none of the programs are particularly large, t* }here is no problem using a module that contains more routines than actually needed. The TEXT.OBJ module was built using the B*!}UILDER utility and TEXT.LST is the Basic code generated.3.1 AUTORUN.BAS - Loader Program.The AUTORUN.SYS file automatic*"}ally runs any program on the disk called AUTORUN.BAS. This can be any Basic program you like. Normally I use a one line progr*#}am that runs the real program. The AUTORUN.BAS program on this disk is:100 RUN "D1:TAILMENU.BAS"I could have simply calle*$}d the Menu program AUTORUN.BAS, and avoided the extra step, but I prefer to do it this way. Every disk in your library could *%}easily contain an AUTORUN.BAS program. Many different programs and all have the same name. It is only a matter of time before*&} you delete or overwrite one by mistake. When the program you lost is only a one liner that took you ten seconds to write in *'}the first place, big deal, but if the program you lose was the real program, better reach for the crying towel. As a general *(}rule, all programs that took time to design, code and test, get unique names and I use one liners as the AUTORUN.BAS program,*)} it is safer that way.3.2 TAILMENU.BAS - Disk Menu.This program is just a simple menu to give you easy access to the ot**}her programs on the disk. This program is a classic demonstration of how easy it is to set up a menu using the INPUT routines*+}.3.3 BUILDER.BAS - Create Custom Libraries.The BUILDER Utility is used to build custom modules for your programs. First *,}the module asks you which routines you want to include. Just answer Y or N (Default) at the prompts. Then it gives you a repr*-}ise of your selection and verifies your choice. Then the program builds the module you designed from the individual routines *.}on disk. Then the program asks you to mount your saved disk and asks you for a file name, (default D1:name.OBJ). It then writ*/}es the object module out to your disk. Then BUILDER asks you for another filename, (default D1:name.LST). It also asks you fo*0}r a string name, starting line number, and increment. It then uses these parameters to build a Basic subroutine to load your *1}new module, and writes that routine to the disk. Then the whole cycle repeats so you can build another module.For example, *2}the TEXT.OBJ and TEXT.LST files on this disk were created using the BUILDER utility. To build them I answered Y to all the Y/*3}N prompts (except HEX which was already included in DUMP), typed "TEXT" to the two filename prompts and the string name promp*4}t. The starting line is 20000 with an increment of 10.As you can see, this makes it extremely easy to mix and match routine*5}s for your particular needs. Although the routines on any particular volume of the library, could probably all be resident in*6} memory for most programs, the entire library is huge. The BUILDER program will easily expand as new volumes are released.T*7}he program itself contains much of interest. The use of INPA for Y/N prompts has become standard in my programs of late, as i*8}s the use of INPSTR for other information. FSPEC was used for the drive and extender defaults. One neat use of TRIM is to rem*9}ove the $ at the end of the string name, in case you typed one. Notice how the entire program is driven by a single DATA tabl*:}e at line 6000. Each stage in the build process reads this table and uses the PARSE routines to break out just the data it ne*;}eds. This makes it very easy for me to expand this program for later volumes.3.4 PROTECT.BAS - Protect Your Code.As I e*<}xplained in detail earlier, I won't allow programs written using the TAIL routines to be distributed in a listable form. This*=} is an unfortunate commercial necessity. The PROTECT utility allows you to render your programs unlistable, and meet my publi*>}shing criteria.First save a copy of your program to disk. Then run the PROTECT utility, give it your file name (default D1:*?}name.BAS), The name of the module you wish to create, Protect or Unprotect and a secret password. Protecting the program will*@} render it totally unlistable. Unprotecting it WITH THE SAME PASSWORD will return your original code.I recommend you keep a*A} separate version of your program, and not rely on the unprotect feature, because if you make a mistake typing the password, *B}your program will go into program hyperspace and never return. I included the unprotect feature for programmers that want to *C}put their code in the public domain. You can publish the password as part of your documentation. Your code will then be unlis*D}table to anyone who has not bought the TAIL routines, and my copyright will be protected.3.5 LISTPROG.BAS - Format Your Li*E}stings.LISTPROG will list a Basic program to a printer in a readable format. This program is the odd one out. It does not u*F}se the TAIL routines. In fact, it was written ages ago, but it is so extraordinarily useful that I decided to include it here*G}.Almost every programming language I have ever worked with has a set of listing formatting commands. In the commercial prog*H}ramming world a key factor is maintainability. How easy is the program to change. It is much easier to read a listing that is*I} nicely spaced out, the program is easier to understand, and therefore easier to maintain.ATARI Basic has no listing format*J}ting commands at all. The listings just go on for page after page, over the page perforations and off into the sunset. This m*K}akes life unnecessarily difficult when going back to a program you haven't worked on in a while.To use LISTPROG, first LI*L}ST your program to disk, then run LISTPROG. LISTPROG dates and page numbers your listings, with up to 3 heading lines at the *M}top of each page. LISTPROG highlights comments, data statements and the like, inserting blank lines to make your routines sta*N}nd out. It edits your lines, into neat vertical columns, separating code from line numbers. If a line is too long to print on*O} a single line it tries to split it at a sensible place. The program looks ahead to some extent, and tries not to change page*P} in the middle of a routine. Each line is checked for unprintable graphics and they are replaced by a default character. Last*Q}ly it gives you a nice wide margin, so you can keep your listings in a 3-ring binder. LISTPROG listings are a lot nicer to *R}work with than the output of the list command. Why not try it on the programs on this disk? Most of my programs are structure*S}d in a very similar way. I tend to write my code in small routines, each of which has a particular function, with a one line *T}comment to remind me what the routine does. This produces programs which are very easy to modify and debug. By a strange coin*U}cidence, LISTPROG works best on programs that are structured this way.This program was written for an EPSOM MX80 printer an*V}d should work on most centronics standard printers. All the printer control codes are assigned to strings so it should be ver*W}y simple to change, if your printer uses different codes.When listing finished programs for the archives, I use an XREF uti*X}lity to create an XREF on the disk. LISTPROG can read that XREF and append it to your listing. I also do a lot of work in MAC*Y}65, and this utility will also format MAC65 listings.3.6 DUMPUTIL.BAS - A View Inside Your Atari.The DUMPUTIL utility i*Z}s a memory, file or sector display program. It uses the DUMP routines to produce hex displays or dumps of the desired informa*[}tion. You can display the information on the screen or a printer. Use CONTROL-1 to stop/start the display.Enter an M to dum*\}p memory. The starting address can be entered in hex or decimal, just precede a hex number with a $ sign. The end address can*]} be entered the same way, or entered as a displacement by preceding it with a + sign. e.g. To dump 128 bytes from page 6. Ent*^}er a starting address of 1536 or $600, enter an end address of 1663 or $67F or +127 or +$7F.Enter an F to dump a file and e*_}nter a filename (default D1:). e.g. Enter DUMPUTIL.BAS to look at this program on disk.Enter an S to dump a sector then giv*`}e it a drive and sector number. Your disk is organised into a number of 128 byte sectors. DOS 2.0 has sectors 1-720, DOS 2.5 *a}has 1-1010. e.g. Enter 361 to look at the first directory sector.A listing of the various memory addresses within your ATAR*b}I is beyond the scope of this document, but there are many excellent books on the subject. Mapping the ATARI by Ian Chadwick *c}is one of the best. DOS is not covered as well, the books range from trivial to the source listing without much in the middle*d}. For that reason, I am including a brief overview of DOS here.DOS 2.0 has four types of sectors. The first type is the boo*e}t sectors (1-3). These sectors contain information that is essential to the functioning of DOS and must be on the disk in dri*f}ve 1 when the computer is turned on.The second type of sector is the file sector, and these take up most of the disk. Each *g}file sector contains up to 125 bytes of data with 3 bytes of control information at the end. Bits D2-D7 of the first control *h}byte contain the file number. Bits D0 and D1 of this byte are multiplied by 256 and added to the second control byte to find *i}the next sector in the file. The last control byte contains the number of bytes of data in this sector in bits D0-D6. This fi*j}gure does not include the 3 control bytes. Bit D7 of the last control byte is set on when the sector is not full. A normal fi*k}le sector will have a value of $7D in this position.routine. USR(CLEAR,ADDR,LEN[,VAL]) USR(DEC,STRADR) (8The third type of sector is the VTOC (Volume Table of Contents) sector (360). Byte 0 of this sector identifies the DOS editio.m}n, DOS 2.0 has a 2 here. Bytes 1 and 2 contain the number of file sectors when the disk is empty, normally 707. Bytes 3 and 4.n} contain the number of free file sectors left. Bytes 10-99 contain the sector map. Each bit represents a sector. The bit is o.o}n (1) if the sector is free and off (0) if the sector is used. The leftmost bit (byte 10 bit D7) is sector 1. The next bit (b.p}yte 10 bit D6) is sector 2 and so on.The last type of sector is the directory sector (361-368). Each directory sector conta.q}ins eight 16-byte entries. Byte 0 is a status byte. D0 is on if the file is currently open, Byte D1 on says that it is a DOS .r}2.0 format disk. D5 on means that the file is locked. D6 on shows that the entry points to a valid file. D7 on means the file.s} has been deleted. Bytes 1 and 2 contain the total number of sectors in the file, while bytes 3 and 4 point to the first sect.t}or in the file. Bytes 5-15 contain the file name and extension.Due to a mix up in the design of DOS 2.0, sector 720 is not .u}used by DOS but can be accessed by GPSECT. Feel free to make creative use of this sector. As far as I know, DOS 2.5 is identi.v}cal to 2.0 except that there are more sectors and a longer VTOC map. I wonder if it has a dead sector? WARP DOS is also ident.w}ical, but it has more Boot sectors. DOS 3 probably won't work. Who cares! Real programmers don't use DOS 3!!If you don't al.x}ready have a disk fixing utility then you could easily modify this one. I use DISKEY by Sparky Starks (Adventure Internationa.y}l), and wrote this utility purely as a demo, but the TAIL routines actually provide every feature you need. If you do add dis.z}k modifing commands and use PSECT, please make a copy of your disk before you start!!3.7 HEXCALC.BAS - Hexadecimal Calcul.{}atorHEXCALC is a full function Hex/Decimal printing calculator, similar in most ways to the one in your wallet, briefcase o.|}r desk. All the functions are shown on the screen so why not just play around. You will soon get the idea.There are two mai.}}n differences between this program and a calculator. The first is that all numbers entered must have a function, even the fir.~}st. i.e. enter first number as +10 not 10. The second is the way that it handles rounding. Numbers are always stored in full .}format and rounding only effects the way they are displayed. This can be amusing. Set the display to 0 decimal places, then a.}dd 1.4 to 1.4. The display says 1 + 1 = 3. What is really happening is that 1.4 is added to 1.4 giving 2.8 which rounds to 3..}I always find the memory function on a calculator useful, but I always forget what I stored in there. HEXCALC's 10 visible .}memory cells are a real boon. You can recall these cells as part of a calculation if you like. e.g. +R3 or *R1.If you often.} find yourself doing particular types of calculations, morgage costs, statistical analyses and the like, why not just add fun.}ctions to this program to meet your particular needs.3.8 WINDOWS.BAS - Demo of Input Windows.This program is truly a de.}mo, and serves no other function. When it is run it displays a screen of the normal sorts of information a name and address f.}ile might carry. WINDOWS shows how you can use the automatic input functions to get a full screen of related information from.} the keyboard. In this example the cursor movement keys are used to move between fields and return is pressed when the entire.} record is complete. The program doesn't do anything with the information you enter I'm afraid, databases and table handling .}may be covered in a later volume of the library.Type on the keyboard. Make some entries. Hold dowm the space key or the arr.}ow keys and watch the cursor move. Play around until you get a feel for what the program is doing, then press RESET and list .}the program. See how simple the code is to support a complex multi field screen. In your programs you might prefer to treat t.}he return key the same as the down arrow and use something else to indicate the record is complete, the start key perhaps. It.} is very easy to hit return by mistake.3.9 AFRICA.BAS - An ATARI Safari.AFRICA is probably the most complex program on .}the disk. It uses the 1K buffer at $2800 (10240) for a redefined character set. It also makes good use of the SHUFFLE routine.}. To play this game you need a joystick in port 1. This game combines elements of arcade games, elements of roll playing game.}s and elements of adventures into a unique game that is hard to classify, though I call it a mini-adventure.At the top of t.}he screen is your current score and level, and the hi-score this session. At the bottom of the screen is your strength, water.}, ammunition and treasure. You can never have more than 7 of anything but treasure. In the middle is your treasure map. The m.}ap consists of a jumble of green and bright yellow characters. Your position is shown by a flashing hunter figure and your tr.}ail is marked by blue hunters. Just move the joystick in the direction you want to go. As you move to a new position the game.} will tell you what you found there. Each letter stands for a different type of terrain. each type of terrain has a differe.}nt effect on your status. Waterholes restore some water and strength, deserts use a lot of water, lions use up ammunition, th.}ieves steal your treasure, and so on. Most of the bright letters are helpful and contain treasure. One of the bright letters .}is the Lost City and your objective is to find it. If you stay too long on one spot, you drink some of your water and gain st.}rength. This also happens when you press the joystick button. If you are out of water your strength slowly fades away.When .}you find the Lost City you go on to the next level, the board is shuffled and so are the meanings of the characters, and you .}set of in search of the new Lost City. Your score continues on climbing through the levels until you die. When your strength .}or water drop below zero, you are killed, and you start again a level lower. You get points for both treasure and for each mo.}ve you survive. At higher levels there are more nasty things, less nice things, more treasure, more points and the pace of th.}e game speeds up.3.10 HANGMAN.BAS - The Classic Game.This program is a version of the classic childhood game of hangman.}. You can enter a single letter as your guess, or enter the whole word if you think you know it. The PARSE and INPUT routines.} are very much in evidence here. The game has a vocabulary of 500 DIFFICULT words, you might like to add words of your own ch.}oosing for younger players. The word file, HANGMAN.TXT was prepared using MEDIT but you can change it with any word processor.} that uses standard ATARI record formats, ATARIWRITER etc. The program expects 100 records of 5 words each, just change the r.}andom number selections in the 5000 routine and the string size, to match your new file.This introduces an interesting conc.}ept. Most of the programs we write for our own use, collect and display data in some way. A good portion of the code in these.} programs is concerned with loading, changing and saving data, and that data is often TEXT orientated. Balancing your checkbo.}ok is a good example. A useful alternative is to use a word processor to maintain a data file. Your program only has to read .}the file and display the data. This produces shorter, faster, easier to write programs and the update power of the word proce.}ssor is far greater than any system we are likely to write for ourselves. The parsing routines allow you to break up the resu.}lting text files, quickly and easily.Taking the idea one step further, most spread sheet programs, and most file management.} programs allow you to output files to disk in text format. You can use the parse routines to produce custom reports from the.}se files. The 120 sectors of text in my adventure Dragon Quest was prepared using a word processor. A small program read the .}text file and built the pointer and text tables the adventure actually used.3.11 BUFFER.BAS - Define a safe buffer.As I.} mentioned earlier, by some strange coincidence the AUTORUN.SYS file ends just before a 2K boundary ($2800) and your basic pr.}ogram would normally start there. However there are many types of data that require a boundary aligned buffer. Full character.} sets must start on a 1K boundary, so must low resolution Player Missile Graphics. High resolution PM Graphics require a 2K b.}oundary. Since the AUTORUN.SYS file already moves the vector LOMEM to point after itself, it is a simple matter for it to res.}erve more space than it needs. In fact, the AUTORUN.SYS file as it comes on this disk reserves 1K (1024 bytes) for a characte.}r set used by the AFRICA program. This reserved space is not only boundary aligned, but is safe from accidental overwriting b.}y Basic.The BUFFER.BAS program allows you to change the size of buffer that the AUTORUN.SYS program reserves. When it runs .}it loads the AUTORUN.SYS file into memory and tells you the current and minimum LOMEM. The difference between the two is how .}big a buffer you have. It asks you how big a buffer you want. If you do not want a buffer enter zero. For a 1K buffer enter 1.}024 ect. Then the program gives you a chance to change disks, and writes out the modified AUTORUN.SYS. When you boot the disk.} containing the new AUTORUN.SYS, your buffer space, starting at $2800 (10240) is reserved.When you do a cold start this spa.}ce will contain binary zeros, but this space is not cleared for you. You may wish to use the CLEAR routine to make sure it is.} empty if you are using it for PM Graphics.ble of Contents) sector (360). Byte 0 of this sector identifies the DOS editio,/