Classic Computer Magazine Archive COMPUTE! ISSUE 95 / APRIL 1988 / PAGE 73

Tokenized And Untokenized Disk Files

A Tutorial

Eugene Koh

If you're a programmer, it's important to understand the two different methods that Atari BASIC uses to store disk files. The tutorial ends with a clever program that autoruns files saved with the LIST command. For the Atari 400, 800, XL, and XE with disk drive.

The Atari Input/Output (I/O) system is versatile. You can store any information to any device. For instance, you can send a program or data to a printer, modem, disk drive, cassette drive, or any other device that you may have connected to your system.

In BASIC, LIST is the command you use to send your program. You can send it to your disk drive with LIST "D:FILE.BAS", to DOS 2.5's ramdisk with LIST"D8:FILE.BAS", to a printer with LIST"P:" or to cassette with LIST "C:"

The LIST command's mirror image is ENTER. This command is used to enter a program from any device. An example is ENTER "D:FILE.BAS". Keep in mind that ENTER does not clear memory before bringing in the program, so it's a good idea to type NEW before using the ENTER command (unless you want to merge two programs).


LIST and ENTER work with straight ASCII text. For this reason, you can use LIST to save a program to disk, use a word processor to edit it, and then use ENTER to load the program back into memory.

The problem with this approach is that LIST and ENTER are very slow. Atari BASIC tokenizes programs. For instance, the PRINT command is saved as a single byte. LIST and ENTER must translate between ASCII and tokenized programs.

Tokenization is designed to save memory and time. Two commands—SAVE and LOAD—work with tokenized programs only. SAVE"D:FILE.BAS" is similar to LIST"D:FILE.BAS", and LOAD"D:FILE.BAS" is similar to ENTER"D:FILE.BAS". When you use SAVE and LOAD, you'll notice that they're much faster than LIST and ENTER. If you get a directory, you'll also notice that most LISTed programs are larger than their SAVEd counterparts.

Because SAVE and LOAD work with tokenized programs, they are normally used only for disk files (CSAVE and CLOAD are used for cassette).


Normally, you must type RUN to start a BASIC program. However, you can use RUN"D:FILE.BAS" to load and run a program. RUN used with this syntax works only with tokenized files (those saved with the SAVE command).

The accompanying program can be used to make LISTed files auto-run. Type it in and save it to disk with the name "AMAKER.BAS".

When you're ready to make a file autorun, load and run AMAKER.BAS. You'll be asked for the filename of the program you want to alter. Make sure that this program is indeed a LISTed BASIC program. AMAKER will append several bytes to the end of the file that will make it autorun when entered. (The bytes are 82, 85, 78, 155. These are the ASCII values for RUN, followed by a RETURN. When the file is entered, the RUN command will be treated as a direct-mode command.)

When you're ready to try the new autorun file, type NEW and then ENTER "D:filename". The program should load and run.


For instructions on entering this program, please refer to "COMPUTE!'s Guide to Typing In Programs" elsewhere in this issue.