Classic Computer Magazine Archive ANTIC VOL. 2, NO. 3 / JUNE 1983

TAPE TOPICS

File Formats

Three cassette storage schemes

by Carl Evans

This article begins a new series on cassette file structures. Right now I could write a book on the subject, but since that is not practical, I will hit one topic at a time, with occasional digressions into issues brought to my attention by you readers. This introduction is one of those reader-induced pieces.

The topic this month is "what is a file?" The answer is very complex. I see ads every day for programs that promise to solve all of your troubles in copying cassette files, and because I'm in the business, I buy all of them. As for cassette utility programs listed in magazines, I either type the program in myself or get them from the publisher. You, on the other hand, are pretty much at the mercy of the purveyors of such programs. This article will help you know what questions to ask about the next nifty cassette program you are thinking of buying.

BASIC files are somewhat different from machine language "BOOT" files. Most of you understand some of the differences between CSAVE, LIST"C, and SAVE"C BASIC files. If you don't, then hang on until I get to those details in a future article. However, even the more informed of you are still fuzzy when it comes to telling the difference between the various kinds of BOOT files.

The most common type of BOOT file is the ordinary single-stage, singlefile program. Let's call these "normal" BOOT files. These are the kinds of files that something like CBOOTMGR (see ANTIC #6) will readily copy or upload to disk. Such files are relatively simple, the file structure for both cassette and disk are almost identical. The structure is close enough, in fact, that a simple GET-BYTE:PUT-BYTE routine can take one of these files from a cassette and directly transfer it to disk, or vice-versa. Such a file will BOOT normally and nobody is the wiser. Alas, most commercial programs are not anywhere near to this simplistic ideal.

Programs like CBOOTMGR do a nice job of copying some programs and a nice job of uploading most of those programs. But you probably have run into a number of programs that it can't copy, and even more that it can't upload. The problem is that CBOOTMGR only does the mission it was designed for. A flathead screwdriver works fine for driving flathead screws, but falls short when it comes to phillips-head screws. The problem in this case is very similar.

BOOT files come in three basic types, and to further complicate the situation, the three basic file structures can be combined with one another. The first type, the "normal" BOOT, is a single-stage, single-file collection of 128-byte records.

The second type is the single-stage, multi-file program. A good example of this type of program is the game with a small loader file that displays a title page before automatically loading the actual game. Remember this format because there is a variation on it that I'll discuss later. This kind of program can usually be copied to another tape by a program like CBOOTMGR, but can not be properly transferred to disk since the first file calls the second file using a machine-language cassette loader. Some modification is required for it to work properly from disk, and that is not a trivial task for even an accomplished machine-language programmer.

The third major type of boot file is called a "multi-stage" boot file. Please don't confuse this with the singlestage, multi-file boot program. A multi-file boot program contains a separate end-of-file marker for each file, while a multi-stage boot program generally has only one end-of-file marker. The only multi-stage boot programs I have seen are typically very large programs that can't be loaded in a single-stage (normal) boot. This means that the program has more than 255 sectors. The Lords of Karma and Empire of the Overmind adventure games fall into this category.

Your normal cassette copy program bogs down on this type of file and fails to give you a good copy. This type of program is even more difficult to transfer to disk since the nature of the multi-stage boot can vary considerably. This means that an upload program will successfully upload this kind of program only if the particular multistage sequence of that program has been anticipated. Fortunately, this boot format is not widely used for commercial programs.

Many game companies are using a modified, single-stage, multi-file format. The first file will load normally and can be copied by any boot-file copier, but the second file just won't seem to copy. The reason is simple, but not very well known. The first file is a normal 128 byte-per-sector file which alters the way the computer looks at cassette files. The ones I have analyzed alter the byte-per-sector format from 128 (default) to 146, or to some other odd-ball number.

The net result is that if you try to copy one of these programs using the normal CIO routine, the copy won't work. The only way you can do it is to get down to the SIO level. If this sounds like Greek to you, don't worry, you are not alone.

The real gripe I have with altered-sector-length "copy protection" is that the programs are almost impossible to upload to disk. The file structure in a disk file is locked into the system's standard format, since the disk controller is isolated from user intervention.

In upcoming issues I will discuss each of the major file formats for both BASIC and BOOT files and try to explain some of the complexities of cassette file structures. As I go along I will toss in a routine here and there I have found useful in either analyzing, copying, or uploading the various kinds of files.

If I don't cover the particular area that you need to know about, then write to me about your question and I either will answer it with a column devoted to that specific topic or give you a brief answer in Tangle Angles.


Tangle Angles

My recorder will playback its own tapes; however, it won't playback those of my friends. I was told that this is a problem due to different head alignments. Is there a kit that I could use to align the head myself? Would it be possible to use a better quality recorder, such as Sony or Panasonic, and if so, what filters would I need?

Dr. John G. Golden
Dayton, OH

There is no commercial head alignment kit for the Atari 410 Recorder, but you can easily make your own. The details are too lengthy to go into here, so I will use my next column to answer you in depth. In the meantime, don't worry about it since the proper head alignment won't cure your problems anyway.

In one of my recent columns (see ANTIC #5) I explained why you have to use the Atari recorder with your computer and cannot use any other commercial recorder.


I am presently on my third cassette recorder and, at best, I am only able to save fifty percent of the programs. The computer checks out okay. I have meticulously marked the beginning, used an "L" Print before "C" Saving, and still lost programs.

W.P. Keryluk
Portage la Prairie,
Canada

The problem sounds like it stems from a bad POKEY chip and although you state, "the computer checks out okay," I have my doubts. Most of the people I know who have had recorder after recorder malfunction have solved the problem by having the POKEY chip replaced. Take the computer to a certified service center and specifically ask them to check the POKEY chip.


Many of us are stuck with multi-stage boot cassettes that we can't convert; also, they take so long to load. I have three such cassettes, and since getting my disk drive, I need a program to load them on disk. In addition, how does machine code do away with the lead tone usually required on cassette?

Lawrence Blouir

The first problem we have to handle is terminology. I suspect that what you are calling a "multi-stage" load program is what I refer to as a "singlestage, multi-file" (SSMF) program. See my article in this issue of ANTIC for a detailed explanation of the terms.

If you are trying to upload a "multistage" file or an unprotected SSMF program, then something like Vervan's CASDIS program will do the trick. However, if what you are hoping to upload is a protected SSMF program, then you are probably out of luck.

There is no way I know of to simply transfer such programs to disk since the record length (sector length) of a disk file is not alterable by the user.

Your other question has a better answer. The leader tones on a cassette are only used by the operating system to establish the input baud rate for that cassette file. Once such a file has been loaded into memory, the write-to-disk routines dump the data (program) to a disk file without bothering to send out the unnecessary baud rate tones.


The counter on my recorder has broken and I have no way of knowing where a program starts. Can I use a POKE to identify the start points of any program on a tape? Is there a book with technical aspects defined?

Mike Evans
Ontario, Canada

There are two simple ways to find a file on a cassette. The first is to play the tape through a normal recorder (not the 410) until you can hear the sound of the program, then rewind the tape to just before the program, and then transfer the tape to the 410 Recorder. This is awkward at best.

I usually use the PACTL trick. Poking the PACTL location 54018 with a value of 52 will turn the 410 motor on. Normally this will allow you to listen only to the audio channel on the tape. However, if you turn the volume on your TV way up, then you can hear the actual start of the program on the other channel.

Note that you should POKE 54018, 60 to turn the motor line back off.

If you are interested in the more technical aspects of the cassette recorder, then I would suggest that you read De Re Atari and the Technical User Notes both of which are available from Atari.


You requested any sources for ATARI parts. Pass the word to your readers that we have a very good inventory of parts. The number of each part on hand is limited and we must limit the numbers sold from our service department inventory. If any of the ANTIC readers need a part, have them call or write:

VIDEO COMPUTER WORLD Inc.
2223 Woodville Road
Oregon, Ohio 43616
(419) 691-7282

Robert Rusch
Vice President

This is the first letter from anyone other than a consumer. If you readers have any othergood sources for parts, then let me know and I will help to spread the good word.


It is extremely difficult to put "unprotected" cassettes into my 410. "Protected" tapes, with the tab punched out, are okay but I need to use a thin knife to push the tape back before it will clear the read / write head and the attached tape guide. My children have broken it twice, by pushing a tape in and pushing the lid shut without using extreme caution.

Gerry Wick
Los Angeles, CA

Your problem is not a common one. The recorder should accept both "virgin" tapes as well as those with the write-protect tab punched. If you are having a problem physically loading either type of tape, then the recorder is defective and should be replaced or sent to a repair center.


The head alignment of our first 410 did not hold. We obtained a replacement under warranty. We wonder if current problems are due to a "floppy" head.

Tapes we have CSAVED on our 800 often will not CLOAD on our 800, but will on another 800.

Sometimes commercial tapes will not CLOAD.

A tape which was LIST "C:" 'd will not load.

The error is usually 138 or 143.

Sometimes by varying the starting point on the tape, it will load. Where one starts the tape is very critical. Plus or minus on the counter of one unit is crucial. The clatter sound of the loading, and the loading, is highly dependent on the point at which the tape is started. This is in spite of the fact that we are supposed to have the model in which one needn't wind the tape past the leader.

Robert Orr
Wilmington, DE

Head alignment should be checked after every 100 hours of use. Alignment should not vary much during that interval. The 4101 am using now has over 200 hours of use on it and the heads are still within the factory specs. A recorder with a floppy' head is defective.

All of your loading problems sound like you have a problem with the active filters. Try the 'reliability fix' I suggested in my article and you should notice a marked improvement.