CALLING ALL TAPES
A self-modifying program index for cassettes
The main problem with storing programs on tape is that you must keep a written record of what programs you have and where they are stored. The real problem, though, is where to store the wriiten record so it won't get lost or be destroyed by the kids or the cat.
If you use C-60 or C-90 tape, you'll soon find out that the labels on the tape boxes aren't big enough to hold the names of all the programs that can be put on a long tape, especially if you store a number of short programs on the tape. If you use C-10 or C-15 tape, however, you'll be able to write the program titles you need on the labels that come with the tape box (if a tape box came with the tape!).
Still, you must shuffle through all of your tapes to find the specific program you are looking for at any given time. As a result, tapes are scattered all over the house by the time you find the program you want -- and that's assuming the tape you're after hasn't mysteriously disappeared.
The only solution is to get organized. What's needed is an index program that lists all of your programs and provides you with their exact locations. Such a program, it seems to me, must meet the following criteria:
A) It must be easy to use.
B) It must be easy to update with new information.
C) It must have an edit feature.
D) It must check for input errors and explain how to correct them.
E) It must be self-explanatory.
F) It must be unique, so there is no doubt as to what program is running.
A FRAME WORK FOR INFORMATION
I originally wrote this program to be a header on a C-90 tape, but it can also be stored on a C-10 or C-15 tape. This can then be used as a master-index tape, which means that the names and locations of all of your programs can be stored on a single tape as an index. With a few modifications, this program can also be adapted for a number of other applications, such as an address book, a telephone directory, or a collection of recipes. It's basically a framework for the information you want to store.
ENTERING THE PROGRAM
Because this program modifies itself as it is RUN, it may be a little difficult to get it to RUN correctly the first time you try. A simple typographical error, for example, can cause no end of problems. Here are a few suggestions that may help, though:
1) After you have input the program, SAVE it to a tape. Do not RUN it until you have done this! Then RUN the program and take note of any errors to be corrected. LOAD the original copy. Make any necessary changes, and then SAVE it back to tape as the original. Continue this routine until all errors have been eliminated.
2) When you key in the listing, copy it exactly as if is printed in the magazine. Do not change any line numbers or try to compress the program at this time.
The reason that I have asked you to take these precaution is that the program removes specific lines after it is RUN the first time.
HOW TO USE THE PROGRAM
First of all, you must make a copy of this program, which should then be stored separately from the version you actually use. This copy should be used as a master copy only! The master will then be used to create index programs for your tapes.
This program must be SAVEd to tape before it is RUN because the program modifies itself to specifications that you apply. Once you have a copy of the original, RUN the program. Answer any questions that it asks, and then add, delete or edit data as required. Next, CSAVE this version as a header on a C-60 or longer tape, or as a master index on a shorter tape. It will serve as the index to your other programs.
When you want to add new programs, delete or change information, or view the index, CLOAD and RUN the program. The title screen will appear with your tape number and name. Then you will be prompted to view or update. (By the way, be sure to leave extra room on the tape you SAVE this program onto. Since data that is added or changed becomes part of the program, its size will vary.)
ENTERING OR VIEWING DATA
Once you have got the program to work, you will be prompted to enter a tape number. This can be any alphanumeric input of up to three characters. Next, you will be asked if you want to enter a name for the tape. This alphanumeric input can consist of up to twenty characters.
There will be a short pause at this point (of no more than ten seconds or so). Then the title screen will appear with your tape number and name on it, and you will be prompted to either view or update the program.
If you choose to view it, the View/Update/End Menu will appear, because there isn't any data to view yet. If you choose to update, the Edit Menu will appear. This part of the program is very straightforward. It allows you to add, change or delete data.
Meanwhile, the error-protection portion of the program will check to make sure that your entries have been entered using the correct format. It will tell you if you've made a mistake, and, if so, how to correct it.
After you have finished entering data, type DONE. This will be followed by a short pause, as the program adds this 2005 data to itself. Furthermore, if you make more than eight entries in a row, a brief pause will follow the eighth entry. This allows the program to automatically add these entries. It then returns the program you to the data-entry portion of the program. A maximum of thirty entries are allowed.
EDITING YOUR ENTRIES
Once you've finished entering data, the View/Update/End Menu will appear. If you choose view at this stage, your entries will appear in nicely-formatted form. To edit these entries, enter the Edit Mode (Number Two) and use the cursor controls (control arrows) to position the cursor over the entry you want to change. Then type in your change. To delete, follow the same routine and simply type over the text you wish to eliminate.
When you're satisfied with your changes, press [RETURN] and the revised data will be entered into the program. If you list the program after you've made some entries, you'll notice that lines 521-529, line 945, line 2005, and lines 2400-2524 are no longer in the program. In addition, line 545 will contain a different number than it did in the original listing. This is why it's so important not to change line numbers in the original program, and to keep a copy of the original listing on a separate tape.
You can, however, always change data or add data to the program once you have entered some data into it. If you want to create a new header tape (for a different tape), you must load the original copy, add your data, and then SAVE it to the tape you want to store it on. You can condense the program, after it has been RUN the first time, but you must be careful not to disturb the line numbers that are to be removed from the program, or lines that employ the RETURN key mode.
TAKE-APART OF PROGRAM.
490-520 Dimension strings
521-529 Get tape number and name
540 Clears screen
545 Keeps track of where to add new data lines
560-670 Modifies display list
680-790 Title screen
800-850 Choose update or view
870-910 Reads and displays entries
920-940 Displays view/update/end menu
950-990 Choose from view/update/end menu
1000-1010 Restores to page one of entries
1020-1320 Data lines
1335-1360 Data-edit menu
1370-1400 Choose from data-edit menu
1410-1442 Data-edit instruction screen
1444-1520 Displays and enables data lines to be edited
1590-1680 Enter-program-name screen
1690-1900 Enter-start/end-count screen
1910-2050 Adds data lines to programs
2005 Removes lines and itself from program
2015 Updates line 545
2060 Blanks screen while data is being entered into the program
2070-2100 Formats data to be entered into the program
2200-2250 Error-sound routine
2260-2280 Error message
2282-2284 Error message
2300-2310 Loading-data message
2400-2430 Error message
2500-2524 Removes lines from program; adds tape number and name to program.
LINES REMOVE FROM THE PROGRAM
LINES ADDED TO THE PROGRAM
LINES UPDATED IN THE PROGRAM
James Luczak is a resident of Three Rivers, Michigan, and an avid Forth programmer, as well as a fan of Tape Topics. A communications technician for the phone company, he has writtens for several computer publications.
Download TAPEINDX.BAS Download