Classic Computer Magazine Archive COMPUTE! ISSUE 61 / JUNE 1985 / PAGE 108

Atari Cassette Filenames

Norman Lin

Do you have trouble loading Atari cassette files because you keep losing track of the tape counter numbers? Or maybe you're wasting lots of tape by recording only one program per cassette side. Now there's a solution—a clever way to add filename capability to Atari cassettes. The technique works on any Atari 400/800, XL, or XE.

Unlike some other tape storage systems, the Atari doesn't allow filenames for cassette files. You must either jot down the tape counter numbers where the files start, or record only one file on each side of a cassette. But what happens if your cassette recorder's counter goes awry, or if you lose the index numbers? Things would be a lot easier if the computer could locate a program in the middle of a tape and load it for you.

Finally there's a simple way to solve these problems: "Atari Searcher/Loader." It lets you save numerous programs on a single side of a cassette, and then automatically finds and loads the program you want.

Saving Programs

Atari Searcher/Loader is very easy to use. Just follow these steps:

  1. Type in the program listing following this article. (Note: Line 90 is too long to be typed as listed; to enter it, you must abbreviate POSITION as POS. When you list the program, POS. automatically appears as POSITION. Don't attempt to edit the line after it is entered. If you make a mistake, retype the entire line.)
  2. Save the program once at the beginning of each tape using the LIST:"C:" command—not the CSAVE command. (Just type LIST"C:", press RETURN, push the Play and Record buttons on the recorder, and hit RETURN again. Of course, you'll have to start with blank tapes to avoid overwriting programs on your existing tapes.) After you've saved Atari Searcher/ Loader with LIST"C", do not rewind the tape. Type NEW to clear Searcher/ Loader out of memory.
  3. Enter the following short line in immediate mode (that is, without a line number):
    OPEN#1,8,0,"C:":? #1;
    "filename":CLOSE #1
    
    where filename is the name you wish to assign to your program. Then press the Play and Record buttons and hit RETURN twice. After a few seconds, the filename is written onto tape and the computer's READY prompt reappears.
  4. Now you can start saving your regular program as usual, except that you must use the LIST"C:" command as described above instead of CSAVE. If you want to load a program from another tape to save onto the Searcher/Loader tape with a filename, swap cassettes without rewinding the Searcher/Loader tape.

Repeat steps 3 and 4 for each program you save on that side of the tape.

The filename can be anything you like. Disk filenames are limited to eight characters plus a three-character extender (such as PROGRAM1.BAS), but Atari Searcher/ Loader permits much longer filenames. However, you should not include spaces or graphics characters as part of a name. Stick to letters, numbers, and common symbols. Do not use the same filename more than once on the same side of a cassette. It is a good idea to write the filenames on the cassette label in case you forget them.

Automatic Loading

Loading your programs with Atari Searcher/Loader is even easier than saving them. Suppose you've saved five programs on one tape using the above procedure. Their filenames are PROG1, PROG2, PROG3, PROG4, and PROG5. Now you want to load PROG4. Just follow these steps:

  1. Rewind the tape to the beginning and load Atari Searcher/ Loader by typing this command and pressing RETURN:
    ENTER"C:"
    
  2. When the READY prompt reappears, type RUN. Searcher/ Loader asks, FILENAME?. Type in the filename (in this example, PROG4) and press RETURN.

Searcher/Loader hunts through the tape until it finds PROG4, then automatically loads it and stops.

How It Works

After Searcher/Loader asks you for the filename, it stores the name in the string variable A$ and enters the FOR-NEXT loop at lines 40–80. This loop searches for and loads one block of data at a time (made possible by the LIST"C:" format in which the programs are saved). Each block of data is stored in B$. If you'd like to see these blocks of data printed on the screen during the search process, insert line 65 PRINT B$.

Line 70 checks to see if B$ equals A$—in other words, if the block of data loaded is the same as the filename you specified (which is actually a block of data in itself). If B$ does not equal A$, the search goes on. If an error occurs or the tape ends, Searcher/Loader displays the error message at line 100.

If a block of data loaded corresponds to the specified filename (if B$=A$), the program jumps out of the FOR-NEXT loop and to line 90. Line 90 clears the screen, erases Searcher/Loader from memory, and then loads the program that follows. When the program is loaded, the operation stops.

Although slow, Searcher/Loader does eliminate part of the hassle of cassette files.

Atari Searcher/Loader

Please refer to "COMPUTER!'s Guide to Typing In Programs" before entering this listing.

BI 10 REM TO SAVE A PROGRAM WITH A FILENAME,
         TYPE OPEN #1,8,0,"C:";?#1;" [FILENAME]":CLOSE #1
AD 20 DIM A$ (100) , B$(256)
JB 30 ? "FILENAME";: INPUT A$
BE 40 FOR I=1 TO 1 TO 1. 0E + 97
JE 50 OPEN #1,4,0, "C:"
NO 60 TRAP 100: INPUT #1,B$
JG 70 IF B$=A$ THEN 90
JA 80 CLOSE #1 : POKE 764,33:NEXT I
00 90 ? " (CLEAR)" : POSITION 2,4:?
         "NEW":? :? :? "ENTER";CHR$(34);"C:";
         CHR$(34):? :? :? "P0KE 842,
         12":POSITION 2,0:POKE 842,13:P0KE 764,33:END
PE 100 ? "BAD BLOCK. LOAD FAILED. TRY AGAIN."