There are three ways which programs may be booted (loaded automatically upon power-up):
From the disk drive
From the cassette recorder
From a ROM cartridge
The disk drive is the primary source for programs (other than the BASIC interpreter in the computer ROM). A program booted from disk must be a machine language program. Secondly, the program is arranged on disk in a different manner from the DOS files.
When the computer is first turned on, it will attempt to read a program starting at sector one in disk drive one. The exceptions are, if a cartridge prevents the disk boot process or the [START] key is pressed. The program is expected to use all 128 bytes of each sector.
A disk booted program begins at sector one on the disk and continues in sequence. The first six bytes of the first sector contain program information. The rest of the bytes contain the program itself.
Disk boot program header 1st byte $00 flags, stored in DFLAGS [$0240] $xx number of sectors used by program $xx address to start load $xx $xx initialization address 6th byte $xx 7th byte $xx start of program
The flags byte is usually unused and should be zero.
The load address is stored in BOOTAD [$0242,2 (578)].
The initialization address is stored in DOSINI [$000C,2 (12)].
After the program is completely loaded the computer will JSR to the address stored in DOSINI for initialization. It will then jump to the address stored in DOSVEC to run the program.
The initialization part of the program should set the bottom-of-free-RAM pointer, MEMLO [$02E7,2 (743)], to point to the end of the program + 1. This will protect the program from the computer and other programs. The top-of-user-RAM pointer, APPMHI [$000E,2 (14)], is also usually set to point to the same address. This will protect the program from the video hardware. It must also set DOSVEC [$000A,2 (10)] to actually point to the run address of the program. The initialization should of course end with and RTS. With DOSINI and DOSVEC properly set, the program will restart up pressing the [SYSTEM RESET] key.
Rmember that the load address of the program should be six bytes before where you want the program to reside in memory. The six byte header will load at the specified start address followed by the program.
The cassette boot process is nearly identical to the disk boot process. The processes are so similar that cassette boot programs can usually be transferred directly to disk and vice-versa. The two differences are:
The cassette is booted instead of the disk if the [START] key is pressed when the power is turned on.
A bug in early operating systems requires the booted program to turn off the cassette motor with the following command.
LDA #$3C STA PACTL [$D302]
The Atari 800 has two cartridge slots. All other models have only one. The second cartridge slot, slot B on the 800, resides from $8000 to $9FFF. The first slot, slot A, resides from $A000 to BFFF. If a cartridge is inserted in a slot it will disable any RAM in the same area.
Slot A, which is present in all models, can reside at the entire 16K used by both cartridges in the 800 ($8000 to $BFFF).
Cartridges use the last six bytes for boot information. In cartridge A these bytes are from $BFFA to $BFFF. In cartridge B they are from $9FFA to 9FFF.
last six bytes of a cartridge $9FFA or $BFFA xx start address xx 00 xx flag byte xx init address $9FFF or $BFFF xx Flag byte bit 0 1 = allow disk boot bit 2 0 = do not start cartridge after init bit 7 1 = cartridge takes control before OS is initialized
The initialization process for the cartridge should be similar to that for disk and cassette. A minimum of an RTS instruction is required.
The third byte of the cartridge tailer is used by the OS to check for the presence of a cartridge. This byte must be zero.
A 16K cartridge will use both cartridge areas and the cartridge B tailer area can be used for program code.
Most cartridges consist of two ROM chips on a single circuit board. Moreover, both chip sockets have identical pin assignments. In other words, the chips can be switched to opposite sockets and the cartridge will still work. The difference is in the chips themselves. On one chip, the A12 pin acts as an active-low chip select. On the other the A12 pin acts as an active-high chip select. Therefore the state of the A12 pin selects between the two chips.
Cartridge slot pin assignments BACK 111111 543210987654321 --------------- --------------- SRPNMLKJHFEDCBA FRONT 1 1 = 16K A A13 (16K only) 2 A3 B GND 3 A2 C A4 4 A1 D A5 5 A0 E A6 6 D4 F A7 7 D5 H A8 8 D8 J A9 __ 9 D1 K A12 (CS)/(CS) 10 D0 L D3 11 D6 __ M D7 12 (CS) N A11 13 +Vcc P A10 14 +Vcc R NC 15 NC S NC
The BASIC interpreter resides in the memory used by cartridge A. In 400, 800 and 1200XL models, a BASIC cartridge is required to run BASIC programs. On other XL and XE models, inserting a cartridge into the slot or pressing the [OPTION] key upon power-up will disable the internal BASIC ROM. If BASIC is disabled without inserting another cartridge, the area from $A000 to $BFFF will contain RAM.
Useful data base variables and OS equates APPMHI $000E,2 (14): low limit of screen region DOSVEC $000A,2 (10): run and program reset vector DOSINI $000C,2 (12): init and reset init CARTB $8000 (32768): start of cartridge B CARTA $A000 (40960): start of cartridge A PACTL $D302 (54018): port A control register Bit 3 controls the cassette motor