Classic Computer Magazine Archive ANTIC VOL. 3, NO. 3 / JULY 1984

assembly language

CASSETTE LOOKALIKE YOUR DISK DRIVE

Test cassette software on your disk drive

by ERIC VERHEIDEN

SYNOPSIS

This program will allow you to make your disk drive work like a cassette. It requires BASIC and at least 16K RAM, and runs on all Atari computers.

If you're a BASIC programmer, you're probably aware that the disk operating system (DOS) occupies more than 5600 bytes of RAM that would otherwise be available for your program. If you use cassettes for storage, you can access these bytes, but cassette storage is slow and unreliable. SEQDOS lets you use this extra memory without having to sacrifice the speed of a disk drive. You also might want to simulate the cassette environment to develop programs for cassette use.

Type in the BASIC program, Listing 1, and test it with TYPO. Listing 2 is the machine-language segment of SEQDOS in assembly-language format. This is presented for your information, you don't need to type in this listing to use SEQDOS. Now RUN the program. After a delay, the message "SEQDOS INIT COMPLETE" will appear.

You now have several choices. To create a SEQDOS disk, insert a blank disk into drive 1 and press [RETURN]. This will format the disk and write SEQDOS to its first two sectors as a boot file. This is a "SEQDOS disk." Otherwise, press [BREAK], and you'll be able to read and write to existing SEQDOS disks (see below). You also can exit to DOS and write SEQDOS to a DOS disk as a binary AUTORUN.SYS file. When this disk is booted, you can transfer files between DOS and QDOS.

To create the AUTORUN.SYS file, type DOS [RETURN] from BASIC. When the DOS menu appears, type [K] [RETURN], and then:

AUTORUN.SYS,600,6FF,609

The instructions above describe two methods for creating SEQDOS. If you use the AUTORUN.SYS technique and boot that disk, SEQDOS will load automatically after DOS and you can transfer files between the two. If you boot from a SEQDOS disk, you won't be able to use DOS. Once SEQDOS is in effect, you should use normal cassette commands (e.g., CSAVE, CLOAD, etc.) to store to and and load begins with the first file. and load from a SEQDOS disk!

There is, however, one important restriction: Never use SEQDOS to write files to a DOS disk, or you'll lose files on that disk. The reverse is also true: Never write DOS files to a SEQDOS- formatted disk. If you try you'll prob- ably get an error message, but, again, you ma~ lose some of your files.

COMMAND YOUR DISK

To write files to a SEQDOS disk, insert it into drive 1 and write to it in the desired format using device "C:", as with the cassette recorder. For instance, in addition to the commands mentioned above you can use LIST"C:", SAVE"C:" or OPEN#3,8,0,"C:" followed by a series of PUTs and a final CLOSE #3. Files are written sequentially as with a cassette, and must be read back in the same order using the proper format for each file. The first write operation following a series of reads "rewinds" the disk, and starts at the beginning again.

Files can be read with the usual cassette commands, such as CLOAD and ENTER"C:". You must read the file in the same format in which you wrote it. That is, if you use CSAVE, you must use CLOAD to read the file; if you use LIST "C:" you must use ENTER"C:". The first read operation that follows one or more write operations also "rewinds" the disk and begins with the first file.

To properly set up input for a subsequent file, each file should be read to its end. To keep the program short (it just fits into Page Six), its error checking is minimal. Any sort of error, including end-of-file, generates ERROR 136. A full SEQDOS disk holds slightly less than 90,000 bytes.

If you load SEQDOS from a SEQDOS disk, it will reinitialize itself if you press [RESET]. If it is loaded as an AUTORUN.SYS file, however, the normal cassette handlers will he restored if you press [RESET]. To restore SEQDOS, execute the following from BASIC: POKE 2,9:POKE 3,6:POKE 9,3

TECHNICAL INFORMATION

SEQDOS fits into a single page of memory, Page Six. Moreover, nonessential information is written at the end of each sector (see locations $67D-$67F and $6FD-$6FF in the assembled source code). As a result, the program writes itself to disk with a little tampering, places flags in the indicated bytes, and runs properly. The format routine is left out when SEQDOS writes itself to disk as the boot file.

The file format produced by SEQDOS is similar to that of DOS. The last three bytes of each sector contain sector-link information and a sector-byte count. The sector link for the last sector of each file is zero. Each file occupies a contiguous block of sectors, and immediately follows the preceding file. SEQDOS makes no provision for a directory.

Eric Verheiden is the author of Vervan's utility programs (CASDUP, CASDIS, FULMAP, DISASM, DISDUP, AND DOWNLD) and of the forthcoming Sectrets of Atari I/O (IJG). He holds a Ph.D. from California Institute of Technology and works for an aerospace firm in Southern California.

Listing 1: SEQDOS.BAS Download

Listing 2: SEQDOS.ASM Download / View