Radio Shack Hardware Manual Color Computer Disk System Owners 1981 Tandy Text
User Manual: manual pdf -FilePursuit
Open the PDF directly: View PDF .
Page Count: 104
Download | ![]() |
Open PDF In Browser | View PDF |
Radio /haeK O ©MMS ©©MPonnsiR Owners Manual CUSTOM MANUFACTURED & Programming Guide IN U.S.A. BY RADIO SHACK, A DIVISION OF TANDY CORPORATION Important Notice: Your computer must be off when you connect the disk interface. Otherwise, you could damage the system. "wwSgS^fij^lsSwwwSjgji^ TERMS AND CONDITIONS OF SALE AND LICENSE OF RADIO SHACK COMPUTER EQUIPMENT AND SOFTWARE PURCHASED FROM A RADIO SHACK COMPANY-OWNED COMPUTER CENTER. RETAIL STORE OR FROM A RADIO SHACK FRANCHISEE OR DEALER AT ITS AUTHORIZED LOCATION LIMITED I WARRANTY CUSTOMER OBLIGATIONS A. B CUSTOMER assumes full responsibility that this Radio Shack computer hardware purchased (the "Equipment"), and any copies ot Radio Shack software included with the Equipment or licensed separately (the "Software") meets the specifications, capacity, capabilities, versatility, and other requirements of CUSTOMER. CUSTOMER assumes full responsibility for the condition and effectiveness of the operating environment in which the Equipment and Software are to function, and for II. its installation RADIO SHACK LIMITED WARRANTIES AND CONDITIONS OF SALE A. For a period of ninety (90) calendar days from the date of the Radio Shack sales document received upon purchase of the Equipment, RADIO SHACK warrants to the original CUSTOMER that the Equipment and the medium upon which the Software is stored is free from manufacturing THIS WARRANTY IS ONLY APPLICABLE TO PURCHASES OF RADIO SHACK EQUIPMENT BY THE ORIGINAL CUSTOMER FROM RADIO SHACK COMPANY-OWNED COMPUTER CENTERS, RETAIL STORES AND FROM RADIO SHACK FRANCHISEES AND DEALERS AT ITS AUTHORIZED LOCATION. The warranty is void if the Equipment's case or cabinet has been opened, or if the Equipment or Software has been defects. If a manufacturing defect is discovered during the stated warranty period, the defective Equipment Shack Computer Center, a Radio Shack retail store, participating Radio Shack franchisee or Radio Shack dealer along with a copy of the sales document or lease agreement The original CUSTOMER'S sole and exclusive remedy in the event of limited to the correction of the defect by repair, replacement, or refund of the purchase price, at RADIO SHACK'S election and sole subjected to improper or abnormal use. must be returned for repair, a defect is to a Radio RADIO SHACK has no obligation to RADIO SHACK makes no warranty as to the paragraph. Software is licensed on an "AS expense. B. of III. design, capability, capacity, or suitability for use of the Software, except as provided IS" basis, without warranty. The original CUSTOMER'S exclusive remedy, in in this the event of a Shack sales document is its received upon license of the Software, The defective Software shall be returned to a Radio Shack Computer Center, a Radio Shack retail store, participating Radio Shack franchisee or Radio Shack dealer along with the sales document. Except as provided herein no employee, agent, franchisee, dealer or other person is authorized to give any warranties of any nature on behalf Software manufacturing defect, C. replace or repair expendable items. repair or replacement within thirty (30) calendar days of the date of the Radio RADIO SHACK. D. Except as provided herein, E. PARTICULAR PURPOSE. Some states do not allow RADIO SHACK MAKES NO WARRANTIES, INCLUDING WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A limitations on how long an implied warranty lasts, so the above limitation(s) may not apply to CUSTOMER. LIMITATION OF LIABILITY A. EXCEPT AS PROVIDED HEREIN, RADIO SHACK SHALL HAVE NO LIABILITY OR RESPONSIBILITY TO CUSTOMER OR ANY OTHER PERSON OR ENTITY WITH RESPECT TO ANY LIABILITY, LOSS OR DAMAGE CAUSED OR ALLEGED TO BE CAUSED DIRECTLY OR INDIRECTLY BY "EQUIPMENT" OR "SOFTWARE" SOLD, LEASED, LICENSED OR FURNISHED BY RADIO SHACK, INCLUDING, BUT NOT LIMITED TO. ANY INTERRUPTION OF SERVICE, LOSS OF BUSINESS OR ANTICIPATORY PROFITS OR CONSEQUENTIAL DAMAGES RESULTING FROM THE USE OR OPERATION OF THE "EQUIPMENT" OR "SOFTWARE". IN NO EVENT SHALL RADIO SHACK BE LIABLE FOR LOSS OF PROFITS, OR ANY INDIRECT, SPECIAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY BREACH OF THIS WARRANTY OR IN ANY MANNER ARISING OUT OF OR CONNECTED WITH THE SALE, LEASE, LICENSE, USE OR ANTICIPATED USE OF THE "EQUIPMENT" OR "SOFTWARE". NOTWITHSTANDING THE ABOVE LIMITATIONS AND WARRANTIES, RADIO SHACK'S LIABILITY HEREUNDER FOR DAMAGES INCURRED BY CUSTOMER OR OTHERS SHALL NOT EXCEED THE AMOUNT PAID BY CUSTOMER FOR THE PARTICULAR "EQUIPMENT" OR "SOFTWARE" B. C. INVOLVED. RADIO SHACK shall not be liable for any damages caused by delay in delivering or furnishing Equipment and/or Software. No action arising out of any claimed breach of this Warranty or transactions under this Warranty may be brought more than two (2) years after the cause of action has accrued or more than four (4) years after the date of the Radio Shack sales document for the Equipment or Software, whichever D. Some occurs. limitation or exclusion of incidental or consequential damages, so the above limitation(s) or exclusion(s) may CUSTOMER. not apply to IV. first do not allow the states RADIO SHACK SOFTWARE LICENSE RADIO SHACK grants to CUSTOMER a non-exclusive, paid-up license to use the RADIO SHACK Software on one computer, subject to the following provisions: Software License, applicable copyright laws shall apply to the Software. on which the Software is recorded (cassette and/or diskette) or stored (ROM) is transferred to A. Except as otherwise provided B. Title to the medium in this •Ji.\ CUSTOMER, but not title to the Software. C. CUSTOMER may use Software on one host computer and access that Software through one or more terminals if the Software permits this &H a function. CUSTOMER F. not use, make, manufacture, or reproduce copies of Software except for use on one computer and as is specifically Software License. Customer is expressly prohibited from disassembling the Software. make additional copies of the Software only for backup or archival purposes or if additional copies are required in the operation of one computer with the Software, but only to the extent the Software allows a backup copy to be made. However, for TRSDOS Software, CUSTOMER is permitted to make a limited number of additional copies for CUSTOMER'S own use. CUSTOMER may resell or distribute unmodified copies of the Software provided CUSTOMER has purchased one copy of the Software for each G. All D. provided E. in shall this CUSTOMER one sold or is permitted to distributed. The provisions of this Software License shall also be applicable to third parties receiving copies of the Software from CUSTOMER. V. copyright notices shall be retained on APPLICABILITY OF A. all copies of the Software. WARRANTY The terms and conditions Software License to of this CUSTOMER Warranty are applicable as between RADIO SHACK and CUSTOMER to either a sale of the Equipment and/or or to a transaction whereby RADIO SHACK sells or conveys such Equipment to a third party for lease to CUSTOMER. B. The limitations of liability and Warranty provisions herein shall inure to the benefit of RADIO SHACK, the author, owner and/or licensor of the Software and any manufacturer of the Equipment sold by RADIO SHACK. VI. STATE LAW RIGHTS The warranties granted herein give the original from state to state. WW® "Una m% CUSTOMER specific legal rights, and the original CUSTOMER may have other rights which vary £•?•»: :•'•:•; The FCC wants you to know: This equipment generates and uses radio frequency energy. If it is not installed and used properly, that is, in strict accordance with the manufacturer's instructions, it may cause interference to radio and television reception. It has been type tested and found to comply with the limits for a Class B computing device in accordance with the specifications in Subpart J of Part 15 of FCC Rules, which are designed to provide reasonable protection against such interference in a residential installation. However, there is no guarantee that interference will not occur in a particular installation. If this equipment does cause interference to radio or television reception, which can be determined by turning the equipment off and on, the user is encouraged to try to correct the interference by one or more of the following measures: • • • • reorient the receiving antenna relocate the computer with respect to the receiver move the computer away from the receiver plug the computer into a different outlet so that computer and receiver are on different branch circuits. the user should consult the dealer or an experienced radio / television technician for additional suggestions. The user may find the following booklet prepared by the Federal Communications Commission helpful: How to Identify and Resolve Radio-TV Interference Problems. This booklet is available from the United States Government Printing Office, Washington, DC 20402, If necessary, Stock No. 004-000-0035-4. TRS-80 Disk Extended Color Color Computer Disk System: Copyright © 1981 Tandy Corporation, Fort Worth, Texas 76102, U.S.A. BASIC System Software: Copyright © 1981 Tandy Corporation and Microsoft. All rights reserved. The system software in the disk system All rights reserved. retained in a read-only memory (ROM) format. All portions of this system software, whether in the format or other source code format, and the circuitry, are copyrighted and are the proprietary and trade secret information of Tandy Corporation and Microsoft. Use, reproduction, or publication of any portion of this material, without the prior written authorization by Tandy Corporation, is ROM is ROM Reproduction or use, without express written permission from Tandy Corporation, of any portion of this manual, is prohibited. While reasonable efforts have been taken in the preparation of the manual to assure its accuracy, Tandy Corporation assumes no liability resulting from any errors or omissions in this manual or from the use of the information obtained herein. strictly prohibited. 98765432 Printed in the United States of America 10 WHY A DISK IS FAST A disk is for storing your information. The precise term for it is a "mini-diskette," but in this book we'll just call it a disk. It is far superior to tape, the other alternative. A disk is especially designed to "file" your information so the Computer can immediately get the information you want. For you, this means storing and retrieving information which takes a long time on tape efficiently. — now — can be done quickly and ABOUT THIS BOOK how to read and write on a disk. When we had three different groups of people in This book shows we wrote mind. it, The first group includes all of you accomplished Radio Shack programmers. We are referring, of course, to those of you who learned to program by reading Getting Started with Color BASIC and Going Ahead with Extended Color BASIC. You'll find Sections I and II of this book another delightful experience. If you're especially ambitious, you'll also enjoy Section III. about those of you who have never programmed and intend to use application programs written by Radio Shack or someone else? You're the second group. Read Chapter 1, "To Get Started." Then, if you're interested in and want to take full advantage of your disk system, go on to Section I, "The Disk." You don't need to know anything about programming to under- How stand it. you don't belong to either of these two groups, you probably already know how to program disk systems. Read Chapter 1 first to find out how to connect your system. Then, go straight to the "BASIC Summary" at the end of the book. Everything is summarized there with page number references, for the things you want to read more about. If TABLE OF CONTENTS Chapter II To Get Started 1 SECTION I. The Disk Chapter 21 Meet Your Disk Chapter 31 A Garbled Up Disk Chapter 41 You're the Boss 7 13 19 SECTION II. The Disk Program 51 One Thing Chapter 61 (Sequential Access to a File) Changing It All Around (Updating a Sequential Access File) 29 Chapter 71 A More Direct Approach 33 Chapter at a Time 25 (Direct Access to a File) SECTION III. The Refined Disk Program Chapter 81 How Much Can One Disk Hold? Chapter 91 (What the Computer Writes in a Disk File) Trimming the Fat Out of Direct Access (Formatting a Direct Access File) Chapter 101 Shuffling Disk Files (Merging Programs, Using Many File Buffers) Chapter 111 Technical Information 41 47 53 57 (Machine-Language Input/Output) Appendixes Appendix Al Programming Exercise Answers Appendix Bl Chapter Checkpoint Answers Appendix CI Sample Programs Appendix Dl ASCII Character Codes Appendix El Memory Map Appendix Fl Specifications Appendix Gl Error Messages Appendix HI BASIC Summary 64 66 68 79 81 82 83 85 i TO GET STARTED Before you install your Disk System, you need to connect your Color Computer to the T.V. If you haven't done it yet, refer to the Color Operation Manual. Note: the dotted Computer A. CONNECT DISK SYSTEM is easy to connect. Do it you turn on your Computer by simply plugging in all the parts: Your Disk System before lines represent tke connection of additional add-on drive TO GET STARTED 1. Connect Plug B of your Disk Cable to the plug on back of your Disk Drive. Plug in the power cord to a standard Connect the Disk Interface to the plug in the opening of your Computer. IMPORTANT NOTICE: YOUR COMPUTER MUST BE OFF WHEN YOU CONNECT THE DISK INTERFACE. OTHERWISE, YOU COULD DAMAGE (120 V) electrical outlet. THE SYSTEM. If You Have Additional Disk Drives you have more than one disk drive, do step 3 differently. Connect the 26-3023 If Drive to the inside plug (Plug B). If you have more 26-3023 Drives and an expanded 2. Connect Plug cable, connect these Drives to inside plugs A of the Disk Cable to the also. Disk Interface. The 26-3029 Drive must be connected to the last plug in the number your You'll also need to Number them from with Drive B 0. B. is drive Drives. the inside out. starting The Drive connected B is drive number 0, Plug C series. Plug the Drive connected to number 1 , to etc. POWER IT UP Since your Disk System has several parts, you need to turn ON several buttons to power-up the entire system; ON your television set. • Turn • Select • Set the antenna switch on the Channel 3 or 4. TV. to COMPUTER. • Turn ON the Computer. (The power buton the back left-hand side of your ton is keyboard.) TO GET STARTED • ON the Disk Drives. (The buttons are on the rear.) Turn power Gently insert the disk until Close the Have you turned ON all the buttons? This message should appear on your screen: DISK EXTENDED COLOR BASIC stops- DRIVE DOOR. Note: You cannot use a blank disk until you "format" it. The next chapter shows how. v.r, COPYRIGHT (C) 1981 BY TANDY UNDER LICENSE FROM MICROSOFT Now two numbers specifying which version and release you have.) (v.r, is If not, it that your system connected and poweredBegin what? Well, if you want to know how to take full advantage of your disk system, we'd like you to read Section I. You'll find a lot of helpful information there. is up, you're ready to begin. turn off the Computer, check your con- nections, and power it up again. you're in a hurry to run your application prothat's O.K., too. But please read these guidelines first. We want your disks to last a long If gram, C. INSERT A DISK time. After powering the system up, you can insert a disk. If you plan to go through Section I, use the blank, unformatted disk which comes with your disk system. Otherwise, you can insert your "application program" disk, (If you have more than one drive, insert, the disk • When storing the disk, keep it in its storage envelope • • Do not turn the system disk in the drive. Keep disks away from magnetic (transformers, in drive 0). ON or OFF with the AC fields motors, magnets, TVs, radios, etc.) Handle disks by the jacket only. Don't touch any of the exposed surfaces, even to dust them. • ^ • of direct sunlight and away from heat. Avoid contamination of disks with cigarette ashes, dust, or other particles. Use a felt-tipped pen only to write on the disk label. • • Keep disks out Open the DRIVE DOOR. Position the disk with the notch on top, as we show in the picture above. Store disks upright in a vertical file. Note: Your disk drives should be on the right side of your television set. IMPORTANT NOTE! you have an earlier model of the Color Computer, the disk system might cause interference on your screen. If so, bring the computer to a Radio Shack Repair Center for additional grounding connections. (There will be no charge for this If service.) SECTION I TMH2 BMK A disk is like a filing system. Everything on organized. it is This makes disks easy to work with. In this section, we'll show you how your Computer organizes everything on your disk, and advantage of this. We how you can take invite all of you to read this section. You don't need to know anything about computers to under- stand it. MEET YOUR DISK A LOOK INSIDE OF IT Note: To be precise, there are 35 tracks on a disk, 18 sectors in each track, 256 bytes in each sector, and 8; bits in Although your disk looks like a record, it is really more like a multitude of tiny magnets. One disk can hold more than a million magnetic charges. 1,290,240 of them are for your information. That's what we mean when we say a disk will hold 1,290,240 bits or 161,280 bytes of information (there are eight bits in a byte). Some of these bits are magnetically charged some aren't. and The pattern formed by these mag- netic charges is what's important. It forms a code each byte. After creating this filing system, the Computer puts a master directory on the disk. There, it indexes where everything is stored. Whenever it a program, a mailing wants to find something it uses the directory to find the list, your letters tracks and sectors where it is stored. It can then go directly to that spot. — — This whole filing system is, of course, what makes the disk system so powerful. You can quickly find anything you have stored on your disk. which the Computer can read. With more than a million of these bits on a disk, you can appreciate how your Computer must organize them in order to find anything. It does this by building a massive disk filing system. First it creates the file cabinets by dividing your disk into "tracks." Then it puts drawers in the cabinets by dividing each track into "sectors" not finished yet and each byte . is . . each sector divided into is Then . . . FORMATTING A DISK we're divided into bytes bits. Putting this filing system on your disk is called it. The last thing we had you do in Chapter 1 was to insert an "unformatted" disk. Before you can use it, you must format it into tracks and sectors. "formatting" How do you format a disk? Well why not just tell your Computer to do it? If you went through the . . . MEET YOUR OISK instructions in the last chapter, you have already powered-up your system and inserted an "unformatted" disk. Be sure you have your DRIVE DOOR closed. Now, type any ing the appropriate drive number for drive 0. example, DSKINI1 formats the disk in drive For 1. PUTTING A FILE ON YOUR DISK letters and press the (ENTER) key so A that: OK the last line on your screen. (OK means "OK, I'm ready to do something") Now type what you — can contain any kind of information a program, a mailing list, an essay, some checks. We'll make your first file contain a BASIC program, since it's the simplest thing to store. disk file is want it to do. Type: you don't know how to program in BASIC, type program anyway. Type each line exactly as it is shown below. Press the (ENTER) key after typing If this DSKINI0 each and press the CENTER) key. Type: line. Your Computer might print ?SN ERROR. If so, don't let this bother you. This "error" simply means you typed the command incorrectly. Type it again. PRINT "STORE ME IN DISK FILE" (ENTER) 20 PRINT "AND YOU'LL NEUER LOSE ME" (ENTER] 10 Finished? Whenever anything goes wrong, the Computer will let you know immediately with an error message. This way you can correct the error right away. If you get any other error message besides SN, look it up in Appendix G. It lists all the error messages and what to do about them. After typing DSKINI0 (ENTER), come on. Sounds promising you'll and noises from your disk drive . its hear some red light will . After about 40 seconds of noises, your Computer will then print OK. It has finished formatting the disk. You can now store your information. A Now that you've typed the program into your Computer's "memory," you can put it on a To do this, we'll call it a file and name the file "SIMPLE/PRO" (all files have a name). To store it, disk. type: SAME "SIMPLE/PRO" [ENTER) Once you press the (ENTER) key, your disk drive whirr and grind some and the red light on it come on. Your Computer is: • finding a place on the disk to store will will "SIMPLE/ PRO" • telling the directory where "SIMPLE/PRO" will be stored. Remember that you cannot store anything on an unformatted disk. Whenever you get a new, unformatted disk, you need to format use it • storing "SIMPLE/PRO" on your disk. before you can Note: The Computer stores it. way Later on, you might not remember if a disk has been formatted. A quick way to find out is to check the directory. (See "Checking the Master Directory" at the end of this Chapter.) If you get an "error message'' the disk is not formatted. it "SIMPLEPRO" the same stores everything else — in a code of magnetic charges. this point, we must warn you about something. Do not remove your disk while you see the red At It might disyou are presently storing, but of other things you have stored on the disk. light on. This confuses the Computer. tort the contents, not only of the file Note: It does no common way harm to erase to reformat a disk. Thin everything on it. have more than one disk drive, you can format a disk in one of the other drives by substitutIf you 8 When your Computer finishes storing "SIMPLE/ PRO," it prints the OK message on your screen. MEET YOUR DISK Note: Upgrading your tape system? Note the difference: SAVE stores a program on disk; CSAVE stores RUN CENTER) LIST ENTER) [ on tape it I NEW erased the program from memory, Although MEMORY VS DISK STORAGE To those of you new to computers, we would expound a little on computer "memory." already heading know what it is, skip down — "Loading a File from Disk!' like to If to the you next Whenever you type a BASIC program line and press (ENTER) the Computer automatically puts it in its memory. Once it's in memory, you can do "SIMPLE/PRO" is still safely stored on your disk. You can put "SIMPLE/PRO" back into memory anytime you want by "loading" it from disk. To do this, it. PRO" is stored. going to that location on the disk and reading the contents of "SIMPLE/PRO." putting • Your Computer PRINTs: . reading the directory to find where "SIMPLE/ • For example, type: RUN [INTER] [ENTER] Again, you'll hear some promising noises from your disk drive. The Computer is: , things with type LOAD "SIMPLE/PRO" "SIMPLE/PRO" into its memory. You can now type one or both of these commands to verify that "SIMPLE/PRO" is in memory: STORE ME IN ft DISK FILE AND YOU'LL NEVER LOSE ME LIST (ENTER) RUN (ENTER ) To list the program as you have it above, type: LIST dNTEFD where the Computer keeps track of everything you tell it. Once you put your information in its memory, the Computer can print it, rearrange it, combine it, or any of the other things you want done with it. Memory is Later on, you'll probably want to put other things, such as your mailing list, in memory. To do this, you'll need to write or purchase a program written especially for that application. This "application program" will get the Computer to put the information you type into memory. The important thing to remember about memory that turning off your Computer erases it. Once memory has been erased, there's no way to recover it. The only way to keep a permanent copy of what you've typed into memory is by storing it on a disk is (or tape). LOADING A FILE FROM DISK [ENTER) to erase everything in your Commemory. To make sure everything's erased, you can type one or both of these commands: MORE ABOUT MEMORY VS DISK STORAGE Type NEW puter's If you're still a little and what's on your fuzzy about what's in memory disk, try this exercise. You've 9 MEET YOUR DISK just into LOADed a program called "SIMPLE/PRO" memory, right? Change it by typing: NEW [INTEH] PRINT "CHANGED FILE" 10 SfliJE "SIMPLE/PRO" (ENTER] (ENTER) 20 PRINT "WITH THIS CHANGE" (ENTER] LIST the program again to see that the Computer has registered the changed line 20 in its memory: FILENAMES You have already used one filename: 10 PRINT "STORE ME IN A DISK FILE" "SIMPLE/PRO" "WITH THIS CHANGE" 20 PRINT Store it in a different "CHANGE" [ENTER) ... file by typing SAME If you did our memory "CHANGE" PRO" and "CHANGE" What do you think each We of them contains? Try LOADing and then LISTing both of them. — gave the name "SIMPLE" an "extension" "PRO." You must give everything you store a name. The extension is up to you. It's optional. What names can you [Note: You don't need to type NEW (EBTER] before LOADnew program disk storage exercise, you've used a second filename: Hear the whirring and grinding from your disk drive? You have two disk files now: "SIMPLE/ memory. The Computer will automatically erase everything you presently have in memory before LOADing the new program. ing a vs. into give your files? you want, as long as you follow these 1. Anything rules: The name may have no more than eight characters. ?????????????????????????????????????????????????? "CHANGE" you give it an extension, the extension may have no more than three characters. 2. If contains the changed program: 3. PRINT "STORE ME IN A DISK FILE" 20 PRINT "WITH THIS CHANGE" 10 However, "SIMPLE/PRO" There must be a slash (/) or a period the name and the extension. PRINT "STORE ME IN contains the old Note: You may use any characters in the filename except a colon (:) or a zero (0). You can only use a slash (I) or a period (.) to separate the name from th DISK FILE" 20 PRINT "AND YOU'LL NEUER LOSE ME" A extension. The only way to change a disk file is by well, you answer it. How can you make the file "SIM. PLE/PRO" 10 . . contain: FILENAMES WHEN YOU HAVE MORE THAN ONE DRIVE PRINT "CHANGED FILE" have more than one disk drive, you can add the drive number to your filename. (Remember, you numbered all of your drives in Chapter 1 ), For If you ?????????????????????????????????????????????????? Answer: example: T>pe: LOAD "SIMPLE/PRO:!" 10 between Fair enough? Good. still program: 10 (.) MEET YOUR DISK LOADs "SIMPLE/PRO" from number 1. BASIC program the disk in drive Or data created by a BASIC program data created by a machine-language program a source program created by an editor/ assembler 1 2 "CHANGE:1" SAVE 3 stores "CHANGE" If you don't include a drive assumes you want on the disk in drive number it 1. number, the Computer to use drive number Note: An eriitnrtasxembler ix a program you can buy to help you create a machine-language program. 0. The fourth column CHECKING THE MASTER DIRECTORY stored lists the format the file is in: A ASCII As we've said earlier, a disk has a master directory which the Computer can use to find out what's on the disk. If the Computer can use it, you can use tEHTEH it, too. TypeDlR ). B Binary We'll explain the meaning of this in Chapter 10. fifth column shows how many "granules" each consumes. "SIMPLE/PRO" and "CHANGE/ BAS" consume one granule each. (The Computer The The Computer prints information on all the you have stored on your disk. If the only files files you've stored so far are "SIMPLE/PRO" and "CHANGE," the Computer prints this: file uses "granules" to allocate file space on a disk. disk contains 68 of these "granules"). If SIMPLE PRO CHANGE BAS you have disks inserted and formatted in other you can check their directories also. For drives, and second columns list the filename. first is the name and the second is the extension. Notice that even though you did not assign "CHANGE" an extension when you stored it, the Computer still assigned it the extension "BAS." The The A instance DIRl fjNTEl) displays the directory of the disk in drive number 1. first The Computer prefers for all filenames to have an extension. If you do not give a file an extension when you store it, the Computer will automatically assign Impressed? You'll be even more impressed when you see how fast you can SAVE and LOAD long programs. But before you get too involved, please read the next chapter. It'll help ensure that your experience with your Disk System is smooth and enjoyable. Note: To stop the directory from one of these extensions: SHIFT) scrolling, press the and (W) keys simultaneously. Then press MB®. "BAS" "DAT" if it's "BIN" if it's if it's a BASIC program data (such as names, numbers, a machine-language program) CHAPTER CHECKPOINT etc.) Note: A machine-language program is a highly technical program which talks directly to the Computer. 1. Why can't you store things on an unformat- 2. ted disk? What is the disk's directory? 3. 4. The next three columns contain information which is primarily for the use of technical programmers. Interested? Then read on . 5. What is a disk Sle? What is the difference between what's in memory and what's on the disk? How do you change the contents of a disk Sie? . Do you The third column lists the type of file it is: like quizzes? The answers are in Appendix B. 11 A GARBLED UP DISK With more than a million magnetic charges on a disk, you can see why it is so delicate. Any small particle such as a piece of dust or a cigarette ash could distort its contents. A scratch could ruin why we suggest that you keep its envelope when you're not using it That's felt-tipped pen when labeling ... If you're in the middle of running a disk program, and need to switch disks, we recommend that you type this command: it. the disk in — preferably upright in a dust-free container One more thing — and only use a it. To help protect the disk, we encased most of it in a black plastic container. However, as you can see, we weren't able to cover the entire disk. The mid- UNLOAD before you switch disks. This might put this information on the wrong disk and garble the contents of both disks. and two other small areas are exposed Computer can read and write to it. Be care- touch the exposed areas, not even to dust them. They scratch very easily. Note for BASIC programmers; All open files must be closed before switching disks, open ful not to Since the disk is made up way the Computer can put its closing information on the proper disk. If you don't type this command, the Computer dle section so the fIRTER) : UNLOAD closes al,' files. BACK IT UP of magnetic charges, putting it next to another magnetic device, such as your television set, could completely rearrange its magnetic code. Your information would be lost. Heat and sunlight could have the same effect. The same goes for turning your Computer ON or OFF while the disk is in its drive. All of this might sound a if little gloomy to you, even you are a careful person. This is why we've command called BACKUP. BACKUP enable you to make a duplicate or "backup" included a will copy of any of your disks by copying the contents of one disk to another. 13 A GARGLED UP DISK We suggest you regularly make a backup copy of any disk which contains important programs or data. This way you won't have to worry about los- After ing them. INSERT DESTINATION DISKETTE AND PRESS can actually get worn out from a good idea to make a backup too copy of an old disk on a new, unused disk. Then, when the Computer begins having its problems reading and writing to the disk, you can use your backup copy. Also, since a disk much use, it's of making some noise while it reads a portion your "source" disk, the Computer will print: Take the "source" disk out and insert the "destination" disk. Shut the DRIVE DOOR. Then press (ENTER). You'll hear some more noise while the Computer "writes" some things on the "destination" disk. Then it will print: INSERT SOURCE DISKETTE AND PRESS Want to make The Computer Your "source" disk to duplicate. — This will have you continue switching disks until you have copied everything from your is the disk you Use any disk which has files want stored on it. If you're just getting started, use the disk which you worked with in Chapter 2. 2. CENTER) a backup copy? Get your two disks ready: 1. CENTER; — Your "destination" disk This is the disk which you want to be your duplicate copy. Use a blank disk or, if you've been using your disk system for a while, use any disk which contains files you won't need anymore. source disk. During this process, make sure you and insert it properly. When the Computer will print the OK insert the correct disk you've finished, message on your screen. To make sure BACKUP worked, you can insert your "destination" disk and type D I R (ENTER) . Backup with More Than One Disk Drive \'ote Everything preciously on your destination dish : it- ill be erased. It will be replaced with all the data i your source disk. your "destination" disk is blank, you must first format it. Remember how? Insert it in your disk drive, shut the door, and type DSKINio If you have more than one disk drive, backing up a disk is much easier. It will take about two If minutes. tination" disk in drive 1 CENTER) and your "des(Chapter 1 shows how to Insert your "source" disk in drive . label your drives). Then type: Now make the backup copy. The procedure you follow depends on whether you have one disk drive BACKUP TO i ( ENTER) or several. You will hear some noise as the Computer backs up the contents of the disk in drive to the disk in Backup with One Disk Drive you have only one disk drive, it will take you about five minutes to make a backup copy. Insert your "source" disk in your disk drive and shut the DRIVE DOOR. Type OIR (ENTER) to see which files you will be copying. If start the BACKUP 14 will print the OK 1. sage. You can then make sure by typing DIRi You can use CENTER) it BACKUP mes- worked . different drives, if you want. For instance: BACKUP Now When it's finished, drive 1 TO (INTER) backup procedures. Type: CENTER) backs up the contents of the disk in drive one in drive 0. 1 to the A GARBLED UP DISK SALVAGE IT You have Problems During Backup If We you get an error message while you're backing up a disk, it's probably because you've inserted the disk incorrectly or there is something wrong with If the disk. At the end of this chapter, we discuss error messages to help you determine the problem. If you have a bad disk, you will need to try BACKUP with another disk. After determining the problem, press the RESET button to get out of BACKUP. Then start the BACKUP procedure all over again. mentioned earlier that a disk doesn't live foryou throw away an old disk, though, see if you can salvage it. You may be able to do this by formatting it all over again as if it were a blank ever. Before disk. Although this might salvage the disk, it will not salvage the contents of the disk. By reformatting the disk, you will erase everything on it. However, it will save you the expense of purchasing a new disk. you get an 10 error while trying to reformat it Messages" at the end of this chapter), the disk has probably reached its limit. If you have a "bulk-eraser," you can try "bulk-erasing" the disk and reformatting it. Otherwise, throw it away and use another one. If I Note: The RESET button is ore the right-hand rear of your Computer (when you're facing it). "WRITE" PROTECT IT (see "Error "Write-protecting" is one more way to protect your disk files. Let's assume you have a disk which con- — some valuable information such as a good program which you don't plan to change. You plan to "read" its contents daily, by loading the program into memory, yet you never plan to "write" (store information) on it. tains — Putting a little Note:Ifyou have more than one disk drive, you might be able to COPY some of the files on a bad disk to a good disk. We discuss COPY in the next chapter. gummed label on the WRITE- I VERIFY IT The Computer "writes" data on your disk at a very fast speed. In almost all cases, it can do this flawlessly. PROTECT NOTCH will enable the Computer to read the disk, but not to write on it. Any gummed There is one which comes with your new, unformatted disk: label will do. There might be times when you want to be absolutely certain that there are no flaws in what the Computer is writing. If so, you can turn ON the Computer's VERIFY command. To do this, type: VERIFY ON (ENTER) Now the Computer will notify you, whenever it is writing on a disk, if there are any flaws in what it is writing. The only catch is that it will take twice as long for the Computer to write. For example, let's assume you now make a BACKUP copy of your disk. The Computer will take twice as long doing this, but will notify you if there This turn is a flaw in the BACKUP copy. VERIFY command will remain ON until it off. To do VERIFY OFF you this, type: (ENTER) 15 A GARBLED UP DISK WHEN THINGS GO WRONG 10 — The Computer or Outputting information to the disk. (1) Your Computer realizes nobody's perfect. When you make a mistake, it'll try to notify you immediately and tell you what kind of "error" you (2) Make sure there is a disk inserted properly in the indicated drive and the drive door is closed. If you still get this error, there might be something wrong with your disk. Try reinserting the disk first. Then try using a different one or reformatting it. (Remember that reformatting a made. You've probably already been notified that you made a "SN ERROR." If you haven't, type DIIR [ENTER) having trouble Inputting is disk erases its contents.) you still get this error, you probably have a problem with the Computer System itself. Call the Radio Shack (3) If deliberately mispelling DIR. Repair Center. SN means "Syntax" error. It's the Computer's way you that "DIIR" doesn't make sense to it. The word is not in its vocabulary. An SN error usually means you made a typographical error. of telling NE — You are trying to RENAME a file (discussed in the next chapter) to a filename TM which Already Exists. DF — The Disk you are trying to store your is DN Full. Use another You UF — You used an unacceptable format to name Chapter explains which File Names are acceptable to the Computer. FS — There file. /0 file. The last WP — You are trying to store information on a disk which Write Protected. Either take the ferent disk. If your disk is not Write Protected, then there is an input/output problem. See 10 for instructions on what to do about something wrong with your disk See 10 for instructions on what to do. is label off the write protect notch or use a dif- this. is — Technically, this means you have asked the to divide a number by 0, which is impossible. However, you might also get this error when you don't enclose a filename in quotation marks. Computer 16 — You will only get the error when you have ON you do not number when using DSKINI or BACKUP. If you have only one drive with these two commands specify drive (DSKINIO or BACKUP 0) your is caused by a program which mixes "strings" with "numbers." However, you might get this error if you and are writing the VERIFY command to a disk. The Computer is informing you that there is a flaw in what it wrote. See 10 for instructions on what to do. specify a drive FN — Technically this on disk. will also get this error if you don't enclose a filename in quotation marks. file — You are using a Drive Number higher than 3. file want. Check the disk's directory to see if the file is there. If you have more than one disk drive, you might not have included the appropriate drive number in the filename. If you are using COPY, KILL, or RENAME (discussed in the next chapter), you might have left off the extension. Here are some other error messages you're likely to get with your disk system: AE — The Computer can't find the disk All other errors you might get are errors in the program you are using. If you did not write the program and get one of these errors, you need to contact the people who wrote it. If you did write it, check Appendix G, where you'll find an explanation of all the error messages. A GARBLED UP DISK your disk might seem a little awkward should. You've spent most of your life protecting your papers and now you're dealing Caring at for first. It with a different medium. \Z 1. Why or After awhile, though, protecting your disk from dust and magnetic devices will seem as natural to you as protecting your papers from a strong gust of wind. And once you get used to keeping your disk "ungarbled," you'll never want to go back to pencils and paper again (we hope). 2. CHAPTER CHECKPOINT shouldn't you turn the Computer ON OFF while the disk is in its drive? What type of pen can you use to write on the disk's label? 3. 4. 5. What are error messages? What does write-protect mean? you do it? How do you backup a disk? How do 17 YOU'RE THE BOSS Thanks to command your disk filing system, you are able to the Computer to do a lot of very helpful things. For example, you can rename a file. If you've taken your formatted disk out, re-insert RENAME is easy to use, but there is one thing you need sion to remember. Save a file without an extenand then try to rename it. Type: it. PRINT "FILE NUMESER TWO "AFILE" (E NTER) rei*JAME "AFILE" TO BFILE" 13 Note: Can't remember if your disk's formatted? Check the directory by typing DIB (EBBS) (or DIBB or DIRi if you have more than one drive). Type this to put a PRINT "THIS file A FILE" SAVE "ORIGINAL/NAM" (ENTER) 10 IS . (ENTER) (ENTER) NE error. This means file. When you RENAME (ENTER) Check the directory to see that the program file is stored on your disk under the name ''ORIGINAL/ NAM" Now rename it. Type: . ' The Computer gives you an the Computer can't find the on your disk: ' Sfli IE a file, you must type in the complete name of the file so that the Computer can find it. This includes the name and the extension. As we discussed in Chapter 2, whenever you SAVE a file the Computer will make sure it has an extension. If you don't assign it one, the Computer will. . RENAME "ORIGINAL/NAM" TO "NEW/NAM" (ENTER) Hear the disk drive working? Check your DIRectory again. If you'd like, LOAD and LIST "NEW/ NAM." The program file has simply been renamed. Everything else is the same. You can check the directory to find out the extension of "AFILE." Then RENAME it. Type: RENAME "AFILE/BAS" TO "BFILE/BAS" (ENTER) you're renaming a program file, be sure that your new filename has an extension. In other If 19 YOURE THE BOSS words, don't type RENAME "AFILE/BAS" TO "BFILE" better do one of the following: start using another The Computer would RENAME the file, however "BFILE" would not have an extension. This would cause a problem when you try to LOAD "BFILE," since all files you LOAD must disk or "KILL" have an extension. your disk This might seem to conflict with what we said above. You were able to SAVE "AFILE" without assigning it an extension because the Computer automatically assigned it one when it saved it. RENAME works differently The Computer won't automatically assign an extension to a program you rename. KILL "CHANGE/BAS" [INTER) . KILLing one way is extension. This is toLOAD "BFILE" wlthoutan by indicating that there Is why we you always assign it suggest, an in Chapter 2, type: (ENTER) ing on your disk. "CHANGE/BAS" is no longer on your disk. The space it occupied is now FREE for new files. we had to in order to include KILL it. CHANGE'S extension, The Computer insists you type the complete filename as one extra pre- (ERIEE). This is awkwhen renaming a file, sion by typing LOAD "BFILE/" ward. That's does just what the name if you put "CHANGE" on file Check your directory and the FREE space remain- "BAS" no exten- a disk files. implies. For example, Notice, NotesThere some of your disk want caution. It doesn't to KILL a file you don't want destroyed. extension. Note: Want to get very technical? The data will still exist on the disk after you KILL a file. However, the Multi-Disk Drives Computer won't know RENAME a file on another disk drive, simply by typing the appropriate drive number. Insert a formatted disk in drive 1 {if it's not already inserted). Store a file on it: all reference to You can it's there because KILL deletes in the dish's directory. Therefore, it no longer be able to access the data and the Computer will be able to write over it with a new file. you'll Multi-Disk Drives 10 PRINT "ACCOUNTING" SAME "0LDACC/DAT:1" and RENAME it 1 ENTER] (INTER] You can use FREE and KILL on other disk drives, as you can with RENAME, by typing the drive by typing: number. Examples: RENAME "0LDACC/DAT:1" TO "NEWACC/DAT : 1" PRINT FREE(l) INTER) (enteB) Nate: If you want your renamed file on a different drive, you can't use RENAME. Use COPY. tells I ALMOST OUT OF DISK SPACE? Sooner or later, you'll want to know how space you have left on your disk. Type: PRINT FREE(0) much FREE space is on the disk in 1. KILL "NEWACC/DAT: deletes 1" (ENTER] "NEWACC/DAT" from the disk in drive 1. COMMANDS of FREE "gran- There are 68 granules in all. If the Computer tells you that you have only one granule FREE, you'd 20 you how much SPECIAL MULTI-DRIVE (ENTER] The Computer prints the number ules" remaining on your disk. drive In the rest of this chapter, we'll talk about two commands which you can use if you have a multidrive system. If you don't have one, go on to "Chapter Checkpoint" at the end of this chapter. YOU'RE THE BOSS The first point, drive one copies a disk have a program file. file You should, at this stored in the disk in named "NEW/NAM." Make a COPY of This makes the Computer assume you want use DRIVE 1, unless you tell it otherwise. it. TO "NEW/NAM: 1" (ENTER). you want, you can rename the file when you copy it. For instance, COPY " NEW/NAM 1" TO "ANOTHER/NAM :0" (ENTER) copies "NEW/NAM" from the disk in drive 1 to the file "ANOTHER/ If DRIVE assumption, the Computer will respond differently to the same command. By typing SAUE "ANYTHING/EX" (ENTER) the Computer will store "ANYTHING/EX" on the disk in drive 1. You would now need to type SAVE "ANYTHING/EX 0" (ENTER] to SAVE it in drive 0. After changing this Type: COPY "NEW/NAM:0" it to , : : NAM" on the disk in drive 0. The second command changes the drive number the Computer goes to if you do not specify one. Up to now, this has been drive 0. For example, by typing SAOE "ANYTHING/EX" (ENTER), the Computer will assume you want to use drive 0. It will then SAVE this program on the disk in drive 0. CHAPTER CHECKPOINT 1. How do you rename have 2. 3. a file? Why do you to specify the file's extension? What can you do when you think you're running out of disk space? more than one disk drive and do not specify the drive number, which drive will the Computer use? How can you change this? If you have To change this assumption, you can type: DRIVE 1 CENTER) Congratulations. You are now a bonafide disk system operator. You should now have a good understanding of how your disk system works and how to take full advantage of it. 21 SECTION II TTDDIE IMSBS IPMDCSIEA Storing a BASIC program is easy. You only need to use the SAVE command. Storing data takes a little more effort. You need a program. Some of you might prefer to buy a ready-made proyou want more control and are willing to invest a little time, you will enjoy writing your own. gram. However, if In this section, we'll show you how to write a BASIC program which stores data on disk. We are assuming you already know some BASIC. If you don't, read Section I of Getting Started with Color BASIC. It will give you all the background you need. 23 ONE THING AT A TIME (Sequential Access to a File) A is simple. There's only one way to put data and one way to read it off. A disk is more complex. There are several ways to "file" your data on on tape it it. and the next, we'll show how to program which stores data in a "sequential access" disk file. It's the simplest file to create and In this chapter would then index where, on the is disk, "FRIENDS" stored. There is, of course, a good reason for all of this. Using the disk filing system, the Computer will be able to immediately find any file on the disk. write a is actually very similar to a tape "file" In Chapter 7, we'll introduce "direct access," of disk WRITING A DISK FILE an alternate type Let's file. assume you want your checks on to "write" the disk: In showing how to store things quently use the words disk file on disk, we'll fre- and disk directory. CHECKS DR. HORN SAFEWAY We discussed these concepts in Chapter 2, but we'll summarize them now. Everything you store on disk must go in a disk file and be assigned a filename. Your Computer will index the location of the disk file in the disk's directory. For example, if you want to store the names of your friends, you could put them in a disk file named "FRIENDS'' Your disk's directory FIRST CHRISTIAN OFFICE SUPPLY Weil start with a short, simple writes the first check, "DR. program which HORN|' on the disk. Insert a formatted disk in your disk drive. (If you have more than one disk drive, use drive 0.) 25 ONE THING AT A TIME Note: Chapter 2 shows DIB JN.TEE- ifyou can't matted.) Chapter 1 how to format a very important that you CLOSE communication with buffer #1. Why? Well, let's leave buffer #1 OPEN. Delete line 30 and RUN the pro- (Type di-sk. remember whether a disk is It is for- explains the drive numbers. gram Then several times. type: The program appears to work the same every time OPEN "0"t *lr "CHECKS/DAT" 20 WRITE »1 "DR. HORN" 38 CLOSE »1 10 you RUN it. This ers you've left RUN the program. You'll hear the motor of the disk drive and see the red light. The Computer is at work, doing several tasks. OPENs communication to the disk so you can send your checks out to it. Then, it finds an empty location to store the checks and notes the beginning location of that disk file in the directory. happens in line 10. Notice the meaning and "CHECKS/DAT": All of this of the "O", #1, OPENed. let's LOAD a program. doing this, it will send out its closing information to the new disk (thinking it's the old one). This will very possibly garble the contents of both disks. Now that we've warned you of the importance of #1 is memory called communicates with the disk drive. a special "buffer" area in buffer #1. It Line 10 OPENs your program and what the program writes on line 30, re-insert this line in RUN it again. This is 1. RUN because every time you assume you switch disks and RUN or The Computer will automatiCLOSE communication with buffer #1. In Now, cally First, it is LOAD) a program, the Computer will automatically CLOSE communication with any buff(or t your disk: this buffer. (If you've been using tape, you might remember that buffer • - 1 communicates with the tape recorder.) 2. 3. "0" the letter "O" not a zero. stands for output. It tells the Computer that buffer #1 will be sending out data to the disk. is "CHECKS/DAT" The is the It name of the disk file. name to index its disk's directory uses this yTO READ THEM"! At alt "CHECKS/DAT" 120 OPEN "I" = -1 THEN 170 130 IF E0F( 1 140 INPUT *li At Bt Ct 150 PRINT a$; b; Ct 1G0 GOTO 130 170 CLOSE »1 5 * DETAILS... So "CHECKS/DAT" has been easy to handle, but not very useful. You would probably like to add more details: far, CHECKS AMOUNT PAYABLE TO HORN SAFEWAY DR. lines MEDICAL 45.78 22.50 20.00 13.67 FIRST CHRISTIAN OFFICE SUPPLY Change EXPENSE FOOD CONTRIB. BUSINESS 25 and 115, and add some lines by typing: 25 WRITE ttl 27 WRITE #1 t ft$i 115 PRINT At t B B» LIST the program. This is "0" t 20 WRITE *1 > 25 WRITE «1 , 27 WRITE «1 t #1 > "DR. t ) i "I" the way it should look "CHECKS/DAT" HORN" IF 110 INPUT #1 115 PRINT A$ 120 GOTO , > #1 = "CHECKS/DAT . -1 #5.1 1 THEN 130 Write a program which will print only those checks which were for JAR expenses. A$i Bt C$ Bi Ct 105 The answers to all the "Programming Exercises" are in Appendix A. it. CHAPTER CHECKPOINT 1. if you need to store a whole list of checks? Continue to plod along with this program, and it'll soon be unbearable. 28 (INTER) PROGRAMMING EXERCISE » A GOOD TIGHT PROGRAM What When you want to quit, "MEDICAL" 130 CLOSE *1 Now RUN Input any checks. YOUR CHECKS ARE STORED ON DISK PRESS (ENTER) TO READ THEM? (ENTER) GOODY BANK 230.87 CAR a5. 78 E0F(1) 105 it. CHECK PAYABLE TO :? GOODY BANK AMOUNT :$? 230.97 (ENTER) EXPENSE CAR (ENTER) CHECK PAYABLE TO :? (ENTER) 30 CLOSE «1 100 OPEN t : Ct now: 10 OPEN t ) Ct > i simply press (ENTER in answer to the check payable to prompt. For example: "MEDICAL" t INPUT #1 110 : RUN ^5. 78 t i 2. 3. 4. What is a buffer #1? Why must you OPEN a disk Hie? Why must you CLOSE it? What is the difference between a file for input and output? OPEN Try saving many different graphics programs on disk and calling them from one main program. Sample Program how. 7 in Appendix C shows You can quickly store, organize, and update all your financial information with a disk system. See Sample Program 1, 2, and 8 in Appendix C for program listings. °°« izr ^k ,* '' ;«^ "-,. \^ CHANGING IT ALL AROUND (Updating a Sequential Access Everything you put on the disk and take off of it goes through a spot in memory called a buffer. When we told you how to put data on tape in Getting Started With Color BASIC, we didn't talk about these buffers. We didn't need to. There is only one buffer which communicates with the tape recorder — buffer #- 1. at the same RUN "0", Mi «1 i "ANIMALS/DAT" "HORSE" *1 t "COW" *1 Now, let's assume you want to change "COW" to "GIRAFFE!' First, you need to read the it. data items into memory with an input program. Erase memory. Type NEW (ENTEffl and then type: With your disk system, you can use up to 15 buffers. This means you can have up to 15 spots in memory communicating with 15 different disk files OPEN 20 WRITE 30 WRITE am CLOSE 10 File) 10 OPEN "I" M, "ANIMALS/DAT" 20 IF E0F(1) = -1 THEM 110 30 INPUT «1 A$ 40 CLS PRINT @ LOG "DATA ITEH 109 GOTO 20 112 CLOSE «1 i t time. : The reason we brought this subject up is that we want to demonstrate how to change some of the data in your file. Tb do this, it is very helpful to use two buffers. . Note: In Chapter 10, we'll demonstrate how to take A* Then you need to add lines which will allow you to change one of these data items and store the change in the disk advantage of more of these buffers :" file. Type: "PRESS IF NO CHANGE" " G0 PRINT % 2G3, "CHANGE 70 INPUT X% 50 PRINT @ 451 t ; : Type this program: ! 29 CHANGING SO IF X* "" = 90 WRITE *1 RUN i THEN X$ As soon ?FM ERROR as the Computer gets prints: it IN 90 LIST the program. Line 10 opens buffer #1 to attempting to output data to buffer #1. The Computer won't output data to a buffer opened for input. input data. Line 90, however, This is ALL AROUND Line 110 CLOSEs communication to buffer #1 and line 120 CLOSEs communication to #2. A$ X* the program. to line 90, = IT is where the additional buffer becomes handy. To output your changed data to the disk, you can open another buffer for output. Add these you have two files. "ANIMALS/DAT" contains the old data and "NEW/DAT" contains the new. Add these lines to the program and RUN it: Now "ANIMALS/DAT" 130 KILL 140 RENAME "NEW/DAT" TO "ANIMALS/DAT" Now the old "ANIMALS/DAT" file is the disk and the "NEW/DAT" 10 OPEN "ANIMALS/DAT" THEN B0 deleted from has been renamed to "ANIMALS/DAT." To see what this updated file contains, SAVE this program if you want, erase memory, and type and RUN: file lines: *2, OPEN "0" 90 WRITE »2* X* 120 CLOSE »2 15 "NEW/DAT" . "I") 81 20 IF E0F(1) = 30 INPUT 81 A$ , , -1 40 PRINT A* RUN the program. Change "COW" to "GIRAFFE" This is way the 10 OPEN "I". 15 OPEN "0" . 20 IF EOFt 1) the entire program looks: "ANIMALS/DAT" «2. "NEW/DAT" = -1 THEN 110 «1 30 INPUT 81 40 CLS PRINT : , @ PROGRAMMING EXERCISE #0.1 10E, "DATA ITEM :" A$ "PRESS IF NO S0 PRINT @ 2G3» INPUT X* B0 IF X$ = "" "CHANGE : " program which will allow add animals to "ANIMALS/ Write a you ; 70 G0 CLOSE «1 Understand? Try these exercises: A* 50 PRINT @ 451. CHANGE" . 50 GOTO 20 to DAT' i — Hint You must add them end of the file. THEN X* = A* 90 WRITE 82. K$ to the 100 GOTO 20 110 CLOSE »1 PROGRAMMING EXERCISE #6.2 120 CLOSE *2 Line 10 OPENs communication to buffer #1 for input from a disk file named "ANIMALS/DAT." Line 15 OPENs communication to buffer #2 for output to a disk file named "NEW/DAT: 7 Line 30 inputs A$ from buffer #1. Line 70 allows you to INPUT X|, which will replace A$. If you input X$, line 90 outputs it. Line 90 outputs X$ to buffer #2, which, in turn, WRITEs it to "NEW/ DAT!' 30 Write a program which will allow you to delete animals from "ANIMALS/DATT' Ready for the big gram many time? Our next exercise — is a pro- a mailing list proof you will want gram. We'll start you out with these lines which input the names, addresses, and phone numbers of your club members: CHANGING "0". »lf BO OPEN "MEMBERS/DAT" 110 WRITE *1 i ALL AOUND All of this works quite well on a small scale, but how would it work in a large file? What if you had 500 members in your "MEMBERS/DAT" file and you wanted to change only the address of the 453rd member? 90 GOSUB 430 100 IF N*="" IT THEM CL0SE«1:END N$t A*. P* 120 GOTO 90 PRINT "PRESS WHEN FINISHED" :PRINT INPUT "NAME OF MEMBER: "iN$ IF N$ = "" THEN 480 INPUT "ADDRESS " A* INPUT "PHONE NUMBER :"! P$ RETURN 430 CLS: 440 450 4G0 : 470 480 Now The process would still be the same. You would have to input each of the 500 members from one file and then output them all to another file. All of this just to change one record. There must be an easier way! ? Programming Exerbut we think you can do it. Remember, no one's watching. If you get bogged down, refer to the answer in Appendix A for help. finish cise. It'll be it by solving this difficult, The easier way is of programming. called the direct access It makes your faster to update, but in many them take up more space is in files cases it method easier and will make your disk. The choice yours. We'll talk about direct access in the next chapter. PROGRAMMING EXERCISE #6.3 Write a 1. 2. 3. 4. program in which you Note: We've demonstrated short example programs. There are many ways you could improve them. See the "Sample Programs" in Appendix C for ideas. can: See the names, addresses, and phone numbers of your club's members. Change the addresses of some of the members. Add new members. Delete some of the members. CHAPTER CHECKPOINT Why can 't you input and output data to the same buffer at the same time? Can you input data from a file OPENed for "O"— output? 31 DISK FILE STORAGE AftEA Mo MxwTMice u>mwor HumeeR A MORE DIRECT APPROACH (Direct Access to a File) now, we haven't been concerned with how your data is stored on the disk. For example, you might have put this in a disk file: Up to sequential access file, the Computer must start at the beginning and search through each item. It can't go directly to the item. In short, a sequential access file does not take full advantage of your disk's "filing system." it h/DAT USING THE DISK FILING SYSTEM / "MARIE E » ALEXANDER*" "J* DO "MARK JONES*" "BILL S " In Chapter 2 disk creates this filing system. In our analogy, the MITH cabinets are the disk "tracks" and the file drawers are the disk "sectors!' You can use tracks file *S'jtout K o£> MME5/DAT ** you want to change "J. DOE," to "ELLIOTT HOBBS"? You could not ask the Computer to go directly to "J. DOE" The Computer does not know where it is. What we talked about how formatting your if All the files we've created so far have been "sequential access!' To find a particular item in a and sectors to immediately find any item you want. you can divide your file into something which we call "records." You can then write a program which stores each record in a sector and allows you to put data in the records. The next page shows how your new disk file will look: To do this, 33 A MORE DIRECT APPR O AC H >* PUTTING A RECORD ON DISK Enough "MARIE ALEXANDER" record " J Since theory! Let's put one record in a disk be a direct access it'll start with the 1 Erase DOE" . memory and we don't have to type: OPEN "D" t til, "NAMES/DAT" t "J. DOE" 30 PUT *1 2 . 40 CLOSE *1 JONES" "MARK file, We'll start with the second. 20 WRITE *1 10 record 2 first. file. The program record 3 looks familiar . . . except for the word PUT in line 30 and the "D" in line 10. More on that later "BILL SMITH" record 4 Now // . . add some lines let's read this record back into 34 GET 81 2 t 3G INPUT #1 With each record the same length (the length of a sector), the Computer can go directly to "J. DOE!' All it has to do We call is count down to the second record. a "direct access" file. By direct access, we mean you can directly access any record you want this Note that Hmmm file. direct access file record is has one shortcoming. Each the size of a sector — 256 bytes. Since one one character of data, each large enough to hold 256 characters. of these bytes holds record is This means that our drawing above is a little misleading. If we illustrated all the empty space in each record, they would each have to be nearly ten times as long. We simply don't have enough room on the page. a beginner, all this empty space probably won't bother you. An empty disk can hold up to 612 records each 256 bytes long. Later on, when you become more comfortable with programming, you'll probably want to pack more records into a disk file. You can then progress to Chapter 9, where we will demonstrate how to make smaller If you're — records. 34 A* . . . — another new word GET any ideas? Let's look at the entire line 34 uses program: 2(3 A , 38 PRINT A$ 10 in the Computer will main memory. Type: so the its OPEN "D"i »1 WRITE »1 "J. , 30 PUT *1 . 2 3a GET «1 i 2 36 INPUT »1 p "NAMES/DAT" DOE" A$ 38 PRINT A$ 40 CLOSE *1 RUN it You'll hear the now familiar sound from your disk drive. The Computer is writing "J. DOE" in the disk file and then reading it back into memory. Here's how . . . . . Line 10 OPENs buffer #1 which will communicate with a disk file named "NAMES/DAT." As we said in the last two chapters, buffer #1 is one of the 15 "buffer" areas which can communicate with your disk. being OPENed for "D." "D" stands for direct access. Unlike sequential access, you don't have to specify whether you're OPENing Communication is A MORe DIRECT APPROACH communication for output or input. The "D" suf- fices for both. Line 20 WRITEs "J. DOE" to buffer #1. Since this program is open for direct access, "J. DOE" will remain in buffer #1 until the program sends it elsewhere. Line 30 does just that. buffer #1 Notice our drawing shows only two records in the GET record 4. Type: file. It into the disk file PUTs the contents of as record 2: 34 GET »1 RUN a . The Computer gives you an IE (Input past the End of the File) error. This is because the last record the program PUT in the file was record number 2. Hence, record 2 became the end of the and . . . file. Note: Didn't get You must already have on your disk with three or mo. this error? "NAMES/DAT" file : records. To PUT Then it WRITE »1 31 record more records 32 PUT si 1 in the file, add these lines. RUN the program: , t "BILL SMITH" a Now your "NAMES/DAT" file will have these four " DOE" J records: / record 2 W^MES/DAT" At this point, "J. It is DOE" is in record 2 of the disk no longer in buffer #1. ^ record file. " GETs record 2 and reads it back into #1. Now "J. DOE" is in both the disk file Line 34 buffer 1 J . DOE" . record 2 and buffer #1. INPUTs the record from buffer #1 into main memory and labels it A$. Now "J. DOE" is in both the disk file and main memory. It is no longer in buffer #1. Line 36 record 3 "BILL SMITH" record 4 With "J. PRINT DOE" in main memory, line 38 can it. Note: In the sequential access programs in Chapters 5 and 6, you didn't need PUT and GET. The Computer did this automatically. The OPEN line specified JtMdb r X 5/DA7 W/)M£S whether the buffer should output (PUT) data into the file or input (GET) data from the disk file. disk 35 >* A MORE DIRECT APPROACH PROGRAMMING EXERCISE 7.1 "NO record 2 Change lines 32 and 34 so that your Computer will use record 3 to PUT and GET "BILL SMITH." : itV-, *W ;*&*&&* NAME" "NO NAME" ,1 record 3 DEALING WITH GARBAGE "NO PUT anything in record 1 Ask GET record 1 and see what hap- You have not yet the Computer to . record 4 and RUN: pens. Type this "NO 34 GET »1 Since the Computer didn't PUT anything in record 1, record 1 contains whatever "garbage" is already there. ask the Computer to GET and INPUT "garbage" or give you an OS (Out of String Space) error. The OS error simply means the garbage consumes more than 200 will either get the bytes (characters). empty records will contain garbage until you fill them with something, it's a good idea to put some kind of data in all of them in advance. memory and "NO NAME" NAME" record 7 "NO Since your Erase "NO record 6 When you it, it NAME" record 5 1 > NAME" NAME" record 8 "NO type this program: NAME" record 9 10 OPEN "D" 20 FOR ;; = 30 WRITE *1 40 PUT »l , t *1 1 TO . i "NAMES/DAT" 10 "NO NAME" X "NO NAME" record 10 juhjL 50 NEXT X G0 CLOSE «1 x RUN This program sets up a disk file named "NAMES/DAT" which has ten records. Each it. record contains "NO NAME": Now erase memory Mtie$fD#r" NAME i 20 . " . record 36 1 and type this: #1 "NAMES/DAT" OPEN "D" INPUT "RECORD NO. (1-10) "i R 30 IF R > 10 THEN 20 40 IF R < 1 THEN 130 50 GET «1 R G0 INPUT «1 A$ 70 PRINT A$ "-- IS THE NAME IN RECORD" R 10 K "NO WfiM5S/D#T" > A MORE OIRECT APPROACH MORE POWER TO A RECORD INPUT "TYPE NEW NAME ELSE PRESS "; At 90 90 if "" = fi* 100 WRITE »1 110 PUT *1 So far, we have been PUTting only one "field" of data in each record. We can make the file more organized by subdividing each record into several THEN 20 A* , R t fields. 120 GOTO 20 130 CLOSE *1 Erase memory, type, and RUN it. See how all your records initially contain "NO NAME." Then, you can change the data in times as you any of the records at will, as many want. (To end the program, type a RECORD NO.) as the W READING ALL THE RECORDS At this point, you might like the Computer 10 OPEN 20 30 34 35 38 to your "NAMES/DAT" file with their appropriate record numbers. SAVE your program, if you want, erase memory, type, and RUN: print all of the records in RUN this program: "BUG9/DAT" "FLIE9" 1000000* *1 "D" WRITE *1 . "HAIRY" t PUT »1 2 GET #1 2 INPUT *i D*. N. T$ PRINT Dt Nt Tt . . . , CLOSE #1 Line 20 WRITEs three fields of data into buffer #1. Then, line 30 PUTs the entire contents of buffer #1 three fields) into record 2 of the (all file: " 10 OPEN 20 R = "D" INPUT «1 IF R 70 R = *BU&S/ "NAMES/DAT" R . " 10 = R At t 50 PRINT At 60 » 1 32 GET *1 40 *1 , DfilT + 13 IN RECORD" record R 1 THEN 90 1 "FLIES 80 GOTO 30 I t 000000 » "HAIRY" / record 2 90 CLOSE *1 makes R equal to 1. In the next lines, the Computer GETs, INPUTs, and PRINTs record 1. Line 20 Line 70 then makes R equal to 2 and the whole process is repeated with record 2. When R equals 10 — the last record in the file — the program ends. GETs everything in record 2 and reads it INPUTs all three fields of data from buffer #1 and labels them as D$, N, and T$. Line 34 into buffer #1. Then, line 36 There are many occasions when you will not know the last record and number in the file. Change line 60 RUN the program: Try substituting this G0 IF R L0F( 1 ) for line 36 and RUN 38 INPUT *1 LOF looks at the file which buffer #1 (the . i Dt number communicating with. It tells Computer what the last record number in that INPUT only INPUTs only in parenthesis) is Since this line asks the Computer to the the file is. . THEN 90 first field of data in buffer #1, it "FLIES." 37 A MORE DIP.ECT APPP.OACH PROGRAMMING EXERCISE 7.2 CHAPTER CHECKPOINT 1. What do you think the Computer would print if you ran the pro- 2. gram, using this for line 36? Why? 3. 3G INPUT «1. N 4. What are records? Why must you use them to access data directly? What are Gelds? What is the difference between a sequential access and a direct access file? Why is it quicker to Hie? PROGRAMMING EXERCISE 7.3 Change the program which stores the "NAMES/DAT" file so that each record will contain five fields of data: 1. name 2. address 3. city 4. 5. 38 state zip update a direct access SECTION III TOIE IBEIFMIEID) ©nSDS IPMDOISAKfl After writing disk programs for a while, you might want to make them more efficient. Perhaps you'll want to put more data on the disk. You might also want to economize on memory space or use some extra buffer space. At that time, we invite all of you ambitious people to read this section. The subject matter is more advanced and technical. Once you finish it, though, you'll have all the information you need to write the best possible disk programs. 39 r a HOW MUCH CAN ONE DISK HOLD? (What the Computer writes in a Disk Your disk is divided into thousands of equal-sized Each unit is a "byte." One of these bytes can hold one character. Thus, the word STRAW will consume five bytes of disk space. units. An empty disk contains 161,280 bytes. 4,608 of them house the directory. This leaves you 156,672 for your disk files. Note: A disk contains 35 tracks. Each track contains 18 256-byte sectors, or 18x256 = 4,608 bytes. One of the tracks is for the directory. This leaves 156,672 bytes (4,608 bytes per track x 34 tracks). File) 2,305 bytes of data, for example, the Computer it, or 4,608 bytes (2,304 will allocate 2 granules for x2). The Computer allocates file space in this manner because it's the most efficient way to create a file. It is very tricky to change this and is something that only very technical people would want to do. (See Chapter 11, Technical Information, for additional information.) The second Does this mean you can use the entire 156,672 bytes for data? Possibly. There are two factors which will determine this. The has to do with the way the Computer a disk file. It stores a file in clus(We call them granules.) Each granule con- first allocates space for ters. factor which affects how much data you can put in a disk file is your program. Some disk programs are very efficient. Others put a lot of overhead and empty space in the file. In the next two chapters, we're going to compare eight different types of programs. Each will store — — tains 2,304 bytes. the same data 5, 'TEN;' - 16, and "PAPER" in a disk file named "OFFICE/DAT." The amount Because of this, all of your disk files will contain a multiple of 2,304 bytes. If your file contains of overhead and empty space each program will put in "OFFICE/DAT" will vary greatly. 41 HOW MUCH CAN ONE DISK HOLD? WRITING ON THE DISK Program 1 uses Type and disk. WRITE RUN to of put this data on the 0ffi<*/dat» it: / PROGRAM 1 21 bytes 5 10 OPEN "0% 20 WRITE *1 30 WRITE «1 40 CLOSE #1 , i «lf "OFFICE/DAT" 5, "PEN" -16 "PAPER" » / t " P E N Note: Want actually the is they are above, but leave off the #1 in each line. This will prevent the Computer from writing the data on your disk (via buffer #1). The Computer will write it on your screen instead. Type: 1 6 What Look very carefully at what the Computer WRITEs. Every blank space and punctuation mark counts. Notice the way the Computer WRITEs the two strings (PEN and PAPER). It puts quotation marks around them. It WRITEs the numbers (5 and -16) differently. If the number's negative, the Computer puts a minus sign in front of it. If it's positive, the Computer simply puts a blank space ASCII code Computer converts mark count to (see for space in clusters, "OFFICE/DAT" will actually consume 1 granule of disk space or 2,304 bytes. However, for the purpose of comparison, we'll only look at the 21 bytes which Program 1 puts in "OFFICE/DAT:' file A DISK-EYE VIEW To input "OFFICE/DAT," type and "INPUT Program" (erase memory RUN this first): INPUT PROGRAM lines. It skipped down to 10 CLS 20 OPEN "I", #1» "OFFICE/DAT" = -1 THEN 80 30 IF E0F< 1 40 INPUT #1 A, Bt ) the , next line instead: 50 60 70 B0 "PEN' OK -IS, Appendix D) which a binary number. one character each. Don't forget the blank space preceding 5. What you should come up with is 21 characters. Program 1 puts 21 There are two characters you typed which the Computer didn't WRITE on the screen. These are the two (ENTER) characters which you typed at the 5 Computer Each Count the characters. Make each (ENTER) (represented by an asterisk), comma, and quotation it. WRITE * the disk are binary codex. Since the Computer allocates end of the the " bytes in "OFFICE/DAT." WRITE 5, "PEN" (ENTER) WRITE -IS, "PAPER" (HDIE) in front of P A P E R " i be precise? to WRITEs on character has an an easy way to see what lines 20 and 30 wrote on your disk. Type these two lines exactly as There * - " PRINT: PRINT "DATA ITEM PRINT "DATA ITEM " B$ GOTO 30 CLOSE *l :" A : "PAPER" OK When writing on the disk, the Computer actually WRITEs each (ENTER) character exactly as you did input your data items. However, it did not input the quotation marks, commas, and blank spaces which we told you were interspersed with your data. This illustration shows what Program 1 WRITEs on your disk. (We used asterisks to represent the [ENTER) characters): To actually see what Program 1 wrote on your disk, you can use a "LINE INPUT Program." First typed 42 It it. HOW MUCH CAN ONE DISK HOLD? SAVE "INPUT Program" you now have the memory. (You'll be using Now change it into a "LINE INPUT Program." Delete line 50 and change lines 40 and 60. Type: 40 LINE INPUT #1 L* 50 G0 PRINT "DATA LINE :" B0 CLOSE *l 90 PRINT @ 394 in it later.) SAVE it. grams 2, 3, > "BYTES' L be useful in comparing what Proand 4 put in your disk file. It will , PRINT— FOR A CHANGE L* we've used only WRITE to put data in a you've used other forms of BASIC, you might be accustomed to using PRINT rather than So RUN Line 40 INPUTs an entire LINE, rather than one single data item from the disk file. This LINE includes everything up to the (ENTER) character punctuation marks, spaces and all. and . . . — "OFFICE/DAT" file, the first LINE contains "PEN." Line 40 labels this line as L$ and line 60 5, PRINTs it on your screen. In the far, disk file. If WRITE. The Color Computer disk system allows you to do this. However, PRINT is much more tricky to use. not used to it, don't bother learning Skip to Program 4. If you're this. The program then INPUTs and PRINTs - 16, "PAPER" the second and final line in the file. file We KILL "OFFICE/DAT" — can easily alter this program so that it will count how many bytes are in the file. Add these lines and RUN . . . 25 PRINT 57 G0 G5 90 "THIS FILE CONTAINS PRINT: PRINT: PRINT: PRINT = Lt+ "*" PRINT Mt! L = LEN(Mt) + L PRINT @ 394t L "BYTES" :" the entire (ENTER) RUN Here's Program 2: PROGRAM 2 42 bytes Line 57 adds an asterisk to each LINE. This asterisk represents the (ENTER) character. Line 65 then counts the total number of characters (bytes) in each line. is "OFFICE/DAT" erase memory, and type and run Program 2. the INPUT or the LINE INPUT Program, if you'd like. m This old Now it: Then 27 KILL your with us? by typing: Still all "LINE INPUT Program": PLINE INPUT PROGRAM OPEN "0" 20 PRINT 81 30 PRINT *1 40 CLOSE »1 10 , *1 , 5» "OFFICE/DAT" , "PEN" -1G "PAPER" , » Lines 20 and 30 PRINT your data to buffer #1 which, as you know, is one of the 15 buffers which will send your data to the disk file. To see what Program 2 PRINTs, type: 10 CLS 20 25 27 30 40 57 G0 G5 70 OPEN "I"* «li "OFFICE/DAT" PRINT "THIS FILE CONTAINS PRINT: PRINT: PRINT: PRINT IF EOFU) = -1 THEN 80 LINE INPUT *1 L* M* = L* + "*" PRINT M$! L = LEN(M$) + L GOTO 30 f ; PRINT 5» "PEN" (ENTER) PRINT -1G "PAPER" ENTER) [ Notice the Computer did not enclose the strings — PEN and PAPER — in quotes, as WRITE did. This will be important to Now know later. look at the blank spaces. We'll start with the first one the one before the 5. This means the — 43 HOW MUCH CAN ONE DISK HOLD? same thing it did with WRITE. "OFFICE/DAT" 5 is a positive number. Now Then type and RUN this program: for the other blank spaces . Computer PRINTs a number, "trailing" first file. blank space after it. . . it PROGRAM 3 Whenever the PRINTs one 17 bytes This explains the blank space after the 5 and - 16. OPEN "0" 20 PRINT #1 30 PRINT *1 40 CLOSE *1 10 How about all the additional spaces? Remember, from Getting Started With Color BASIC, what a . *1 . 5i r , "OFFICE "PEN" -lGi "PflPEf? comma in the PRINT line does? It causes the Computer to PRINT your data in columns, inserting spaces between the columns. The Computer will PRINT This is what Program 3 PRINTs on your disk. (Use the LINE INPUT Program to test this, if you'd like): every single one of these blank spaces in your disk file: *0FFIC£/P*T Cn{L> /DAT' * OFFICE / 5 \ PEN*-1G PAPER* PEN*- IB PAPER*^. JtMxL *g "OFFICE/DAT Count into all the characters. Program 2 puts 42 bytes "OFFICE/DAT." Note: Unclear about what commas do in a PRINT line? Type some more PRINT lines with commas between data items: PRINT 1. 2, 3* H, 5, 6> 1, PRINT 'HORSE 11 , "COW'f B I " Very efficient. Only 17 bytes. There are only three blank spaces in this disk file. There is a space before the 5 (to indicate that it is positive) and spaces after 5 and - 16 (to indicate that they are numbers). There are no blank spaces around the strings. HHTEffi ''RABBIT", "OOG PRINTING LESS the blank spaces PRINT inserts in your disk file are a waste of space. They are. The way to get around this waste is to use semi-colons. You might again recall, from Getting Started With Color BASIC, that semi-colons in a PRINT line compress your data. Type: You might PRINT 5! feel that all "PEN" PRINT -lGi (ENTER] "PAPER" (EHTEB) You can compress your data on the disk in the same manner. Erase memory and KILL your old 44 THE TRICKY PART There are certain types of PRINT lines which are tricky. (We did warn you, didn't we?) Type: HOW MUCH CAN ONE DISK HOLD? PRINT "PEN"! "PAPER" fEHTER) PRINT "JONES. MARY" (iNTEff) print "pen". 5 The Computer would read (mm The line PRINT «l > "PEN" 5 memory as one item. (Reason; although the Computer normally interprets blank spaces as a delimeter, it will "PAPER" i PEN (with all the blank spaces) back into (in program) would print this in your disk your disk way when and precede a number). not interpret them in this string file: they follow a For more information on using PRINT in disk programs, see the TRS-80 Model I, Model II, or Model III Disk System Owner's Manual. PENPAPER* PENPAPER back The Computer would read memory meter" into as one item. (Reason: there is not a "deliquotation mark, or space to — a comma, separate AN ATTRACTIVE DISK FILE — PRINT USING is another word you can substitute for WRITE. We discussed PRINT USING in Going Ahead With Extended Color BASIC). PRINT USING "1 The line PRINT *l this in Type: PEN from PAPER). your disk , "JONES > MARY" would print ' JONES t 5 !$+»#,»»" ! "PEN" < 5 (ENTER) PRINT USING "I file: *,$+#«.**" "PAPER" -16 , ENTER) You can get the Computer to print these same images on your disk with this program. KILL "OFFICE/DAT," erase memory, and type and 7 MARY* RUN: PROGRAM 4 32 bytes The Computer would read JONES, MARY 10 OPEN back "0" t #1 t "OFFICE/DAT" **+##,«#"! 20 PRINT #1. USING "X "PEN" 5 as two items: JONES and MARY. (Reason: The Computer interprets the comma as a delimeter). f 30 PRINT tl, USING "X The in line PRINT «i your disk , "PEN" , 5, would print ( i "PAPER"* -IB this 40 CLOSE #1 file: which prints * this in $+ PEN PEN 2$+*» #t"i - 1 B . 5 your disk . file: 00*PAPER 130* \ 45 HOW MUCH CAN ONE Note: There are five blank spaces between the % characters in lines 20 and 30. Counting the two % characters, this string field (for printing PEN and PAPER) more programs which direct access will put the same data in files. contains seven bytes. CHAPTER CHECKPOINT Now the data is already in an attractive print for- mat. You can input and print it using a simple line input program. Erase memory, type and RUN: 1. What is the minimum 9. Why can 't it be smaller? Hnvr rfnan th* Cnmngter size of a disk Sle? 10 INPUT and IINT line cause a 20 30 40 50 G0 *1 OFFICE/DAT" OPEN "I" IF EOFtl) = -1 THEN G0 A* LINE INPUT »1 PRINT At GOTO 20 CLOSE *1 > > * PRINT tine IINT strings? 46 ntimhe jftlef} 3. How does it WRITE strings 4. What is the' difference betwi LINE INPUT? 5. What does a comma in a PI Computer to do? What does a semi-colon the 6. All of the files we've created in this chapter are sequential access. The next chapter compares four WJRJtTFf m^diM "'"" sen i DISK HOLD? 7. it cause it to do? How does the Computer PE f "l 9 TRIMMING THE FAT OUT OF DIRECT ACCESS (Formatting a Direct Access /» File) Direct access files often contain a lot of empty space. For example, our first program is very similar to Program WRITE lines are direct access, it from the 1 last chapter. The However, because it is will put 512 bytes in "OFFICE/ identical. DAT": 512 bytes OPEN "D" 20 WRITE #1 30 40 50 60 PUT «1 , WRITE «1 PUT *1 i t miifiiiiiHHHim •It "OFFICE/DAT' 5» "PEN" miiiiiiiiiiii1 1 1 1 1 1 1 1 1 , IfiliiiiililiilllUiiii! miimiiiiiiiflimim HBiiiiiiiimmiinii PROGRAM 5 10 V -16» "PAPER" BIIBilllllillllieiiiilll 2 CLOSE «1 iiiiiiliiiiiiii i i a i i i i i A direct access program puts your data inside records. Each record is 256 bytes. Program 5 puts two records in the "OFFICE/DAT" file. Therefore, consume 2 x 256, or 512 bytes: will it Bisiiiiaiiiiiiinigiim iiniaagiiiBBaBBiaeiiiii TRIMMING THE FAT OUT OF OIRECT ACCESS Note: We could have used PRINT or PRINT USING WRITE, The Computer would have then rather than PRINTed your data inside each PRINT or PRINT USING format. record record using the 1 TRIMMING THE FAT Program 6 PAPER"* IB the Computer to tells as Program 5, except that 12 at the end of line 10, This same the is we inserted a number make each record 12 bytes long: PROGRAM 6 24 bytes OPEN "B"i «lt "OFFICE/DAT". 12 10 20 WRITE »1 30 PUT »1 t 40 WRITE *1 50 PUT «1 5 , "PEN" I . , -IB. "PAPER" 2 t B0 CLOSE *1 and really whittles / , " record 1 *o?Fice/mT" down: "OFFICE/ DAT" 5 record 2 this file G * p E N " * 1 " P A P E R " * record 2 "0FFIC£/DAT" This obviously wastes a massive amount of space. Notice that what the Computer actually writes in each record: file, all records must be the same {We explained why in Chapter 7.) If you tell the Computer how long to make them, In a direct access length. don't they will 5, all be 256 bytes. "PEN"* -IB, "PAPER"* In this program, we made each record 12 bytes, the Type and RUN Program sure to erase memory and (Be size of the largest record. is the same as what Program 1 wrote. Count the bytes. That's nine bytes in the first record in the second. You'll program. 48 need to know this for and 12 our next 6, if you'd like, KILL your old "OFFICE/DAT" file first.) After RUNning Program 6 you can use this program to input the file: TRIMMING THE FAT OUT OF DIRECT ACCESS DIRECT INPUT PROGRAM 10 OPEN 20 R "D". *1 R + = 30 GET #1 By using FIELD and LSET, your program will work the same as any direct access program. The difference is what FIELD and LSET put in each 'OFFICE/DAT record: 1 R , 38 INPUT Hi A, B$ 50 PRINT "RECORD" R ":" A G0 IF LOF(l) <> R THEN 20 70 CLOSE »1 Note: You can't use the "LINE how many determine INPUT bytes this INPUT Program" does not input the spaces in PEN to LINE consumes. file a record which record 1 follow the ENTER) character. ; - EFFICIENCY, EFFICIENCY 1 6 P A P E R record 2 . . We can get even more efficient. Our next direct program consumes only 16 bytes. Erase memory, KILL the old "OFFICE/DAT" file, and "OFF/CS/OAT access type and RUN Program 7. PROGRAM 7 16 bytes 10 20 30 40 50 S0 70 OPEN "D"» FIELD »1 LSET At = LSET 8$ = PUT »1 1 LSET A$ = LSET B$ = *1 . "OFFICE/DAT" 3 AS At "5" t 5 . i 8 AS Bt . the file SAVE it. "PEN" "-IS" "PAPER" 2 Then erase memory and input OPEN "D" m GET »1 , each record , • , 3 1 t 'OFFICE/DAT" AS A* > . 5 AS B* 1 R "RECORD" R ":" At! Bt 60 IF LOF(l) <> R THEN 30 70 CLOSE »1 that we've established this, we can put data in each field. Line 30 LSETs 5 in the A$ field (SETs the character 5 to the Left of A$). Since the character 5 only consumes 1 byte and there are 3 bytes in the A$ field, there are 2 empty spaces at the end of 5. we had convert the number 5 to a string by putting quotes around it. You cannot LSET a number. You must convert it to a string. Notice FIELDED INPUT PROGRAM 10 to divide Now with this program: 20 FIELD *i 30 R = R + Computer two fields. The first field is A$ and the second is B$. These two fields will be the same size in every record, A$ will always be 3 bytes and B$ will always be 5 bytes. There are two new words in this program which we'll talk about later. Let's see what the program first. the tells into 90 CLOSE *1 does . Line 20 . 90 PUT «1 Only the bare essentials. Here's how Program 7 works to S PEN in the B$ field. Again, this leaves 2 empty spaces at the end of A$, Line 40 LSETs the word since PEN is 3 bytes. 50 PRINT Line 50 PUTs process is all this in record repeated for record 2. 1. Then, the same 49 TRIMMING THE FAT OUT OF DIRECT ACCESS Now look at the "Fielded let's INPUT Program:' 1. RUN the program Notice we used a FIELD line. without line 20 and see what happens . 2. first 3. . 4. Without a FIELD line, the Computer does not know where the two fields are. Whenever you input FIELDed records, use a input program. FIELD line in Can you guess what the Computer would do 5. 6. your : .\l Vjl ; RUN Now = RUN the "Fielded '.-. ' : - Write a program to input the you created in Exercise #9.1. file ascs-ffira-afi "lZGaSGTSa" load and ' " #9.2 LSET 30 LSET A* .« PROGRAMMING EXERCISE if you a long string, such as "123456789," into one of the fields? LOAD Program 7, change the program. (First, SAVE the line 30, and "Fielded INPUT Program" with line 20 reinstated.): tried to — 15 bytes^£3§§§i^ name — 10 bytes address — 15 bytes city — 10 bytes state — 2 bytes zip code — 5 bytes last name INPUT Program." A$ is only 3 bytes. Therefore, the Computer only LSETs the first 3 bytes of "123456789." It chops the remaining characters off: A NUMBER IS A NUMBER, Let's in assume you your disk file. be putting a will . . lot of numbers Every number might be a differ- ent length: ^OFFICE /OA7" / Mmm record -5.237632 673285 31 However, it is very important that the Computer not chop any of the digits off. This might entirely change the number's value. 1 The word MKN$ will record 2 solve this problem: PROGRAM 8 20 bytes "OFF/C&/ DAT 10 OPEN "D" t »1 20 FIELD *l t 5 30 LSET More on this later Before going on to the next ft* = 40 LSET B* = 50 PUT *1 p 1 program, try writing your own FIELDed program: 60 LSET At = PROGRAMMING EXERCISE 70 LSET Bt = 80 PUT *1 2 . . . #9.1 50 > p "OFFICE/DAT" AS A* , 5 10 AS Bt MKNt<5) "PEN" MKN$t-iG) "PAPER" 90 CLOSE »1 Write a direct access program to put a mailing list in a disk Hie. Make each record 57 bytes with The only difference between this program and program 7 is lines 10, 20, 30, and 60. This is what it these six fields: stores in your disk file: THIMMING THE FAT OUT OF DIRECT ACCESS Jfi€JUM*U*Utf' off To read this program string. % / bFF!C£/DAT" make f in, you need these changes to to decode the INPUT Program" and the "Fielded it: 10 OPEN "D" #1 "OFFICE/DAT" 10 20 FIELD *i 5 AS A* 5 AS B$ 50 PRINT "RECORD" R " " CYN(A$)i B$ , S record LOAD , , , 1 , : ; and APER Coda, ^&tr/6 RUN it number 1 it . . CVN (in line 50) decodes A$ to the . represents. Note: The Computer only sees the number. It rounds the rent off. first 9 digits of a *office:/dat MKN$ converts a number to a coded string. Regardless of how long the number is, MKN$ will always convert it to a string that is five bytes long. For example, change line 30 to with more than five digits: 30 LSET A$ = LSET a PROGRAMMING EXERCISE #0.3 Write a fielded direct access prowill store the populations of all the countries. Make each record contain 15 bytes with these two fields: number gram which MKN$(12345G7B9) Erase memory, KILL "OFFICE/DAT," and type and RUN the program. This is what it stores in your disk file: 1. 2. — country 10 bytes population 5 bytes — WBPI^^^H^BOWi^PBBB PROGRAMMING EXERCISE #9.4 ^CfcflCE/mT I 9 ' Write a program which will input the Hie you created in Exercise --— 5 Jswbu Ofdc j*v /23f56>7&7 #9.3. CHAPTER CHECKPOINT Ifyou do not specify the record length, how many bytes will each record contain? 2. Why must you include a FIELD line when you LSET your data? 3. Howmanybytes will MKN$ convert a num1. "OFFICE/OfiT" ber into? 51 •t t % I * I SHUFFLING DISK FILES (Merging programs, using many buffers) Because storing and retrieving disk files is so easy, you will want to use them as much as you can. In this chapter, we're going to talk about some special ways you can use them. Be sure With the method, you can build a program out of related program "modules" SAVEd on disk. You can then MERGE any of these program files with whatever program you have in memory. Type and first SAVE these two related programs: AGE CONVERSION TO MONTHS 10 REM 20 N = N * 12 30 A* = STR*(N) SAUE 10 REM 20 N 30 A* + N = = A (ENTER) AGE CONVERSION TO WEEKS * 52 STRt(N) + " WEEKS" SAVE "WEEKS/AGE", A these pro- INPUT "TYPE YOUR AGE" i 40 PRINT "YOU HAVE LIVED" and combine SAVEd. Type: it . . N A$ with one of the programs you MERGE "MONTHS/AGE" LIST the program "MONTHS/AGE" (ENTERl The Computer has MERGEd with the program you have in . . . memory. Notice the line numbers are the same as they were in each individual program. MONTHS" " "MONTHS/AGE", when you SAVE . 5 MERGING PROGRAM FILES to type the A grams. We'll explain why later Erase memory. Now put this program in memory: (ENTER) At this point, this memory: is the program you have in INPUT "TYPE YOUR AGE" N 10 REM AGE CONVERSION TO MONTHS 5 20 N i = N * 12 53 SHUFFLING DISK FILES to now, that's all we've used buffers #1 and #2. But, as we've said earlier, you can use up to 15 disk buffer areas. = MERGE "WEEKS/AGE" "WEEKS/AGE" program. (ESTER) . with it — Up STR*(N) + " MONTHS" 40 PRINT "YOU HAVE LIVED ABOUT' 30 A* A$ by typing MERGE Then LIST the MERGEd Notice that lines 10, 20, and 30 of the program you had in memory were replaced by lines 10, 20, and 30 of the "WEEKS/AGE" program. To use more than 2 buffers, you must first reserve space in memory for them. To do this, use the word FILES. For example, FILES 3 reserves 3 buffers. Making use of all these buffers will greatly sim- your programs. For example, let's assume you own a computer school. To organize it, you first put all your students in a file named "COMPUTER/SCHr Erase memory, type and RUN: plify the Computer how to merge the two programs. When there is a conflict of line numbers (two line 10s) the line from the disk file The numbers line tell f prevails. "0". *1 10 OPEN Now we'll get technical (for those of you who are the Computer normally writes in your disk file is the ASCII code for each character of data. For example, it writes the word AT with two codes the ASCII code for "A" (65) and the ASCII code for *T" (84). (The ASCII codes are interested). What — all listed in Appendix D). 20 FOR X = "C0NPUTER/SCH" . TO B 1 30 READ At 40 PRINT *1 A$ . 50 NEXT X G0 CLOSE #1 70 DATA JON SCOTT CAROLYN 80 DATA DONNA. BILL BOB i , r it SAVEs a program, it writes the BASIC words differently. To save space, it compresses each BASIC word into a one-byte "binary" However, when code. Now you can write this program to assign the students to a BASIC or assembly-language class. Erase memory and type this "Class Assignment Program": MERGE You can't a file which contains these binary codes. This is why we had you type the A when you SAVEd the two programs above. The A tells the Computer to write the ASCII codes for each BASIC word rather than the binary code. By checking the directory, you can see if the data are in ASCII or binary codes. If there is an "A" in the fourth column, it's all in ASCII codes. A "B" indicates that some of the words are in your files in binary codes. Note: Try typing MERGE "MONTHS/AGE" The it's R tells the Computer to , ft ^HTFffi. RUN the program after MERGEd. USING MORE BUFFER SPACE I CLASS ASSIGNMENT PROGRAM 10 FILES 3 20 OPEN "0" 30 OPEN "0" "BA5IC/CLS" "ASSEMBLY/CLS" OPEN "I" "C0MPUTER/SCH" 1 THEN 120 50 IF E0F(3) G0 INPUT «3. ST4 70 PRINT PRINT ST$ 80 INPUT (IS BASIC LANGUAGE"! R 90 IF R > 2 THEN 80 100 WRITE 8R ST$ 110 GOTO 50 120 CLOSE 8 1 130 CLOSE 82 140 CLOSE 83 »l i *Z »3 . W t When you start-up your disk system, it sets aside two buffer areas in memory for disk communication. You can use either or both of them for reading or writing data to a disk file. 54 RUN it. After assigning all the students to a class, you can print a class roster with this program. Erase memory, type, and RUN: SHUFFLING DISK FILES CLASS ROSTER PROGRAM CLEAR 10 20 files 28 PRINT "BASIC/CLS" PRINT 30 OPEN "I". «1» "BASIC/CLS" : 38 IF EOFU) = -1 THEN 80 50 INPUT »1» A* S0 PRINT A$ 70 goto aa B0 CLOSE »1 Note: Substitute "ASSEMBLY /CLS" for "BASIC/ CLS" in lines 20 and 30 to print the class roster of the assembly language class. The "Class Assignment Program" has three buffers open at the same time. Because of this, you are able to communicate with three disk files at the same time. Line 10 reserves memory for these three buffers. Lines 20-40 OPENs the three buffers. Then, line 60 INPUTs a student from "COMPUTER/SCH" into buffer #3. Line 100 WRITEs the name of the student to either buffer #1 ("BASIC/CLS") or buffer #2 t 200 210 220 230 240 , , OPEN INPUT CLS PRINT CLOSE "I" , #1 , #1 , "WORD/DAT" At, Bt, Ct, At; Bt; Cti Dt ! Dt t E$ E$ #1 Note: You can make the buffer as targe as you want the students from buffer #3 ("STUinput, line 50 sends the Computer to lines 120-140, which CLOSEs the CHAPTER CHECKPOINT How must you SAVE a program which yo, wUl want to MERGE? three buffers. 2. When the two programs you're mergin both have the same line numbers, whic. lines prevail? 3, How many reserve more thing you'll like about FILES. Erase memory, type, and RUN: , Want to input this paragraph? Add these lines and RUN: all There's one , . DENT/SCH") have been CROWDING THE BUFFER am , = , ("ASSEMBLY/CLS"). When 1 "NORMALLY YOU WILL NOT BE ABLE TO PUT ALL OF THESE SENTENCES IN A DISK FILE AT THE SAME TIME. " £10 B$ = "THIS IS BECAUSE, WITHOUT USING FILES, YOU WILL ONLY HAVE A TOTAL OF 25G BYTES OF BUFFER SPACE. " 50 C$ = "IN THIS PROGRAM* WE'VE RESERVED £100 BYTES OF BUFFER SPACE, " E0 D$ = "THIS WAY YOU CAN SEND ALL OF THESE SENTENCES TO THE BUFFER AT THE SAME TIME. " 70 E* = "WHICH WILL OUTPUT THEM ALL TO THE DISK FILE AT ONCE, " 80 OPEN "0" »1 "WORD/DAT" 90 WRITE #1 A*. B$ C$ Dt Et 100 CLOSE #1 30 A$ 10 cls £100 buffers does the when Compute starts-up? hunter space does it reserve? it 4. How much 5. What does FILES 3, 3000 mean ? 55 ^ HtvttT^Ci^ <5^ ^/ "PR^ck : •: -. TECHNICAL INFORMATION (Machine-Language Input/Output) In this chapter, we'll discuss the technical details TVacks which are happening "behind the scenes" You don't need to know this information when you are programming in BASIC. In fact, you won't even be aware that these details are happening. The Computer organizes the disk into 35 tracks, numbered 0-34. Each track contains approximately 6,250 bytes* 6,084 of them are divided into sectors; the However, if you plan to write machine-language disk programs or are simply interested in knowing all you can, you'll definitely want to read this chapter. We'll begin by discussing how the Computer organizes all the bytes on the disk. Then, we'll show how to access them through machinelanguage programming and other advanced remaining are for system Byte# Contents 0-31 System controls 32-6115 6116-6249* Sectors The system 4E controls. System controls control bytes all contain the value of (hexadecimal). techniques. number of system control bytes at the end of each track might vary slightly due to slight speed *the WHAT A DISK CONTAINS When you power-up the Computer, it organizes the bytes on the disk into tracks and sectors. Some of these bytes control the system. The great majority of them are for data. variations. Note: One byte contains 8 bits. Each bit contains we express the contents of these bits as a hexadecimal (base 16) number. For example, if we say a byte contains the value of hexadecimal 4B, it contains this bit pattern — 0100110. can find more information on hexadecimal and kYou binary number systems in a math textbook. either a 1 or a 0. Normally, 57 TECHNICAL INFORMATION Sectors 9 sectors in V2 track x 256 data bytes per sector Each track contains 18 sectors, numbered 1-18. Each sector contains 338 bytes. 256 of them are for data. The remaining bytes are for system controls. 2,304 bytes in a granule The Computer uses granules Byte# Contents disk 0-55 System controls Data System controls tains 4,700 bytes, the 56-311 312-337 to allocate space for in 2,304-byte clusters. Thus, if a files Computer ules (6,912 bytes) of disk space for The hexadecimal contents of the system control The location of the 68 granules, file con- allocates 3 granit. numbered 0-67, is as follows: bytes are: Byte# Hexadecimal Contents 00 F5 0-7 8-10 11 12 Track Track Track 0, Sectors 1-9 0, Sectors 10-18 1, Sectors 1-9 Track Track Track 16, Granule Granule 1 Granule 2 FE Track 00 13 Number 14 15 16-17 18-39 40-51 52-54 55 Sector Number 01 Cyclic Redundancy Check , &H5FFF , 1H500A through 38FF: To load it back into memory, you could use the LDX $C00B SET X AS A POINTER TO THE LOADM command: LDA STA *2 PARAMETERS DCOPC = 2 FOR READ LOADM "PROG/MAC" A SECTOR ,X CLR 1 LDA «3 SELECT DRIVE SELECT TRACK STA LDA 2,X *17 SELECT SECTOR 17 STA 3.X LDU **3B00 STU a,x tX JSR [*C004] LDA »$00 STA SFF40 TST BtX BNE ERRORS This would load 3 executing If you DCBPT=3B00(HEX) FOR STORING DATA CALL DSKCON TURN OFF THE DRIVE MOTOR CHECK FOR ERRORS GO REPORT THE ERRORS "PROG MAC" locations 5000-5FFF. it want back into memory The Computer would begin at location 500A. to load it into a different you could specify an memory loca- address to add to the program's loading address. For example: tion, LOADM "PROG/MAC" , offset 1000 would load "PROG/MAC" into memory locations 6000-6FFF. The Computer would begin executing it at address 600A. 61 TECHNICAL INFORMATION SPECIAL INPUT/OUTPUT 50 EXT$(0) COMMANDS = 70 NAM*(N) = BASIC offers two special input/output commands. These commands input and output data directly to a particular sector. They do this through bypass- 80 EXT$(N) = ing the entire disk's filing system. 110 DSKI$, inputs the data from the The first, you specify. DSKI$ This MID*(C*,9,3) 60 FOR N=l TO 7 is its sector format: MID$(C*»N*32+1 ,8) MID$(C$,9+N*32»3) 90 NEXT N 100 FOR N=0 TO 7 IF EXT$(N) = "DAT" AND LEFT*(NAM$(N) ,1)<>CHR$(0) THEN PRINT NAM$(N) 120 NEXT N 130 NEXT X drive number, track, sector, string vari- The second command, DSKO$, outputs data ablel, string variable2 you specify. Since it bypasses the disk filing system, it will output data without opening a file and listing its location in the directory. For this reason you need to be careful: directly to the sector The 128 bytes of the sector are input into The second 128 bytes are input into string variable2. For example: first string variablel. DSKI$ 0, 17, 1 , A*, B$ (ENTER) inputs the contents of sector 1, A$ and the second 128 bytes into B$. After typing this command, you can display the contents of this sector with: DSKI$ 10 FOR X=3 will read TO 11 20 DSKI$ 0,17»X»A$»B$ 30 C$ = A$ + LEFT$(B$»127) 40 NAH$(0) 62 = 2. not to output data over other data you presently have stored on the disk. The format DSKO$ (ENTER) any sector on the disk, it is the only BASIC command which will read the directory sector. This sample program uses DSKI$ to search the directory for filenames with the extension "DAT": Since not to output data over the directory sectors unless you no longer plan to use the directory. track 17 of the disk in drive 0. It inputs the first 128 bytes into PRINT A$i B$ 1. LEFT$(C$,8) of DSKO$ is: drive number, track, sector, stringl, string2 Stringl will go in the first 128 bytes of the sector. String2 will go in the next 128 bytes. For example: DSKO* 0, 1. 3, "FIRST STRING", "SECOND STRING" (ENTER) to sector 3, track 1, on the disk in drive 0. "FIRST STRING" will go in the first 128 bytes of this sector. "SECOND STRING" will go in the second 128 bytes. Outputs data AIPDPEMMIXEi t . APPENDIX A. PROGRAMMING EXERCISE ANSWERS PROGRAMMING EXERCISE #5-1 90 PRINT: PRINT "CHECKS FOR CAR EXPENSES" OPEN "I" ,*1 ."CHECKS" IF E0F( 1) = -1 THEN 100 INPUT *1 ,A$,B,C$ IF C$ = "CAR" THEN 70 GOTO 90 PRINT: PRINT "CHECK PAYABLE T0:"iA$ PRINT "AMOUNT:" SB GOTO 30 10 20 30 40 50 60 70 80 90 1 130 OPEN "I" 140 OPEN "0" 150 160 170 PROGRAMMING EXERCISE #6.1 200 190 t , 210 220 > 230 240 . PROGRAMMING EXERCISE #6.2 10 OPEN "I" . *1 "0" , #2. 20 OPEN 30 IF EOF(l) = 40 INPUT *1 A$ 50 PRINT: , , - 1 THIS" 90 GOTO 30 CLOSE *1 CLOSE *2 120 KILL "ANIMALS/DAT" 130 RENAME "1NEW/DAT" TO "ANIMA 102 2G0 270 280 290 300 310 320 1 HE 1 1 R$ THEN CLOSE *1: N$, A$. P$ GOTO 10 "MEMBERS/DAT" "TEMP/DAT" CLS INPUT "DO YOU WANT TO CHANGE THE FILE"! 02$ IF EOF(l) = -1 THEN 320 INPUT *li N$. A* P$ PRINT: PRINT "NAME :" N$ PRINT "ADDRESS :" A$ PRINT "TELEPHONE :" P$ IF 02$ = "NO" THEN 300 PRINT: PRINT "DO YOU WISH TO:" PRINT "1) CHANGE THE ADDRESS?" PRINT "2) DELETE THE MEMBER?" PRINT "3) GO ON TO THE NEXT MEMBER?" INPUT N ON N GOTO 290. 160, 300 GOTO 230 INPUT "INPUT NEW ADDRESS"! A$ WRITE *2, N$» A$, P$ GOTO 160 PRINT: INPUT "DO YOU WISH TO ADD A NEW MEMBER" 03$ IF 03$ = "NO" THEN 380 GOSUB 430 IF N$ = "" THEN 380 WRITE #2, N$, A$, P$ GOTO 340 CLOSE *1 *2 KILL "MEMBERS/DAT" RENAME "TEMP/DAT" TO "MEMBERS/DAT" GOTO 10 END CLS: PRINT "PRESS WHEN FINISHED PRINT INPUT "NAME OF MEMBER:" N$ IF N$ = "" THEN 480 INPUT "ADDRESS:"! A$ INPUT "PHONE NUMBER:" P$ RETURN , *1 i *2i , : , i 330 340 350 360 390 400 PRINT A$ 60 INPUT "DO YOU WISH TO DELET 70 IF R$ = " YES" THEN 90 80 WRITE *2, A$ 250 370 380 "ANIMALS/DAT" "NEW/DAT" THEN 100 , 120 GOTO 90 180 OPEN "I" «1 "ANIMALS/DAT" 20 OPEN "0" »2 "NEW/DAT" 30 IF EOF(l) = -1 THEN 70 40 INPUT *1 A* 50 WRITE «2i A* G0 GOTO 30 70 CLOSE «1: CLS 80 PRINT "INPUT ANIMALS YOU WANT TO ADD" 90 PRINT "PRESS WHEN FINISHED" 100 INPUT A* 110 IF A* = "" THEN 140 120 WRITE «2, A$ 130 GOTO 80 140 CLOSE *2 150 KILL "ANIMALS/DAT" 160 RENAME "NEW/DAT" TO "ANIMALS/DAT" "" = 110 WRITE *1 100 CLOSE *1 10 :OSUB 430 100 IF N$ 410 420 430 . : 440 450 460 470 480 i i 1 PROGRAMMING EXERCISE #6.3 PROGRAMMING EXERCISE 7.1 10 PRINT "DO YOU WISH TO -PRINT "(1) STORE A NEW FILE" PRINT "(2) SEE THE FILE" PRINT " (3) END" INPUT 01 ON 01 GOTO 80. 130, 420 GOTO 10 OPEN "0". tli "MEMBERS/DAT" 10 CLS: 20 30 40 50 60 70 80 64 OPEN "D" 20 WRITE «1 30 PUT *1 31 , WRITE *1 , , , 3 34 GET «1 , 3 38 PRINT A$ 40 CLOSE *1 "NAMES/DAT "J. DOE" 2 32 PUT *1 36 INPUT *1 «1. . "BILL SMITH" A$ .APPENDIX A PROGRAMMING EXERCISE 7.2 FD — Bad This produces an 36. 36 The first field INPUTs it File Data — error in line in record 2 is "FLIES," a string. Line into N, a numeric variable. PROGRAMMING EXERCISE 7.3 10 OPEN "D" , «1 1 TO "NAMES/DAT" , 20 GOTO 70 30 FOR X = 160 LSET ZIP* Z* = 170 PUT #1 ,R 180 PRINT 190 INPUT "MORE DATA( Y/N) 200 IF AN* = "Y" THEN 30 210 CLOSE *1 " X 10 OPEN 50 GOSUB 180 "D"i «1. 20 FIELD *1. G0 NEXT X RECORDd-10)" 80 IF X > 10 THEN 80 IF X < 1 100 GET #1 i AN* "MAIL/DAT". 57 15 AS LAST*, ADDRESS*. 10 AS CITY*. 70 INPUT "WHICH i PROGRAMMING EXERCISE #9.2 10 PRINT "RECORD" 40 PRINT: 140 LSET CITY* = C* 150 LSET STATE* = S* X 170 30 R = R + 10 AS FIRST*: 2 , 15 AS AS STATE*, 5 AS ZIP* 1 40 CLS THEN END 50 GET *1 X 60 PRINT LAST* " ," FIRST* 70 PRINT ADDRESS* 110 INPUT *li N*. A*. C»i S$i Z$ PRINT "RECORD" X 130 PRINT N*, ,A*,.C*,,S*,,Z* 140 INPUT "DO YOU WANT TO CHANGE THIS"! R* 150 IF R* = "YES" THEN GOSUB 180 1B0 GOTO 70 170 CLOSE «1: END 180 INPUT "NAME" N* 190 INPUT "ADDRESS "i A$ 200 INPUT 'CITY :"i C$ 210 INPUT 'STATE: '! S* 220 INPUT 'ZIP :"i Z* 230 WRITE »1 N*. A*. C$i S*: 1$ 120 PRINT: i , R 80 PRINT CITY* 90 PRINT ZIP* " ." STATE* 100 PRINT 110 IF LOF(l)=R THEN 140 120 INPUT "PRESS FOR NEXT NAME"'!E* 130 GOTO 30 140 CLOSE #1 PROGRAMMING EXERCISE #9.3 1 240 PUT «1 X , 250 RETURN PROGRAMMING EXERCISE #9.1 10 OPEN "D" ,81 , "MAIL/DAT" ,57 20 FIELD 81,15 AS LAST*. 10 AS FIRST*, 15 AS ADDRESS* .10 AS CITY* 30 R = R + ,2 1 40 CLS LAST NAME'SL* FIRST NAME" iF* 70 INPUT ADDRESS" !A* 80 INPUT CITY" iC* 90 INPUT STATE" iS* 100 INPUT "ZIP CODE"iZ* 110 LSET LAST* L* 120 LSET FIRST* F* 130 LSET ADDRESS* A* AS STATE* .5 AS ZIP* 10 OPEN 'D" ,#1 ."POP" .15 20 FIELD *1 ,10 AS COUNTRY* 30 R = R + 1 ' ,5 AS POP* 40 CLS 50 INPUT "COUNTRY" !C* 60 INPUT "POPULATION" !P 70 LSET COUNTRY* = C* 80 LSET POP* = MKN*(P) 85 PUT *1 ,R 90 PRINT 100 INPUT "MORE DATA(Y/N)' iAN* 110 IF AN* = "Y" THEN 30 120 CLOSE *1 50 INPUT G0 INPUT PROGRAMMING EXERCISE #9.4 10 OPEN 20 30 40 50 60 70 "POP" "D" , #1 FIELD «1 . 10 AS COUNTRY*, R = R + , , 15 5 AS POP* 1 GET 81 R PRINT COUNTRY*, CON (POP*) IF LOFUJOR THEN 30 CLOSE 81 , 65 APPENDIX B. CHAPTER CHECKPOINT ANSWERS CHAPTER 4 CHAPTER 2 no way A file can be renamed with the RENAME command. For example, RENAME "OLDFILE/NAM" TO "NEWFILE/NAM" renames OLDFILE/NAM to 1. Unless the disk has been formatted, there to locate any given area on the disk. 2. The disk directory NEWFILE/NAM. You must specify the extension for tions, both filenames so the Computer can find them. 3. A is is an index of the names, locaand types of all the files on the disk. disk file is an individual block of information 2. stored on the disk, under a filename. 4. 1. Information stored in memory find out how much ing on the disk by typing PRINT FREE Computer ) (ENTER) . This disk. 3. Unless otherwise specified, the Computer always uses Drive 0. This can be changed by typing DRIVE 1, which enables you to access Drive 1 without having to specify the number in your command, (i.e., now DIR and DIR1 would both get you the directory of the disk in Drive 1. The only way to change the contents of a disk file is by storing different information under the same filename. CHAPTER 5 1. CHAPTER 3 1. ( you the number of granules left on the disk in Drive 0. If you are running out of granules, you might want to KILL a few files or switch to another is turned OFF or if you execute a NEW, LOAD, DISKINI, BACKUP, or COPY command. (We'll discuss BACKUP and COPY in the next chapters). Information stored on disk will be there permanently. It won't be destroyed if the Computer's turned off or if memory is cleared. (Don't leave a disk in the drive when you turn the Computer off. We'll explain why in the next chapter.) 5. space you have remain- will tell will only be there temporarily. It will be destroyed if the You can #1 tion going Turning the Computer in its drive Buffer ON or may damage the OFF while the disk is a temporary storage area for informabetween the disk and memory. is disk. 2. A disk file must be OPENed before any information can go between the disk and memory. Only 2. felt tip pens may be used to write on the disk's Hard point pens and pencils disk and garble the information on label. 3. may damage the 3. it. end up where it's supposed to and can be reopened. All files must be closed before you switch disks. in the buffer will so that the Error messages tell you that something is wrong with either the program you are running or the last command that you used. 4. 4. "Write-protecting" is a way file OPENed A file for input allows information to go file OPENed into the CHAPTER 6 and type BACKUP0 (ENTER) The Computer will ask you to insert the destination disk and press (ENTER) This procedure is repeated until the Com- 1. memory of the Computer. for output allows information to go from memory to the disk On a one-drive system, insert the source disk into the drive file. . . OK. On a multi-drive system, type the specifying the drive number with the source disk and the destination disk. For puter prints BACKUP command example, (in Drive 66 A file from the disk of protecting your disks from alteration. It is done by putting a gummed label over the write-protect notch. You can read from a "write-protected" disk, but you can't write to it. 5. A disk must be CLOSEd so that the information still BACKUP TO 0) backs up the source disk to the destination disk (in Drive 1). 1 2. OPEN a "sequential access" file, you can only OPEN it for "I" or "O"— not both. You can't outWhen you nor can you input from a put to a file opened for file opened for "O." "I," No. The be closed and then reopened file for input. must first .APPENDIX B CHAPTER 7 1. Records are equal-sized divisions in your disk file where you can put your data. Since each is the same size, the Computer can use them to access your data 5. A comma 6. A 7. A string is printed simply as the string itself. It is not causes the Computer to space over to the next print column before printing another data item. semicolon causes the Computer to print the data items immediately next to each other. directly. 2. Fields are subdivisions of records. 3. In a sequential access file, the only locations the Computer knows are the beginning and ending of the file. In a direct access each individual record 4. is file, it enclosed in quotation marks. (by the size of the records). Since each record of the file has a known location, the Computer can access it without going through the preceding parts of the file, as it would if the file was sequential. The minimum 2. The Computer will 2. The data must have a it file to be LSET set the record length at field This length 256 bytes. with a is specific length for assigned in the FIELD line. MKN$ converts a number into a 5-byte coded string. CHAPTER 10 size of a disk file is 2,304 bytes (one granule). Since the granules, a 1. 3. CHAPTER 8 1. CHAPTER 9 can determine where Computer 1. allocates disk space in can be no smaller than one granule. The Computer first WRITEs the number's sign (a minus sign if it's negative or a blank space if it's positive). Then it WRITEs the number itself. Immediately following the number, it WRITEs on 2. You must type an A at the end of your SAVE command if you plan to ever MERGE it with a program in memory. The line number of the program saved on disk prevails. 3. trailing The Computer reserves two buffers when you powerup. blank space. 3. 4. 4. The Computer reserves a total space when you power-up. 5. FILES A string is written with quotation marks around it. INPUT inputs only the data items listed, while LINE INPUT inputs everything up to the (ENTER) character. of 256 bytes of buffer 3, 3000 get the Computer to reserve 3 buffers with a total of 3000 bytes of buffer space. 67 " . APPENDIX " . ) C. SAMPLE PROGRAMS SAMPLE PROGRAM #1 BALANCING YOUR CHECKBOOK This program creates a master disk file which contains all your checks and deposits for the entire year. You can print them out by the month or the year. If you want to use your printer, change the appropriate PRINT lines to PRINT #-2. (See Chapter 21 in Getting Started with Color BASIC). 10 ' 20 30 ' Checkbook Program This program provides a ' record of yo u r c heck s ? 40 deposits? and balances. The checks can be labeled 50 with an account number to show to what expense 60 they were paid* such as medical rent food? etc 70 The program uses direct addressing? each file record 80 being 40 bytes long? and formatted as follows! 8 90 bytes for the date? 4 bytes for the check or deposit 100 slip number? 20 bytes for the recipient of the check 110 3 bytes for the account number? and 5 bytes for the 120 amount of the check or deposi t 130 140 CLEAR 1000 150 DIM CHK*<50) 160 CLS 170 PRINT 3 107? "SELECTIONS:" 180 PRINT a 162? "1) ADD CHECKS TO YOUR FILE" 190 PRINT a 194? "2) LIST YOUR CHECKS? DEPOSITS? 200 PRINT a 229? "AND BALANCES" 230 PRINT 3 322? "3) END JOB?" 240 PRINT a 394? "(1?2? OR 3>" 250 AN*= INKEY* 260 IF AN*="" THEN 250 270 ON VAL(AN*) GOSUB 310? 700? 1080? 1560 280 GOTO 160 290 300 31 This s u b r o u t i n e inputs ' ' ' ? ' ' ' ' 7 ' ' ' ' ' the data. 320 68 ' ? 330 OPEN "D" #1 " CHECKS/DAT" 40 340 FIELD #1?8 AS DATE*? 4 AS CHNO*? 20 AS PDTO*? 3 AS ACNO*? 5 AS AMT* 350 REC = L0F<1) 360 REC = REC + 1 370 CLS 380 PRINT a 64? "CHECK OR DEPOSIT (C/D)" 390 AN* = INKEY* 400 IF AN* = "D" THEN 430 410 IF AN* = "C" THEN 490 420 GOTO 390 430 INPUT "DEPOSIT DATE (MM/DD/YY)";D* 440 INPUT "DEPOSIT SLIP NUMBER NNNN " C* 450 P* = " 460 INPUT "ACCOUNT NUMBER* NNN) "? A* 470 INPUT "AMOUNT OF DEPOSIT" AMT 480 GOTO 550 490 INPUT "CHECK DATE (MM/DD/YY) " ;D* 500 INPUT "CHECK NUMBER NNNN >"? C* 510 INPUT "PAID TO" P* 520 INPUT "ACCOUNT NUMBER NNN) " A* 530 INPUT "AMOUNT OF CHECK"; AMT 540 AMT = -AMT 550 LSET DATE* = D* 560 LSET CHNO* = C* 570 LSET PDTO* = P* 580 LSET ACNO* = A* 590 LSET AMT* = MKN* AMT 600 PUT #1?REC 61.0 PRINT 3 320? "MORE INPUT(Y/N)" 620 AN* = INKEY* 630 IF AN* = "N" THEN 660 640 IF AN* = "Y" THEN 360 650 GOTO 620 660 CLOSE #1 670 RETURN 680 690 700 This subroutine balances the checkbook and outputs the results. 710 720 OPEN " D" #1 " CHECKS/DAT" 40 730 FIELD #1,8 AS DATE*? 4 AS CHNO*? 20 AS PDTO*? 3 AS ACNO*? 5 AS AMT* 740 CLS 750 PRINT 3 160? "DO YOU WANT A LISTING FOR A MONTH OR FOR THE" 760 PRINT 3 192? "WHOLE YEAR? (Y/M)" 770 INPUT A* 780 IF A* = "M" THEN PRINT 3 254? ? ? ? ) ; < 5 < ? ; < ( ' ' ' ' ? ? ? 1 I ) -APPENDIX C "WHAT MONTH(MM)" INPUT MN* 790 BAL = 800 FOR REC = 1 TO LOF 810 GET #1,REC 820 BAL = BAL + CVN(AMT*) 830 IF A* = "M" AND LEFT*< DATE** 2) <> MN* THEN 1030 840 CLS 850 IF PDTO* = " THEN 930 860 PRINT a 645 "DATE OF CHECK:": PRINT a 84, DATE* 870 PRINT "CHECK NUMBER: ": PRINT 3 116,CHN0* 880 PRINT "PAID TO:" ."PRINT a 148, PDTO* 890 PRINT a 160> "ACCOUNT NUMBER:": PRINT 3 180,ACNO* 900 PRINT "AMOUNT OF CHECK: ": PRINT 3 211, USING "**###.##" ;-CVN 910 PRINT "BALANCE:" PRINT a 243, USING "**###„##"*; BAL 920 GOTO 980 930 PRINT:PRINT:PRINT "DATE OF DEPOSIT:" SPRINT 3 85, DATE* 940 PRINT "DEPOSIT SLIP NUMBER:": PRINT 3 117,CHN0* 950 PRINT "ACCOUNT NUMBER: ": PRINT 3 149,ACN0* 960 PRINT "AMOUNT OF DEPOSIT:": PRINT a 180, USING "**###.##"; CVN 970 PRINT "BALANCE:" PRINT a 2 1 2 US I NG " **### .##''; BAL 980 PRINT a 256, "PRESS FOR NEXT RECORD OR TO RETURN TO 'SELECTIONS'" 990 AN* = INKEY* 1000 IF AN* = CHR*(13) THEN 1030 1010 IF AN* = "R" THEN 1040 1020 GOTO 990 1030 NEXT REC 1040 CLOSE #1 1050 RETURN 1540 1550 1560 This subroutine terminates the pro gram. Program #1" and sorts : ( : , ' ' ' ' 1580 END SAMPLE PROGRAM #2 SORTING YOUR CHECKS. This subroutine will be especially helpful at tax time. It takes the checks file which you created in "Sample know (or ) : 15 70 to exactly all the checks by account. Want how much you spent on medical bills business expenses, contributions, etc.)? This prowill let you know right away. gram 210 PRINT a 258, "3) SORT YOUR CHECKS BY" 220 PRINT 3 293, "ACCOUNT NUMBER?" 230 PRINT a 322, "4) END JOB?" 240 PRINT 3 394, "(1,2, 3, OR 4)" 270 ON VAL(AN*> GOSUB 310,700. 1080, 1560 1060 1070 1080 This subroutine sorts the checks from those with the 1090 smallest account numbers to the largest account numbers 1100 using a "bubble sort". Each check is handled as one 1110 data string to make the swaps easier. 1120 1130 OPEN "D",#l, "CHECKS/DAT", 40 1140 FIELD #1,40 AS INFO* 1150 FOR TO LOF(l) 1160 GET #1, 1170 CHK*(I) = INFO* 1180 NEXT I 1190 CNT = 1200 FOR I = 1 TO LOFU) - 1 1210 IF MID*(CHK*(I),33,3> <= MID* THEN 1260 1220 TEMP* = CHK*(I) 1230 CHK* "ALL" AND AN* <> MID*(CHK*,33,3) THEN 1510 1330 CLS 1340 PRINT 3 66, "ACCOUNT NUMBER:" :PRINT a 85,MID*(CHK*(I),33,3> 1350 IF MID*(CHK*(I ), 13,20) = " THEN 1410 1360 PRINT a 98, "DATE OF CHECK:": PRINT a 117,LEFT* . C. PRINT a 181, MID* , 13,20) 1390 PRINT 3 194 "AMOUNT OF CHECK: PRINT a 212, USING "**###.##"; -CVN ,5) 1400 GOTO 1440 1410 PRINT a 98? "DATE OF DEPOSIT:" PRINT a 117,LEFT* ,8) 1420 PRINT 3 130, "DEPOSIT NUMBER:" PRINT a 149,MID* 1430 PRINT 3 162* "AMOUNT OF DEPOSIT: " PRINT 3 1 80 USING "**###. ##" CVN ,5> 1440 PRINT 3290, "(PRESS < ENTER TO SEE NEXT" 1450 PRINT 3322? "RECORD OR TO RETURN TO" 1460 PRINT 3 354, "'SELECTIONS' )" 1470 A2* = INKEY* 1480 IF A2* = CHR*<13> THEN 1510 1490 IF A2* = "R" THEN 1520 1500 GOTO 1470 1510 NEXT I 1520 CLOSE #1 1530 RETURN i 120 130 140 150 160 170 180 190 to program #4) ' 7 CLEAR 1050 DIM ARRAY*<30) OPEN "D",#l, "NAMES/NOS", 35 FIELD #1,35 AS INFO* •} ' 2:.ee First the file is checked if there are any records currently on it. 200 210 THEN 1=1: GO TO 310 220 IF L0F(1) = 1=1 TO LOF(l) 230 FOR 240 GET #1,1 250 ARRAY* U) = INFO* 260 NEXT I 270 The new names and numbers 280 are input and then concatenated into 1 stringi ARRAY* (I) 290 300 310 CLS 320 PRINT a 64 330 INPUT "LAST NAME"?L* 340 INPUT "FIRST NAME" F* 350 INPUT "MIDDLE INITIAL" M* 360 INPUT "AREA CODE" A* 370 INPUT "PHONE NUMBER" P* 380 ARRAY*(I) = LEFT* ?" Want to store the names and telephone numbers of all 400 AN* = INKEY* your club members? This program puts them all in a 410 IF AN* = "Y" THEN 1=1+1 disk file in alphabetical order. Add a few lines to it, and GOTO 310 it will store their addresses and phone numbers also. 420 IF AN* = "N" THEN 470 430 GOTO 400 10 Create list and alphabetize. 440 20 Then, ARRAY*(I) is put into 450 30 The object of this program al ptiabetical order. is to create a file of 460 alphabetically arranged names 40 470 FOR J=l TO I The and phone numbers. 480 FOR K=J TO I 50 names and numbers are first ARRAY* (K) 490 IF ARRAY* (J) input into an array, ARRAY* I THEN 530 60 then put into alphabetical 500 TEMP* = ARRAY* J) order, and finally put into 510 ARRAY*(J) = ARRAY*(K) 70 a disk file called "NAMES/NOS". 520 ARRAY* = TEMP* The file is 35 bytes 530 NEXT K 80 lor.9, all of it allotted to 540 NEXT J The 55 one variab e, INFO*. t rans560 Fi nal y the list 90 file can be added to anytime f e r r e d into "NAMES/NOS". a f t e r i t s c r e a t i o n a n d will 570 100 automatically be alphabetised. 580 FOR N=l TO The program can be used ARRAY* (N) 110 in conjunction with the "Search 590 L.SET INFO* t 600 PUT #1,N a i s p r o g r a m (sampl " ' t , ) t ' •J 5 ; 5 ? , : •> ' ' ' ' ' ' ' ( ) ' < ' ' 1 ' ' ' 1 ' ' ' 1 70 , d " .APPENDIX C 610 NEXT N 620 CLOSE #1 630 END 320 IF NAME* = NM* THEN 450 330 340 Program keeps comparing NM* with NAME* from record MID 350 until NM* is found or enough records have been seen 360 to show that it isn't in the file 370 380 GET #1,MID 390 IF CNT > (L0F(l)+l)/2 THEN 710 400 IF NAME* < NM* THEN 570 410 IF NAME* > NM* THEN 640 420 430 When NM* is found it is printed out 440 450 CLS 460 PRINT 3 104, NAME* 470 PRINT a 136, " (" AREA* 5" )" PHONE* 480 PRINT 3 195, "PRESS TO CONTINUE, 490 PRINT 3 227, "ELSE PRESS TO QUIT" 500 AN* = INKEY* 510 IF AN* = "Q" THEN CLOSE: END 520 IF AN* = CHR*(13) THEN 140 530 GOTO 500 540 550 Subprogram for when NAME*< 24 THEN 800 220 IF LEN(NM*) > 24 THEN 820 230 FIRST = 1 240 MID - INT( (L0F(l)+l)/2) 250 LAST = LOF(l) 260 CNT = 270 280 Program checks the last record first because it won't 290 be checked in the regularsearch 300 310 GET #1,LAST 10 ' 1 ' ' — — ' ' ' ' ' ' ' ' ' ' * ' ' ' ' ' ' ' ' ' ? ; ' ' ' 6.1.0 ' 620 630 640 650 660 670 680 690 LAST = MID MID = NM* ' ' ' Subprogram for when NM* is 700 710 CLS 720 PRINT 3 100, Nl*;" NOT FOUND" 730 PRINT 3 132, "TO TRY AGAIN PRESS " 740 AN* = INKEY* 750 IF AN* = " " THEN 740 760 GOTO 140 770 780 Subprograms for modifving NM* to a 20 bvte string ' ' ' 71 I ) APPENDIX C. 790 800 810 820 830 ' NM* = NM*+" " GOTO 210 NM* = LEFT* (NM*, 24) GOTO 220 SAMPLE PROGRAM #5 UPDATE THE LIST Update anything you want in the file you created in "Sample Program #3." You can do it in a hurry with this program. 300 IF AN* = "N" THEN 560 310 GOTO 280 320 PRINT 3 260, "EDIT NAME? (Y/N)" 330 AN*= INKEY* 340 IF AN* = "N" THEN NM* = NAME*: GOTO 400 350 IF AN* = "Y" THEN 370 360 GOTO 330 370 LINE INPUT " NEW NAME" ;NM* 380 IF LEN(NM*) < 24 THEN NM* = NM*+ GOTO 380 ELSE 390 390 IF LEN(NM*> > 24 THEN NM* = LEFT* (NM*, 24) 400 PRINT 3 292, "EDIT AREA CODE? (Y/N)" 410 AN* = INKEY* 420 IF AN* = "Y" THEN 450 430 IF AN* = "N" THEN A* = AREA* GO TO 460 440 GOTO 410 450 INPUT " NEW AREA CODE"; A* 460 PRINT 3 324, "EDIT PHONE NUMBER? (Y/N)" 470 AN* = INKEY* 480 IF AN* = "Y" THEN 510 490 IF AN* = "N" THEN P* = PHONE* GOTO 520 500 GO TO 470 510 INPUT," NEW PHONE NUMBER" P* 520 LSET NAME* = NM* 530 LSET AREA* = A* 540 LSET PHONE* = P* 550 PUT #1,1 560 NEXT I 570 CLOSE #1 580 RETURN 590 OPEN "D",#l, "NAMES. NOS", 35 600 FIELD #1,24 AS NAME*, 3 AS AREA*, 8 AS PHONE* 610 OPEN "D" ,#2, "TEMP/FIL",35 620 FIELD #2,24 AS TNAME*,3 AS TARE A*, 8 AS T PHONE* 630 FOR 1=1 TO LOF( 1 640 GET #1,1 650 CLS 6/.0 PRINT 3 68, "RECORD #";I 670 PRINT a 100, "NAME: " 5NAMF* 600 PRINT 3 132, "AREA CODE:"; AREA* 690 PRINT a 164, "PHONE NUMBER:"; PHONE* 700 PRINT 3 228, "DELETE THIS RECORD? (Y/N)" 710 AN* = INKEY* 720 IF AN* = "Y" THEN 800 730 IF AN* = "N" THEN 750 740 GOTO 710 : 10 20 30 ' Edit your names file ' The object of this program edit the "NAMES/NOS" file 40 from "Create list and alphabetize" (Sample program #3). The 50 program can either retain a record v change one of the variables 60 in that record? or delete the record entirely from the file. 70 80 CLS 90 PRINT 3 106, "SELECTIONS:" 100 PRINT 3 I685 " 1) EDIT RECORD" 110 PRINT a 200, "2) DELETE RECORD" 120 PRINT 3 232, "3) END JOB" 130 PRINT 3 298, "1,2, OR 3" 140 AN* = INKEY* 150 IF AN*="" THEN 140 160 ON VAL(AN*) GOSUB 180,590,850 170 GOTO 80 1 80 OPEN " D " # 1 " NAMES NOS " 35 190 FIELD #1,24 AS NAME*, 3 AS AREA*, 8 AS PHONE* 200 FOR 1=1 TO LOF(l) 210 GET #1, 220 CLS 230 PRINT 3 68, "RECORD NUMBER:" ;I 240 PRINT a 100, "NAME:" ;NAME* 250 PRINT a 132, "AREA CODE:"; AREA* 260 PRINT 3 164, "PHONE NUMBER"; PHONE* 270 PRINT 3 228, "EDIT THIS RECORD? (Y/N)" 280 AN* = INKEY* 290 IF AN* ~ "Y" THEN 320 ' is to ' ' ' ' , , 72 . , : ; • .APPENDIX C 750 760 770 780 790 800 810 820 830 840 850 LSET TNAME* = NAME* LSET TAREA* = AREA* LSET TPHONE* = PHONE* J=J+1 PUT #2, J NEXT I CLOSE KILL "NAMES/NOS" RENAME "TEMP/FIL" TO "NAMES/NOS" RETURN END SAMPLE PROGRAM #6 GRADING TESTS This program is ideal for teachers. It creates several files of students and their test score. You can then immediately find averages and standard deviation for the entire class or for each individual student. disk 10 ' 20 30 ' Test pros ram 290 OPEN "0",#1,"NAME/FIL" 300 CLS 310 PRINT a 96, "ENTER NAME OF STUDENT 320 LINE INPUT NAME* 330 WRITE #1,NAME* 340 PRINT 3 196, "(PRESS TO ENTER" :PRINT 3 228, "ANOTHER NAME, PRESS <0>": PRINT a 260, "TO QUIT)" 350 AN*=INKEY* 360 IF AN*="" THEN 350 370 IF AN*O"0" THEN 300 380 CLOSE #1 390 RETURN 400 410 ' This subroutine builds test : ' files. 420 ' 430 CLS 440 PRINT 3 64 450 INPUT "NUMBER OF NEW TEST FILE";TF* 460 IF TF* = " THEN 450 470 TF* = "TEST" + TF* 480 OPEN "I",#1,"NAME/FIL" 490 OPEN "0",#2,TF* 500 IF EOF(l) THEN 560 510 INPUT #1,NAME* 520 PRINT "NAME:"?NAME* The object of this, program input several 40 files a names file and several test files. 50 The files can then he accessed as desired and the 60 test scores processed to find averages and standard 70 deviations. The files are all 530 INPUT "SCORE" ; SCORE sequential access files. 540 WRITE #2, SCORE 80 550 GOTO 500 90 560 CLOSE #1,#2 100 ' Main module of program 570 RETURN 110 580 120 DIM NAME* 30), GRADE <6, 30) 590 ' This subroutine inputs the 130 CLS "NAMES" file and the 140 PRINT a 107," SELECT IONS" 600 ' desired test files and then 160 PRINT a 164, M 1) CREATE A processes them either 'NAMES' FILE" 610 on a class basis or an 170 PRINT a 196, H 2) ADD A NEW individual basis, and TEST FILE" 620 then prints out the results. 180 PRINT a 228, "3) PROCESS SCORES" 630 » 190 PRINT a 260, H 4) END" 640 OPEN "I",#1,"NAME/FIL" 210 PRINT a 331, "1,2,3 OR 4" 650 IF EOF(l) = -1 THEN 690 220 AN*=INKEY* 660 Y = Y + 1 230 IF AN*="" THEN 220 670 INPUT #1,NAME*(Y) 240 ON VAL NAME*(Y) 930 PRINT a 1 37 "SCORES:" 940 STUTOT = 950 FOR X=l TO N 960 PRINT TAB(10) GRADE 970 STUTOT = STUTOT + GRADE(X»Y) 980 NEXT X 990 AVE(Y) = STUTOT / N 1000 NUM = 1010 FOR X=l TO N 1020 NUM = +2 + NUM 1030 NEXT X 1040 SD = SOR(NUM / N) 1050 PRINT USING ""/. /.##.##"; "AVERAGE: "?AVE(Y) 1060 PRINT USING "V. ##.##";» STANDARD DE V I AT I ON " SD 1070 PRINT "PRESS TO SEE NEXT NAME" 1080 AN* = INKEY* 1090 IF AN* = CHR*<13) THEN 1100 ELSE 1080 1100 NEXT Y 1110 CLS 1120 PRINT 3 105? "NO MORE NAMES" 1130 GOTO 1350 1140 1150 This portion processes the scores bv the test number 1160 for the whole class. 1170 1180 INPUT " WHICH TEST NUMBER" ?X 1190 CLS 1200 PRINT 3 4»"DATA FOR TEST NUMBER " 1210 PRINT » NAME" STAB 25) "SCORE" 1220 TTOT = 1230 FOR Y=l TO YEND 1240 TTOT = TTOT + GRADED Y> 1250 PRINT TABU) NAME*( Y) ;TAB<25) GRADE(X»Y> 1260 NEXT Y 1270 AVE TTOT / YEND 1280 NUM = 1290 FOR Y=l TO YEND 1300 NUM = NUM + (AVE - GRADE X,Y) 1310 NEXT Y 1320 SD = SQR(NUM / (YEND - 1)) 1330 PRINT: PRINT USING ; < < ' ""/ ' ; » : ; ' ' ' 74 : ' ' < ' '/. SAMPLE PROGRAM #7 CREATE-A-GAME — a house These four programs will display 3 scenes and two rooms. Each scene is stored on disk as a pro- gram file. 10 ' 20 30 ' "DISPLAY/BAS" The ob-Ject of this program show you how you can 40 access another program from It uses Your main program. 50 a main program called "DISPLAY/BAS" and three graphics 6(3 p r o g ram s c a 1 e d " HOUSE / B AS " "FOYER/BAS'S and "STAIRS/BAS" (Natural 1y thev must be on 70 ' is to ' ' ' » 1 ' d i H2 •/.#•/.•/.##.##"? "AVERAGE FOR TEST #" ;X " " ?AVE 1340 PRINT USING "7. ##.##"; "STANDARD DEVIATION: "!SD 1350 PRINT: PRINT " PRESS FOR MORE" 1360 PRINT " PROCESSING* TO QUIT" 1370 AN* = INKEY* 1380 IF AN* = CHR*(13) THEN 820 1390 IF AN* = "Q" THEN 1400 ELSE 1370 1400 RETURN 1410 1420 This subroutine terminates the program. 1430 1440 END ' ' . sk bef ore you can i- un th i s "/. 4 ) , 4 4444 444 11 " " " 1 -APPENDIX C 80 program. 90 100 110 CLS 120 PRINT 106? "SELECTIONS:" 130 PRINT 170, "1) HOUSE" 140 PRINT 202, "2) FOYER" 150 PRINT "3) STAIRS" 234 160 PRINT 266, "4) END JOB" 170 PRINT 330, "1,2,3, OR 4" = 180 AN* INKEY* 190 IF AN* = THEN 180 200 IF AN* = u ^i THEN 250 210 CLS 220 PRINT 3 98, 'TO RETURN FROM THIS SELECTION 230 PRINT 3 130, "PRESS ANY KEY" 240 FOR 1=1 TO 40: NEXT I 250 ON VAL (AN*) GOTO 260,270,280,290 260 LOAD " HOUSE /B AS ",R 270 LOAD "FOYER/BAS",R 280 LOAD "STAIRS/BAS" ,R 290 END ' 40 PMODE 3, 50 SCREEN 1,0 60 DRAW "BM104,60;D92;R48;U92;L48" 70 DRAW "BM44,20;R16B;D132;L132; BL4 ;L12?BL4?L16;BM44, 102;U82" 80 DRAW "BM220,60;D100; BM2 44,58?D126" 90 DRAW " BM42 ,102; D38 R8 ; U38 L8 100 DRAW "BM16, 148;D40;R4;U40" 110 DRAW "BM64, 14B;D40;L4;U40" 120 DRAW " BM80 ,124; D40 L4 U36 130 CIRCLE (144, 108), 140 CIRCLE (238, 117), 150 CIRCLE (45, 140), 15,4, .3,0, .7 160 CIRCLE (45,140), 15,4, .3, .95, 170 CIRCLE (53, 136), 180 LINE (0, 192) -< 16, 176), PSET 190 LINE (20, 172)-(44, 152), PSET 200 LINE (256, 192)-(212, 152), PSET 210 PAINT (28, 8), 3, 220 LINE (0,0) -(44, 20), PSET 230 LINE 256, - 212, 20 PSET 240 LINE (220,60)-(244,59) PSET 250 LINE 16, 148>-(44, 124) PSET 260 LINE (16, 148)-(64, 148) PSET 270 LINE (64, 148)-(80, 124) PSET 280 LINE (80, 124)-(52, 124) PSET 290 PAINT (10, 10), 3, 300 PAINT (60, 32), 3, 310 PAINT (240, 20), 3, 320 PAINT1 28 64 2 330 PAINT (228, 70), 2, 340 PAINT (62, 156) ,4,4 350 PAINT (78, 150), 4, 360 PAINT 18, 156), 4, 370 PAINT (68, 128), 1,4 380 PAINT (128, 156), 2, 390 PAINT (40, 140), 4, 400 PAINT (48, 120), 2, 410 CIRCLE (46, 98), 5, 2,; 420 AN* = INKEY* 430 I F AN* = " " THEN 420 440 LOAD "DISPLAY/BAS'SR ; ? ; ) ( ( ? ) , ( 10 " HOUSE /B AS" 30 PMODE 3, 1 40 PCLS 50 SCREEN 1,0 60 DRAW " BM66 1 08 D48 ; R32 U48 L32 70 DRAW "BM66,68;R132;BM46,96;R132; BM50, 156;R128" 80 DRAW "BM50,96;D60;BM178,96?D60; " 5 ; , BM206,88;D50" ; < ' "FOYER/BAS" 20 30 PCLS ' , ) , , ( 90 DRAW "BM0, 136 R50; BM206, 136;R50" 100 LINE (46,96)-(66,68>,PSET 110 LINE 178, 96>-< 198,68) PSET 120 LINE (198, 68) -(206, 88), PSET 130 LINE (174, 156)~<206, 136), PSET 140 CIRCLE (92, 130), 5,0 150 PAINT (0,0), 3, 160 PAINT (0, 149), 1,4 170 PAINT (67,70) ,4,4 180 PAINT (55, 105), 2* 190 PAINT (194, 96), 2, 200 PAINT (82, 128) ,3,4 210 AN* = INKEY* 220 IF AN* = "" THEN 210 230 LOAD "DISPLAY/BAS'SR 10 ( , 10 "STAIRS/BAS" 20 30 40 50 60 PCLS PMODE 3, SCREEN 1,0 DRAW "BM60,20;R140;D120;L40?U32; L4;D52;R4;U20;BM160, 160-L128;U150" 70 DRAW "BM4,62;D130;BM28, 166?U102; BM144, 148; R12" 80 DRAW "BM40,72;D24;R36;U24;L36; 75 4 44 4 5 1 " I 5 ) APPENDIX CBM44,76;D16;R2S;U16;L28" ' LINE <0,0)-(60,20),PSET 120 LINE <200,20)-<255,0>,PSET 130 LINE (200, 140) -(255? 192), PSET 140 LINE (0, 192>-(32, 160),PSET 150 LINE <4,62>-<28,64),PSET 160 PAINT (120,4), 2, 170 PAINT (20, 20), 2, 180 PAINT (230, 20), 2, 190 PAINT (120, 40), 2, 200 PAINT (60, 16), 3, 210 PAINT (20, 64), 3, 220 PAINT (158, 124) ,4,4 230 PAINT (42, 74), 4, 240 LINE (28,8)-( 144, 148), PSFT 250 LINE (64, 12) --(156, 122),PSET 260 LINE (68, 12)-(156, 116),PSET 270 DRAW "BM144, 148;U38" 280 FOR 1=0 TO 9 290 DRAW "BM~8,28?U38" 300 NEXT I 310 DRAW "BM56,40;U28?BM48,31 111 8 BM40,22"U10" 320 PAINT (56, 84), 2, 330 CIRCLE(56,86),10,3, .4,0, .5 340 LINE (51,86)-(63,86) PSET 350 DRAW "BM56,84;L4;E7?D8" 360 FOR 1=1 TO 32 370 CIRCLE (120, 176), 1*2, 1/4, .25 380 NEXT I 382 DRAW " BM232 1 76 U 1 00 R2 D 1 00 383 CIRCLE 232, 180) 15 4, 1 5, 384 CIRCLE (232, 178) 6, 4, 2, 55 385 CIRCLE 232, 80) 15 4, 1 0, 386 CIRCLE 232, 82) 6, 4, 2, 1 55 390 AN* = INKEY* 400 IF AN* = "" THEN 390 410 LOAD "DISPLAY/BAS'SR 11.0 i ' ' 5 ( ; ' ' ' ' ' ' 5 ; , , , , ( , ( , . . , , , . . . , , ' , , 50 of transactions, and the third, a listing of the updated 60 budget. The program allows for carryover from the previous 70 period's budget. A Journal can be printed out giving a list of the budget expenses, and 80 balances. (NOTE: As written, this program requires a printer 90 for outputting the Journal. 100 However, with slight modification, it could be used without 110 a printer. 120 130 140 Main module of program 150 160 CLS 170 PRINT 3 106, "SELECTIONS:" 180 PRINT 3 165, "1) BUILD BUDGET" 190 PRINT a 197, "2) UPDATE AN ACCOUNT" 200 PRINT 3 229, "3) PRINT OUT A JOURNAL" 210 PRINT 3 261, "4) END JOB" 220 PRINT 3 329, "1,2,3, OR 4?" 230 AN*= INKEY* 240 IF AN*="" THEN 230 250 ON VAL(AN*) GOSUB 360,950, 1450, 1970 260 GOTO 160 270 280 This subroutine builds the budget file (cal led 290 BUDGET.ORG), and builds or updates the file BUDGET. UPD 300 It allows you to input the start date of the budget 310 and the total amount yolt have to divide up to accounts. 320 Tentative amounts are entered for each account and a 330 running balance is kept to advise you of the amount 340 left in Your total budget. 350 360 OPEN " D" #1 " BUDGET/ORG" 370 OPEN "D",#2, "BUDGET/UPD" ,5 380 FIELD #1,5 AS OAMT* 390 FIELD #2,5 AS UPDAMT* 400 GOSUB 1810 410 IF L0F(2) = THEN 470 420 FOR 1=1 TO 9 430 GET #2, 440 AMT(I) = CVN( UPDAMT*) ' 90 LINE (32, 12)-(92, 12),PSET 100 LINE (92, 12)~(100,20),PSET . ' ' ' ' ' ' SAMPLE PROGRAM #8 BUDGETING This organizes your finances and prints out a journal on your printer. You need a line printer with a line length of at least 80 characters to run it. 10 20 30 ' Budget program ' ' The object of this program to build three direct access 40 ' files, one a listing of a balanced budget, another, a listing is 76 ' ' ' , , , I 1 I ) ) .APPENDIX C 450 PTOT =PTOT + AMT(I) 460 NEXT I 470 CLS 480 PRINT a 130. "DATE(MM/DD/YY) :" 490 PRINT 3 162, "PROJECTED INCOME FROM:" 500 PRINT a 196, "SALARY:" 510 PRINT a 228, "OTHER:" 520 PRINT a 96 530 INPUT " DATE(MM/DD/YY> :";DATE* 540 PRINT 3 162, "PROJECTED INCOME FROM:" 550 INPUT " SALARY: " SAL 560 INPUT " OTHER:" OTHER 570 BTOT = SAL + OTHER 580 CLS 600 PRINT 3 9, "CURRENT BUDGET" 610 PRINT "ACCT# DESCRIPTION BALANCE" 620 SUMBUD = 630 FOR 1=1 TO 9 640 PRINT USING "####7. 7. 7.####. ##-" ACNO< I SPACE* DESC* (I AMT I 650 SUMBUD = SUMBUD + AMT(I) 660 NEXT I 670 PRINT 3 86, USING "*####.##-" ?AMT(1) 680 PRINT 3 419, USING "7. 7.**###.##"; "REMAINING MONEY: " BTOT - (SUMBUD ; ; "/. ; ; ) ? ) ; ( 5 - PTOT) 690 PRINT a 451, "ENTER ACCT# OF ITEM TO BE" 700 INPUT " CHANGED (000 TO QUIT)" ;AN 710 IF AN = THEN 790 720 CLS 730 N = AN / 100 740 PRINT a 105,ACNO(N) 750 PRINT 3 138,DESC*(N> 760 PRINT a 170, "*" ;AMT(N) 770 PRINT: INPUT » NE W AMOUNT" ;AMT(N) 780 GO TO 580 790 DATE = VAL( LEFT* (DATES, 2) + M:i.'D*(DATE*,4,2) + RIGHT* (DATE*, 2) 800 LSET OAMT* = MKN*(DATE) 810 PUT #1, 820 FOR 1=1 TO 9 8;<0 LSET OAMT* = MKN* AMT I 840 LSET UPDAMT* = MKN*(AMT(I)) 850 PUT #1,1+1 860 PUT #2, 8/0 NEXT I ( ( ) ) 880 CLOSE 890 RETURN 900 910 This subroutine builds a transaction file called TFILE.DAT 920 which contains anv updates to the budget, and updates the 930 file BUDGET. UPD . 940 950 OPEN "D",#l, "BUDGET/UPD-,5 960 OPEN "D",#2,"TFILE/DAT",36 970 FIELD #1,5 AS UPDAMT* 980 FIELD #2,3 AS ACN0*,8 AS DATE*, 20 AS DESC*,5 AS TAMT* 990 FOR 1=1 TO 9 ' ' ' ' ' 1000 GET #1, 1010 AMT(I) = CVN(UPDAMT*> 1020 NEXT I 1030 GOSUB 1810 1040 CLS 1050 SUMBUD = 1060 PRINT a 9, "CURRENT BUDGET" 1070 PRINT "ACCT# DESCRIPTION BALANCE" 1080 FOR 1=1 TO 9 1090 PRINT USING "####7. 7. 7.####.##-" ;ACNO(I) SPACES* DESC* I AMT I 1100 SUMBUD = SUMBUD + AMT(I) ; 11.1.0 ( NEXT ) ; ; ( I 1120 PRINT 3 86, USING "*####.##-" 5AMT(1) 1130 PRINT a 419, USING "7. **### ## " » TOTAL BALANCE " SUMBUD 1140 PRINT a 451, "ENTER ACCT# OF ITEM TO BE 1150 INPUT " UPDATED (000 TO QUIT)"; AN 1160 IF AN = THEN 1350 1170 CLS 1180 N = AN / 100 1190 PRINT a 95, AN 1200 PRINT DESC*(N) 1210 PRINT USING "7. % **###.##" ;» CURRENT BALANCE" AMT (N)" 1220 PRINT: INPUT "DATE MM/DD/YY) " ;DT* 1230 PRINT "DESCRIPTION OF '/. ; : . ; ; ( ) TRANSACTION:" 1240 INPUT DS* 1250 PRINT "AMOUNT OF TRANSACTION:" 1260 PRINT "(NEGATIVE NUMBER FOR A CREDIT)" 1270 INPUT TRANS 1280 AMT(N) = AMT(N) - TRANS 1290 LSET ACNO* = RIGHT* STR* AN) 3) ( ( , 77 ) ) APPENDIX 1300 1310 1320 1330 1340 1350 1360 1370 1380 1390 1400 1410 1420 t ? , ' ) , ( ) ? ( ) ; ( ( ; I) ) This subrout i ne prints o u listing the 1430 budget transact i cms, and balances. 1440 1450 OPEN "D",#l, "BUDGET/0RG",5 1460 FIELD #1,5 AS AMT* 1470 OPEN "D",#2, "TFILE/DAT",36 1480 FIELD #2,3 AS T ACNO*, 8 AS TDATE*,20 AS TRDESC*,5 AS TMT* 1490 GOSUB 1810 1500 CLS 1510 PRINT 3 172, "PRINTING" 1520 Get #1, I 1530 DATE* = STR*(CVN(AMT*) 1540 IF LEN(DATE*) < 6 THEN DATE* = " " + DATE* 1550 DATE* = LEFT* (DATE*, 2) + "/" + MID*(DATE*,3,2) + " / " + RIGHT* (DATE*, 2) 1560 PRINT #-2, TAB (30) "BUDGET FOR THE PERIOD" 1570 PRINT #-2, TAB (31) "STARTING " ;DATE* 1580 PRINT #-2: PRINT #-2 1590 PRINT #-2 TAB 28 " ACCOUNT OR" 1600 PRINT #-2, TAB (10) "ACCOUNT" ?TAB(27) "TRANSACTION" 1610 PRINT #-2, TAB (10) "NUMBER" TAB (14)" DATE " TAB 27 " DESCR I PT I ON TAB 47 " TRANSACTION" TAB 61 "BALANCE" 78 ; ; ) 1620 FOR 1=2 TO LOF(l) 1630 GET #1, 1640 PRINT #-2 1650 PRINT #-2,TAB(12)ACN0(I-l> TAB (17) DATE* TAB 27 DESC* I - 1 < a J our-nal ( . C. LBET DATE* = DT* LSET DESC* = DS* LBET TAMT* = MKN* TRANS) PUT #2,L0F<2)+1 GOTO 1040 FOR 1=1 TO 9 LSET UPDAMT* = MKN*(AMT( PUT #1,1 NEXT I CLOSE RETURN ' JI " ( ) ) TAB(61)CVN(AMT*) 1660 BAL=CVN(AMT*) 1670 FOR J=l TO L0F(2) 1680 GET #2, I 1 690 I F ACNO -1 < > VAL T ACNO* THEN 1730 1700 BAL=BAL - CVN(TMT*> 1710 IF CVN(TMT*) <,0 THEN CR*="CR" ELSE CR*="" 1720 PRINT #-2,TAB(17)TDATE*?TAB(27) CR* TRDESC* TAB 47 ABS CVN TMT* TAB (61 )BAL 1730 NEXT J 1740 NEXT I 1750 CLOSE 1760 RETURN ( 5 ) ) ( ( ( ( ) ) ! ? 1770 1780 ' This subroutine sets the values of the account numbers, 1790 ACNO(I), and account de s c r i Pt i o n s DESC* I 1800 1810 FOR 1=1 TO 9 1820 ACNO(I) = I * 100 1830 NEXT I 1840 DESC*( 1) "FOOD" "RENT" 1850 DESC*<2) "CAR" 1860 DESC*(3) 1870 DESC* (4) "UTILITIES" 1880 DESC*(5) "INSURANCE" "TAXES" 1890 DESC*(6) "CLOTHING" 1900 DESC* (7) "ENTERTAINMENT" 1910 DESC*(8) 1920 DESC* (9) "MISCELLANEOUS" 1930 RETURN 1940 1950 This subroutine terminates the program. 1960 1970 END ' ' , ' ' ' ' ( ) -APPENDIX D ASCII CHARACTER CODES These are the ASCII codes for each of the characters on your keyboard. The first column is the character; the second is the code in decimal notation; and the third converts the code to a hexadecimal Q6-based number). Chapter 15 shows how CHARACTER to use these codes with DECIMAL CODE CHR$ to HEXADECIMAL CODE produce a character. CHARACTER DECIMAL CODE HEXADECIMAL CODE SPACEBAR *If shifted, the codes for these characters are as follows: (CLEAR) is CD is 21 (hex 15); and CD is 92 (hex 5C); ® is 95 (hex 5F); © is 91 (hex SB); 93 (hex 5D). 79 APPENDIX D LOWER-CASE CODES These are the ASCII codes for lower-case letters. You can produce these characters by pressing the (SHIFT! and ® keys simultaneously to get into an upper/lower case mode. The lower case letters will appear on your screen in reversed colors (green with a black background). CHARACTER DECIMAL CODE HEXADECIMAL CODE 97 98 99 61 e 101 g 65 66 67 1 102 103 104 105 k 107 m 108 109 a b^^H c h 63 WflaBfiHHHHflBi 69 i 80 k 6B ec 6D mm DECIMAL CODE HEXADECIMAL CODE ^APPENDIX E MEMORYMAP DECIMAL 0-255 HEX 0000-00FF 256-1023 0100-03FF 1024-1535 0400-05FF 0600-0988 1536-2440 CONTENTS System Direct Page RAM Extended Page Video Text DESCRIPTION See Section IV of Getting Started with BASIC for RAM Memory Additional System This RAM 2441-top 0989-top of RAM ofRAM is used exclusively by DISK BASIC. These Random Access Memory locations are allocated dynamically and contain the following: RAM is top of RAM is 16383 for 16K 3FFF for systems; systems; 32767 for 32K systems for top of COLOR detailed information. 1. 16K Random File Buffer Area 7FFF 32K systems 2. File Control Blocks (FCBs) Total buffer space for random access files, 256 bytes are reserved for this on start-up. This value can be reset by the FILES statement. Control data on each user buffer. 843 bytes are reserved for this on start-up. This value can be reset by the FILES statement: (number of buffers set 3. Graphics Video by FILES + 1) x 281 bytes. Space reserved for graphics video pages. 6144 bytes or 4 pages are reserved for this on start-up. This value can be reset by the PCLEAR statement: number of pages reserved by PCLEAR X 1,536 bytes per page. (Note: All pages must start at a 256-byte page boundary i.e., a memory location divisible by 256.) Space reserved for BASIC Programs and Variables. 6455* bytes (16K systems) or 22,839* bytes (32K systems) are reserved for this on startup. This value can be reset by different settings of Random File Buffers, FCBs, Graphics Video Memory, String Space or User Memory. Memory — 4. BASIC Program Storage 5. BASIC Variable Storage " 6. Stack 7. String Space Total space for string data. On start-up, 200 bytes are reserved, but this can be reset by the CLEAR statement. 8. User Memory Total space for user machine-language routines. No space is reserved for this on start-up, but this can be reset by the CLEAR statement. 32768-40959 8000-9FFF Extended BASIC 40960-49151 49152-57343 A000-BFFF C000-DFFF COLOR Read Only Memory ROM COLOR BASIC ROM COLOR DISK BASIC ROM 57344-65279 65280-65535 E000-FEFF FF00-FFFF MEM Read Only Memory Read Only Memory Unused Inp ut/Output *Ifyou execute a PRINT command, on start-up, you overhead necessary to execute this command. will, get a number a little lower than this because of the 81 APPENDIX F, SPECIFICATIONS Type of disks 5V4" mini-diskettes Radio Shack Catalog Number 26-305 26-405 (package of three) or 26-406 (package of 10) Disk Organization (Formatted disk) Single-sided Operating Temperature 18 to 113 degrees Fahrenheit Double-density 35 tracks 18 sectors per track 256 data bytes per sector Directory on track 17 10 to 45 degrees Centigrade Memory Capacity Unformatted Soft sector (I/O sector/track) 218.8 kilobytes per disk 6.2 kilobytes per track 179.1 kilobytes per disk 5.1 kilobytes per track Data transmission speed 250 kilobits per second Access Time Track to track Average 5 Settling time 82 m sec. 100 m sec. 15 m sec. Number of indexes 1 Weight of Disk Drive 3.8 kg. Disk Controller WD1793 APPENDIX G ERROR MESSAGES /O Division by zero. The Computer was asked to divide a number by 0, which is impossible. You could also get this error message if you do not enclose a filename in quotation marks. DS File Already Exists. or COPY a file to You are trying to RENAME a filename which Already Exists. AO Attempt to open a data file which is Already FC too low (less on the than 1) or too high (higher than the disk). Use a number in the a smaller record different record GET line, or assign length in the OPEN line. or when you use BASIC word that is Function Call. This happens FD Bad File Data. This error occurs when you PRINT data to a file, or INPUT data from the file, using the wrong type of variable for the corresponding data. For example, INPUT # 1, A, when the data in the file is a string, causes this error. BS Bad Subscript. The subscripts in an array are out DIM to dimension the array. For of range. Use example, if you have A(12) in your program, without a preceding DIM line which dimensions array A for 12 or more elements, you will get this error. CN Illegal SOUND (260,260) or CLS(IO) will cause this error. Also RIGHT$(S$,20), when there are only 10 characters in S$, would cause it. Other examples are a negative subscript, such as A( - 1), or a USR call before the address has been POKEd in. maximum number of records the Computer can fit PUT contains. a parameter (number) with a out of range. For example Bad Record Number. You have used an impossible record number in your PUT or GET line. Either it is file. Write or Input past End of Record (direct access only). You are attempting to PUT more data in the record than it can hold or INPUT more data than it Open. BR is a direct statement in This could be caused if you load a program with no line numbers. the data ER AE Direct Statement. There FM Bad File Mode. You have specified the wrong file mode ("O," "I," or "D") in your OPEN line for what Can't continue. If you use the command CONT END of the program, you will you are attempting and you are at the attempting to get this error. for "I" to do. For example, you are GET a record from a file OPENed (use "D") or WRITE data to a file OPENed for "I" (use "O"). DD redimension an array. An array can only be dimensioned once. For example, you cannot have DIM A(12) and DIM A(50) in the same Attempt to FN Bad File Name. You used an unacceptable format name your file. to program. FO DF Disk Full. The Disk you are trying to store your file on is Full. Use another disk. DN This FS is either a Drive Number or Device Number DSKINI or BACKUP. you have only one drive with these two commands File Structure. ID There is something wrong file. Illegal Direct statement. You can only use INPUT as a line in the program, not as a IE to see End of file. Use EOF or LOF to check when you've reached the end of the file. When you have, CLOSE IO command line. Input past 0). Device Number error. You are using more buffers than the Computer has reserved. Use FILES to reserve more. You might also get this error if you use a nonexisting buffer number (such as buffer # - 3) or omit the buffer (such as FIELD 1 AS A$ rather than FIELD #1, 1 AS A$). The field length is longer than the Either the data was written incorrectly or the directory track on the disk is bad. See IO for instructions on what to do. If specify drive (DSKINIO or BACKUP Bad with your disk error. Drive Number Error. You are using a drive number higher than 3. You will also get this error if you do not specify a drive number when using Field Overflow. record length. it. Input/Output error. The Computer is having trouble inputting or outputting information to the disk. 83 APPENDIX G. Make (1) sure there is a disk inserted properly and the drive door is OS is not enough space in closed. at the beginning of your get this error, there might be something wrong with your disk. Try reinserting the disk first. Then try using a dif- you you still get this error, you probably have a problem with the Computer System itself. Call the Radio Shack Repair Center. This error could also be caused by input/output problems with another device, such as the tape (3) If OV A string may only be 255 to reserve more Overflow. The number puter to handle. is too large for the Com- RG RETURN without GOSUB. A RETURN line is in your program with no matching GOSUB. SE Set to non-fielded string. The field in which you are attempting to LSET or RSET data in has not yet been FIELDed. Check the FIELD line. SN Syntax recorder. String too Long, program string space. still ferent one or reformatting it. (Remember that reformatting a disk erases its contents.) NE of String Space. There memory to do your string operations. Use CLEAR (2) If LS Out in the indicated drive This could result from a misspelled error. characters. command, incorrect punctuation, open parenthesis, or an illegal character. Type the program line The Computer can't find the disk file you want. Check the disk's directory to see if the file is there. If you have more than one disk drive, you might not have included the appropriate drive number in the filename. If you are using COPY, KILL, or RENAME (discussed in the next chapter), you or might have left off the ST NEXT A string operation into shorter steps. NF NEXT without FOR. NEXT is being used without a matching FOR statement. This error also occurs when you have the String formula too complex. was too complex to handle. Break up the operation TM extension. command over. lines reversed in a Type Mismatch. This occurs when you try to assign numeric data to a string variable (A$ = 3) or string data to a numeric variable (A = "DATA"). This could also occur if you do not enclose a filename in quotes. nested loop. NO File OB Out of Buffer Not Open. You cannot input or output data a file until you have OPENed it. space. Use FILES to reserve UL Undefined Line. You have a GOTO, GOSUB, or other branching line in the program asking the Computer to go to a nonexisting line number. VF Verification. to more have the space. to a disk. OD Out A READ was executed with insuffiDATA for it to READ. A DATA statement there of Data. cient is tions on You will only get the error VERIFY command ON and The Computer a flaw in what what it is when you are writing informing you that wrote. See 10 for instruc- to do. may have been left out of the program. WP OM Out of Memory. All available memory has been used or reserved. 84 Write Protected. You are trying to store information on a disk which is Write Protected. Either take the label off the write protect notch or use a different disk. If your disk is not Write Protected, then there is an input/output problem. See 10 for instructions on what to do about this. . .APPENDIX H DISK BASIC SUMMARY is a short summary on each new DISK BASIC "command." You may also use any of the EXTENDED COLOR BASIC commands. (See Getting Started with Extended Color BASIC or the Color Computer Quick Reference Card This for a complete listing.) The first line gives the format to use in typing the command. The which you can specify with the command. This is the meaning of some of the parameters you may italicized words represent "parameters" — values specify: filename must have a filename. The filename should be number mandatory. It must have 1 to 8 characters. All information stored on a disk in this format: name/extension:drive The name is The extension is optional. It can have 1 to 3 characters. The drive number is optional. If you do not use it when opening a disk the drive specified in the DRIVE command). file, the Computer will use drive (or number This (5 may be a number (1, 5.3), a numeric variable (A, BL), a numeric function (ABS(3)), or a numeric operation + 3, A-7). string This may be characters ("B," "STRING"), a string variable (A$, BL$), a string function (LEFT$(S$, + A$). 5)), or a string operation ("M" data This may be number or string. BASIC WORD BACKUP source drive TO destination drive PAGES DISCUSSED 13-15 Duplicates the contents of the source drive to the destination drive. If you only have one drive, specify it as the source drive. The Computer will prompt you to switch disks as it makes the backup copy. Executing this command will erase memory. BACKUP 13 CLOSE # TO BACKUP 1 buffer, . 26-27 . Closes communication to the buffers specified. (See OPEN for buffer numbers). If you omit the buffer, the Computer will close all open files. CLOSE «1 *2 CLOSE *1 , COPY filenamel TO filename2 21 Copies the contents of filenamel to filename2. Each filename must include an extension. (See format for filenames above.) Executing this command will erase memory. COPY "FILE/BAS" TO "NEWFILE/BAS" COPY "ORG/DAT:0" TO "ORG/DAT: 1" 85 . APPENDIX H. BASIC WORD CVNistring variable) Converts a 5-byte coded string (created by DISCUSSED 50 MKN$) back to the number it represents. x=cvnia$) DIRdrive number 11 Displays a directory of the disk in the drive number you specify. If you omit the drive number, the Computer will use drive 0. (Unless you use the DRIVE command to change this default.) This is a typical directory display: BAS B 3 MYPROG BAS A 1 Y0URPR0G A 5 DATA 1 HERDATA BIN 2 B 2 USRPROG The first column is the name of the file. The second column is its extension. The type (0 = BASIC program, 1 = BASIC data file, 2 = machine lan= editor source file). The fourth column is the storage format (A = ASCII, B = Binary). The fifth column is the file length in granules. third is the file guage 3 file, DIR DIR0 DRIVE drive 11-15 number Changes the drive default to the drive number you DRIVE command, DRIVE specify. If you the Computer will default to drive do not use the 0. 1 DSKINIdriue number Formats a disk in the drive number you erase memory. 8 specify. Executing this command will DSKINI1 DSKINI0 DSKI$ drive number, track, sector, string variablel, string variable2 Inputs data from a certain sector within a certain track on the disk in drive number. The first 128 bytes of data are input into string variablel; the second 61-62 128 bytes into string variable2. DSKI$ 0. 12 DSKO$ . 3i M* t N$ 61-62 drive^number, track, sector, stringl, string2 Outputs stringMata into the sector, track, and drive number you specify, stringl is output into the first 128 bytes of the sector; string2 is output into the second 128 bytes. Used improperly, this command could garble the contents of the disk. "FIRST DATA", "SECOND DATA" DSK0$ 0, 2, 1 , EOF (buffer) 27 Returns a if there is more data to be read in the buffer and a more data in it. (See OPEN for buffer numbers.) IF EOFU) FIELD # = -1 1 if there is THEN CLOSE «1 buffer, field size AS field name, . . 48-49 . Organizes the space within a direct access buffer into fields. (See buffer numbers.) You specify the size and name of each field. 5 AS C$ FIELD »1» 10 AS A*. 12 AS B$ 86 no OPEN for . .APPENDIX H BASIC FILES PAGES WORD DISCUSSED buffer number, buffer size Tells the 54-55 Computer how many buffers to reserve in memory (buffer number), and the total bytes to reserve for these buffers (buffer size). If you do not use FILES, the Computer will reserve enough memory space for buffers 1 and 2, and will reserve a total of 256 bytes for those buffers. FILES 1 FILES 1000 . 5 FREE(drive number) Returns the number of free granules on the disk in the drive number you 20 specify. PRINT FREE(0) GET # buffer, record number Gets the next record or the record number you specify, and puts (See OPEN for buffer numbers). GET «1 ,5 GET *2. 34-36 it in the buffer. 3 INPUT # buffer, variable name, Inputs data from the buffer you specify and assigns each data item in the buffer to the variable name you specify. (See OPEN for buffer numbers.) . . 26-28 INPUT «1. A$. B$ KILL filename 20 you specify from the disk directory. (See the format for filenames above.) You must include the extension with the filename. Deletes the filename "KILL FILE/DAT:1" KILL "FILE/BAS" LINE INPUT # data the data up to the for buffer numbers). Inputs a line (See OPEN LINE INPUT «1 42-43 buffer, (all , (ENTER) character) from the buffer you specify. X$ LOAD filename, R BASIC program file you specify from a disk into memory. By includthe program immediately after loading it. If your filename does not have an extension, the Computer assumes it is BAS. (See the format for filenames above.) Executing this command will erase memory. LOAD "PROGRAM", R LOAD " ACCTS/BAS: 1" Loads the ing R, the Computer will RUN LOADM filename, offset address 61 Loads a machine-language program file from disk. You can specify an offset address to add to the program's loading address. If your filename does not have an extension, the Computer assumes it is BIN. (See the format for filenames above.) LOADM "PROG/BIN. 3522 LOC(buffer) Returns the current record buffer numbers.) number of the buffer you specify. (See OPEN for PRINT L0C(1) 87 APPENDIX H. basic LOF(buffer) Returns the highest word magnSro 37 numbered record of the buffer you specify. (See OPEN for buffer numbers.) FOR R = 1 TO L0F(1) LSET field name = data 48-50 Left justifies the data within the field than the the RIGHT "BANANAS" field, LSET A$ = name you the data characters will be truncated (chopped off). LSET B$ = T$ specify. If is larger MERGE filename, R 53-54 Loads a program file from disk and merges it with the existing program in memory. If you include R, the Computer will immediately run the program after merging it. (See the format for filenames above.) The disk program file cannot be MERGEd unless it was SAVEd with the A (ASCII) option. MERGE "SUB/BAS" MERGE "NEW". R MKN$(number) Converts a number to a 5-byte coded string, LSET B$ = 50 for storage in a formatted disk file. MKN*(53B78310) OPEN "mode" # buffer, filename, record length Opens a place in memory called a buffer which will communicate data to and from a certain device. The buffers and the devices they communicate with are: screen or printer (it is not necessary to open this buffer) — - 1 — tape recorder -2 — printer 1-15 — disk drive The communication modes you can use are: — inputting data from a sequential access O — Outputting data to a sequential access D — Inputting or outputting data to a direct access I 26-28, 29-31, 33-38 file file file The filename you use should be in the format defined above. If you do not give filename an extension, the Computer will give it the extension DAT. If you are opening communication to a direct access file, you can also specify the record length. If you don't, the record length will be 256 bytes. OPEN "D" OPEN "I" "FILE" f «1 » *2 "CHGE/DAT" . , 15 PRINT # buffer, data list PRINTs the data to the buffer. (See OPEN for buffer numbers.) You may use a comma or a semi-colon to separate each item in the data list. PRINT «1 PRINT # . "DATA" buffer, USING format; data list Prints data to the buffer using the format you specify. which can either specify a numerical or string format, numerical formats # may consist of any sets the field of a of the following: number formats a decimal point 88 27-28 45-46 The format is a string " .APPENDIX H BASIC WORD DlIcufsED $ formats a comma every third number fills leading spaces with asterisks places $ ahead of number $$ floating dollar sign , ** + in first position, causes sign to be printed before number; in last -•-•"• position causes sign to be printed after the number prints number in exponential notation prints a-minus sign after negative numbers - "*«.*"; 53.76 PRINT USING *1 PRINT USING #2. "#*$#.«*-"! -3.G78 . string formats may consist of either: % % fields the length of a string. prints the first character of the string PRINT USING *1 "!"i "WHITE" PRINT USING *1. "X Z"i "YELLOW" ! ! . See Going Ahead With Extended Color BASIC for more information on the formats. PUT # buffer, record number Assigns a record number to the data in the buffer. If you do not specify a record number, the Computer will assign it to the current record. (See OPEN for buffer numbers.) PUT *2. 3 PUT «1 > 34 H RENAME old filename TO new filename 19-20 Renames a file on disk to a new filename. You must specify the extension of both filenames. RENAME "MFILE/DAT:1" TO "BFILE/DAT: 1 RSET field name = data Right justifies the data within the field name you specify. If the data is larger than the field, the RIGHT characters will be truncated (the same as with LSET). RSET M$ = "SOAP" RUN filename, R 9 Loads filename from disk and runs it. If R is included, open. (See the format for filenames above.) RUN "FILE' RUN "PROG/BAS" , all open files will remain R SAVE filename, A 8 Saves filename on disk. If you do not give filename an extension, the Computer will give it the extension BAS. By using the A option, your program will be saved in ASCII format. (See the format for filenames above.) SAVE "PROG/BAS" SAVE "TEST:1" , A SAVEM filename, first address, last address, execution address Saves filename a machine language program beginning at first address (in memory) and ending at last address. You also specify the address in which it will be executed. If you do not give filename an extension, the Computer will give it the extension BIN. (See the format for filenames above.) SAVEM "FILE/BIN: 1" &H5200 &H5800 &H5300 — , , 61 . 89 APPENDIX H, BASIC WORD PAPFS DISCUSSED 13 UNLOAD drive number Closes any open files in the drive number you specify. If you don't specify a drive number the Computer will use drive (or the drive number you specified with DRIVE). UNLOAD UNLOAD 15 VERIFY ON VERIFY OFF Turns the verify function ON or OFF. When VERIFY is ON, the Computer will verify all disk writes. WRITE # data list Writes the data to the buffer you specify. (See OPEN for buffer numbers.) Use a comma to separate each item in the data list. WRITE *1 90 buffer, > A$ . B$i C 25 " 26 34-35 ' JNDEX PAGES SUBJECT 54, 59, 78, 79 ASCII 1 1 BACKUP 84 1 1 54 7, 57 26, 29, 54, 55, 84 7, 41 57, 58, 59 , Bits Bytes , CLOSE 26, 27, 34, Connections 84 1,2 COPY CRC CVN 21,84 58 50, 85 DCBPT DCDRV 60 60 60 60 60 60 78, 79 14 33-38, 47, 48 11,85 1 1 25, 58 58 48 DCODC DCSEC DCSTA DCTRK DECIMAL CODE Destination Disk Access File DIR Directory 43,61,86 2 Interface Direct Input Disk Care KILL LINE INPUT LIST 13-17 of disk 7-8 Formatting Inserting Disk Drive 2, Disk System , Logical Sector LSET Machine-Language 57, 60, 61 Memory 9 MERGE 87 50, 87 20 53, 54, MKN$ Multi-Disk Drives NEW 9 Numerical Formats 88 OPEN OUTPUT 26, 27, 34, PRINT PRINT FREE PRINT USING PUT 1 , RENAME 1 1 , RESET 1 RMB RSET RUN 6, 85 82, 83 Salvage a Disk SAVE SAVEM Sector Field FIELDED INPUT Table Files Filename Filename Extension GET Granule Hexadecimal 60 88 20 45, 88 34, 35, 36, 88 59, 19, 27, 43, 44, 45, 48, 33, 34, 36, 37, 1 9, 54 55 88 15 60 89 9,89 , Messages FREE 87 26, 27, 61 Physical Sector Records 27, 45, FORMAT 86 86 61 87 87 37, 87 59, 60 48, 49, 50, 87 LOC LOF READ EOF DSKINIO DSKI$ number 42, 43, 9, LOADM 8 DSKO$ DSKCON File 86 9 LOAD 3 57 85 60, 60 8,14,85 61,62 61 62, 85 Number File Allocation 20, , Directory Entries Error 26, 27, 34, 36, 37, 42, , Buffer Drive INPUT 13, 14, Binary Direct PAGES SUBJECT 8, 86 49 59 25, 54, 55, 58, 86 1 0, 59, 84 59, 84 84 7, 8, 47 86 86 58, 59 34, 35, 36, 57 Sequential Access File SKIP FACTOR Source Disk Specifications Start-up 15 8,19,89 61,89 7, 57, 58 29-31 59 ,.14 81 2-3 Storing on Disk A BASIC Program A Data File A Machine-Language Program Machine-Language Routine String Format System Controls String 8 23-39 61 60 84 88 57 91 INDEX SUBJECT PAGES Technical Information 57-62 Tracks 57, UNLOAD 13,89 VERIFYOFF VERIFYON 15, WRITE WRITE PROTECT 92 58 15, 89 89 25, 34, 35, 37, 42, 89 15 . SERVICE POLICY Radio Shack's nationwide network and of service facilities provides quick, conve- computer products, in most instances. Warranty service will be performed in accordance with Radio Shack's Limited Warranty. Non-warranty service will be provided at reasonable parts and labor costs. nient, reliable repair services for all of its Because of the sensitivity of computer equipment, and the problems which can result from improper servicing, the following limitations also apply to the services offered by Radio Shack: 1 2. If any of the warranty seals on any Radio Shack computer products are broken, Radio Shack reserves the right to refuse to service the equipment or to void any remaining warranty on the equipment. If any Radio Shack computer equipment has been modified so that within manufacturer's specifications, including, but not limited to, is not the in- it any non-Radio Shack parts, components, or replacement boards, then Radio Shack reserves the right to refuse to service the equipment, void any remaining warranty, remove and replace any non-Radio Shack part found in the equipment, and perform whatever modifications are necessary to return the equipment to original factory manufacturer's specistallation of fications. 3. The cost for the labor and parts required to return the Radio Shack computer equipment to original manufacturer's specifications will be charged to the customer in addition to the normal repair charge. RADIO SHACK, A DIVISION OF TANDY CORPORATION CANADA U.S.A. FORT WORTH, TEXAS 76182 BARRIE, ONTARIO, L4M4W5 TANDY CORPORATION 91 AUSTRAUA KURRAJONG ROAD MOUNT 874947OBC0 DRUITT, N.S.W. 2770 BELGIUM PARC INDUSTRIE!. NANINNE 5140 NANINNE UNITED KINGDOM BILSTON ROAD, WEDNESBURY WEST MIDLANDS WS1B 7JN PRINTED IN U.S.A.
Source Exif Data:
File Type : PDF File Type Extension : pdf MIME Type : application/pdf PDF Version : 1.5 Linearized : Yes Page Layout : TwoPageRight Page Count : 104 XMP Toolkit : XMP Core 4.1.1 Metadata Date : 2013:05:22 07:38:40Z Create Date : 2013:05:22 07:34:30Z Modify Date : 2013:05:22 07:38:40Z Creator Tool : Digitized by the Internet Archive Producer : Recoded by LuraDocument PDF v2.53 Part : 2 Conformance : B Document ID : uuid:uuid:fd7605f0-0382-dcac-7c41-ed7a94745849 Version ID : 2 Title : Radio Shack Hardware Manual: Color Computer Disk System Owners Manual (1981)(Tandy) Creator : Digitized by the Internet Archive Keywords : http://archive.org/details/Color_Computer_Disk_System_Owners_Manual_1981_TandyEXIF Metadata provided by EXIF.tools