Autoboot for BASIC
Load-and-go cassettes or disks
by Eric Verheiden
These programs show you how to turn your tokenized (SAVE'd) ATARI BASIC program into an autobooting cassette or disk. The program will load-and-go automatically, just like machine language programs. You will require the ATARI BASIC and Assembler Editor cartridges along with your disk drive or cassette recorder.
The system works by loading the BASIC token file to a suitable address with a program used with the Assembler Editor cartridge, and inserting a short header program in front of the token file. This, upon loading, sets up the pointers required by BASIC and then jumps into the BASIC cartridge at the address of the RUN routine. A suitable return address is provided by pushing values onto the stack. A third program is then used to dump the header and token files onto cassette or non-DOS disk.
The program relies upon the ATARI BASIC structure of variable subroutine calls that are based on command token value (for a discussion of the structure of ATARI BASIC, see De Re ATARI). The subroutine addresses (-1) for operator tokens are stored in a table starting at address $AA00 in MSB, LSB format. After the RUN command, most Page Zero values used by BASIC are reinitialized. Some significant exceptions are the BASIC pointers (stored from $80 to $91), the break key flag (set at $11) and the spacing for a ',' in a BASIC PRINT statement (stored at $C9). These values are all set by the header program before jumping into the BASIC cartridge. The program itself resides in the tokenizing area set aside by BASIC and is overwritten after execution.
This system is somewhat different from other load-and-go systems in that it does not use handlers and separate header or AUTORUN.SYS files to boot the program. As such, the loading is faster (particularly for disk) and it allows the convenience of dealing with a single monolithic file. For disk programs, there is 5K additional memory space because DOS is not used.
The load/dump routines are somewhat unpolished, but have the advantage of fitting into a single page of memory. To load a DOS or cassette BASIC file, first boot up the Assembler Editor cartridge (with DOS, if applicable). The load/dump routine may now be LOADed (from disk) or ENTERed, as applicable. See your Assembler Editor manual for details. Note that the PST value is arbitrary; it must in any case be located beyond the source text file, if any (allow a minimum of $200 bytes from LOMEM in any event). After the routine is LOADed into memory at Page Six (or before the source is assembled), the name of the file to be loaded must be assembled into location $670. If the program is left as listed, loading will take place off cassette.
To overwrite the "C:" filename, assemble a short program of the form:
1000 *= $670 1010 .BYTE "D:MYPGM.BAS",$9B 1020 .END
Next, LOAD or ENTER the header program and assemble, if appropriate. If you are ENTERing a new program, be sure to type NEW first. PST should match for the load / dump routine and the header routine.
Now you are ready to load the BASIC file. This is accomplished by setting up the appropriate disk or tape and typing in:
Finally, you are ready to write the program out to a boot disk or tape. If writing to cassette, erasing is suggested before writing. Also, the loader program must be reset (to "C:",$9B) at location $670 if the BASIC program was loaded from a disk file. Type in:
For disk, make sure the disk in drive 1 has no useful files (like your BASIC source, for instance). To format the disk before writing, use:
To write without formatting, use: