Locations zero to 127 ($0 to $7F) are reserved as the OS page zero, while 128 to 255 ($80 to $FF) are the BASIC and the user zero page RAM. Locations zero to 1792 ($0 to $700) are all used as the OS and (if the cartridge is present) 8K BASIC RAM (except page six). Locations zero to 8191 ($0) to $1FF) are the minimum required for operation (8K).
Locations two through seven are not cleared on any start operation.
| DECIMAL | HEX | LABEL |
| 0,1 | 0,1 | LINZBS | |||||||||||||||||||||||||||||||||||||||||||||
| LINBUG RAM, replaced by the monitor RAM. See the OS Listing, page 31. It seems to be used to store the VBLANK timer value. One user application I've seen for location zero is in a metronome program in De Re Atari. Also used in cross-assembling the Atari OS. | |||||||||||||||||||||||||||||||||||||||||||||||
| 2,3 | 2,3 | CASINI | |||||||||||||||||||||||||||||||||||||||||||||
| Cassette initialization vector: JSR through here if the cassette boot was successful. This address is extracted from the first six bytes of a cassette boot file. The first byte is ignored. The second contains the number of records, the third and fourth contain the low and high bytes of the load address, and the fifth and sixth contain the low and high bytes of the initialization address. Control upon loading jumps to the load address plus six for a multi-stage load and through CASINI for initialization. JSR through DOSVEC (10 and 11; $A, $B) to transfer control to the application. | |||||||||||||||||||||||||||||||||||||||||||||||
| 4,5 | 4,5 | RAMLO | |||||||||||||||||||||||||||||||||||||||||||||
| RAM pointer for the memory test used on powerup. Also used to store the disk boot address -- normally 1798 ($706) -- for the boot continuation routine. | |||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 6 | TRAMSZ | |||||||||||||||||||||||||||||||||||||||||||||
| Temporary Register for RAM size; used during powerup sequence to test RAM availability. This value is then moved to RAMTOP, location 106 ($6A). Reads one when BASIC or the A (left) cartridge is plugged in. | |||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 7 | TSTDAT | |||||||||||||||||||||||||||||||||||||||||||||
| RAM test data register. Reads one when the B or the right cartridge is inserted.
RAMLO, TRAMSZ and TSTDAT are all used in testing the RAM size on powerup. On DOS boot, RAMLO and TRAMSZ also act as temporary storage for the boot continuation address. TRAMSZ and TSTDAT are used later to flag whether or not the A (left) and/or B (right) cartridges, respectively, are plugged in (non-zero equals cartridge plugged in) and whether the disk is to be booted. |
|||||||||||||||||||||||||||||||||||||||||||||||
| Locations eight through 15 ($8 - $F) are cleared on coldstart only. | |||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 8 | WARMST | |||||||||||||||||||||||||||||||||||||||||||||
| Warmstart flag. If the location reads zero, then it is in the middle of powerup; 255 is the normal RESET stauts. Warmstart is similar to pressing REST, so should not wipe out memory, variables, or programs. WARMST is initialized to zero and will not change values unless POKEd or until the first time the REST button is pressed. It will then read 255 ($FF).
Warmstart normally vectors to location 58484 ($E474). WARMST is checked by the NMI status register at 54287 ($D40F) when RESET is pressed to see whether or not to re-initialize the software or to re-boot the disk. |
|||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 9 | BOOT? | |||||||||||||||||||||||||||||||||||||||||||||
| Boot flag success indicator. A value of 255 in this location will cause the system to lockup if RESET is pressed. If BOOT? reads one, then the disk boot was successful; if it reads two, then the cassette boot was successful. If it reads zero, then neither peripheral was booted.
If it is set to two, then the cassette vector at locations two and three will be used on RESET. Set to one, it will use the DOS vector at 10 and 11 ($A and $B). Coldstart attempts both a cassette and a disk boot and flags this location with the success or failure of the boots. BOOT? is checked during both disk and cassette boot. |
|||||||||||||||||||||||||||||||||||||||||||||||
| 10,11 | 10,11 | DOSVEC | |||||||||||||||||||||||||||||||||||||||||||||
| Start vector for disk (or non-cartridge) software. This is the address BASIC jumps to when you call up DOS. Can be set by user to point to your own routine, but RESET will return DOSVEC to the original address. To prevent this, POKE 5446 with the LSB and 5450 with the MSB of your vector address and re-save DOS using the WRITE DOS FILES option in the menu. Locations 10 and 11 are usually loaded with 159 and 23 ($9F and $17), respectively. This allows the DUP.SYS section of DOS to be loaded when called. It is initially set to blackboard mode vector (58481; $E471 -- called by typing "BYE" or "B." from BASIC); it will also vector to the cassette run address if no DOS vector is loaded in. If you create an AUTORUN.SYS file that doesn't end with an RTS instruction, you should set BOOT? to one and 580 ($244) to zero. | |||||||||||||||||||||||||||||||||||||||||||||||
| 12,13 | C,D | DOSINI | |||||||||||||||||||||||||||||||||||||||||||||
| Initialization address for the disk boot. Also used to store the cassette-boot RUN address, which is then moved to CASINI (2,3). When you powerup without either the disk or an autoboot cassette tape, DOSINI will read zero in both locations. | |||||||||||||||||||||||||||||||||||||||||||||||
| 14,15 | E,F | APPMHI | |||||||||||||||||||||||||||||||||||||||||||||
| Applications memory high limit and pointer to the end of your BASIC program, used by both the OS and BASIC. It contains the lowest address you can use to set up a screen and Display List (which is also the highest address usable for programs and data below which the display RAM may not be placed). The screen handler will not OPEN the "S:" device if it would extend the screen RAM or the Display List below this address; memory above this address may be used for the screen display and other data (PM graphics, etc.).
If an attempted screen mode change would extend the screen memory below APPMHI, then the screen is set up for GRAPHICS mode zero; MEMTOP (locations 741, 742; $2E5, $2E6) is updated and an error is returned to the user. Otherwise, the memory is not too small for the screen editor; the mode change will take effect and MEMTOP will be updated. This is one of five locations used by the OS to keep track of the user and display memory. Initialized to zero by rhe OS at powerup. Remember, you cannot set up a screen display below the location specified here. If you use the area below the Display List for your character sets, PM grqphics or whatever, be sure to set APPMHI above the last address used so that the screen ot the DL data will not descend and destroy your own data. See RAMTOP location 106 ($6A), MEMTOP at 741, 742 ($2E5, $2E6), PMBASE at 54279 ($D407) and CHBASE at 54281 ($D409) for more information. |
|||||||||||||||||||||||||||||||||||||||||||||||
| Locations 16 through 127 ($10 - $7F) are cleared on either cold- or warmstart. | |||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 10 | POKMSK | |||||||||||||||||||||||||||||||||||||||||||||
| POKEY interrupts: the IRQ service uses and alters this location. Shadow for 53774 ($D20E). POKE with 112 ($70; also POKE this same value into 53774) to disable the BREAK key. If the following bits are set (to one), then these interrupts are enabled (bit decimal values are in parentheses):
Timer interrupt enable means the associated AUDF registers are used as timers and will generate an interrupt request when they have counted down to zero. See locations 528 to 535 ($210 to $217) and the POKEY chip from locations 53760 ($D200) on, for a full explanation. 192 ($C0) is the default on powerup.
You can also disable the BREAK key by POKEing here with 64 ($40; or any number less than 128; $80) and also in location 53774. The problem with simple POKEs is that the BREAK key is re-enabled when RESET is pressed and by the first PRINT statement that displays to the screen, or any OPEN statement that addresses the screen (S: or E:), or the first PRINT statement after such an OPEN and any GRAPHICS command. In order to continually disable the BREAK key if such commands are being used, it's best to use a subroutine that checks the enable bits frequently during input and output operations, and POKEs a value less than 128 into the proper locations, such as:
|
|||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 11 | BRKKEY | |||||||||||||||||||||||||||||||||||||||||||||
| Zero means the BREAK key is pressed; any other number means it's not. A BREAK during I/O returns 128 ($80). Monitored by both keyboard, display, cassette and screen handlers. See location 16 ($A) for hints on disabling the BREAK key. The latest editions of OS provide for a proper vector for BREAK interrupts. The BREAK key abort status code is stored in STATUS (48; $30). It is also checked during all I/O and scroll/draw routines. During the keyboard handler routine, the status code is stored in DSTAT (76; $4C). BRKKEY is turned off at powerup. BREAK key abort status is flagged by setting BIT 7 of 53774 ($D20E). See the note on the BREAK key vector, above. | |||||||||||||||||||||||||||||||||||||||||||||||
| 18,19,20 | 12,13,14 | RTCLOK | |||||||||||||||||||||||||||||||||||||||||||||
| Internal realtime clock. Location 20 increments every stage one VBLANK interrupt (1/60 second = one jiffy) until it reaches 255 ($FF); then location 19 is incremented by one and 20 is reset to zero (every 4.27 seconds). When location 19 reaches 255, it and 20 are reset to zero and location 18 is incremented by one (every 18.2 minutes or 65536 TV frames). To use these locations as a timer of seconds, try:
TIME = INT((PEEK(18) * 65536 + PEEK(19) * 256 + PEEK(20))/60) To see the count in jiffies, eliminate the "/60" at the end. To see the count in minutes, change "/60" to "/360." The maximum vaue of the RT clock is 16,777,215. When it reaches this value, it will be reset to zero on the next VBLANK increment. This value is the result of cubing 256 (i.e., 256 * 256 * 256), the maximum number of increments in each clock register. The RT clock is always updated every VBLANK regardless of the time-critical nature of the code being processed. A jiffy is actually a long time to the computer. It can perform upwards of 8000 machine cycles in that time. Think of what can be done in the VBLANK interval (one jiffy). In human terms, a jiffy can be upwards of 20 minutes, as witnessed in the phrase "I'll be ready in a jiffy." Compare this to the oft-quoted phrase, "I'll be there in a minute," used by intent programmers to describe a time frame upwards of one hour. Users can POKE these clock registers with suitable values for their own use. The realtime clock is always updated during the VBLANK interval. Some of the other timer registers (locations 536 to 544; $218 to $220) are not always updated when the OS is executing time critical code.
Here's one way to use the realtime clock for a delay timer:
|
|||||||||||||||||||||||||||||||||||||||||||||||
| 21,22 | 15,16 | BUFADR | |||||||||||||||||||||||||||||||||||||||||||||
| Indirect buffer address register (page zero). Temporary pointer to the current disk buffer. | |||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 17 | ICCOMT | |||||||||||||||||||||||||||||||||||||||||||||
| Command for CIO vector. Stores the CIO command; used to find the offset in the command table for the correct vector to the handler routine. | |||||||||||||||||||||||||||||||||||||||||||||||
| 24,25 | 18,19 | DSKFMS | |||||||||||||||||||||||||||||||||||||||||||||
| Disk file manager pointer. Called JMPTBL by DOS; used as vector to FMS. | |||||||||||||||||||||||||||||||||||||||||||||||
| 26,27 | 1A,1B | DSKUTL | |||||||||||||||||||||||||||||||||||||||||||||
| The disk utilities pointer. Called BUFADR by DOS, it points to the area saved for a buffer for the utilities package (data buffer; DBUF) or fot the program area (MEMLO; 743, 744; $2E7, $2E8). | |||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 1C | PTIMOT | |||||||||||||||||||||||||||||||||||||||||||||
| Printer timeout, called every printer status request. Initialized to 30, which represents 32 seconds (the value is 64 seconds per 60 increments in this register); typical timeout for the Atari 825 printer is five seconds. The value is set by your printer handler software. It is updated after each printer status request operation. It gets the specific timeout status from location 748 ($2EC), which is loaded there by SIO.
The new "B" type OS ROMs have apparently solved the problem of timeout that haunted the "A" ROMs; you saw it when the printer or disk drive periodically went to sleep (timed out) for a few seconds, causing severe anxiety attacks in the owners who thought their Ataris had just mysteriously died. This is compounded when one removes a disk from the drive, believing the I/O process to be finished -- only to have the drive start up again after the timeout and trying to write to or read from a nonexistent disk. Usually both the system and the user crash simultaneously at this point. See the appendix for more information on the new ROMs. |
|||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 1D | PBPNT | |||||||||||||||||||||||||||||||||||||||||||||
| Print buffer pointer; points to the current position (byte) in the print buffer. Ranges from zero to the value in location 30. | |||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 1E | PBUFSZ | |||||||||||||||||||||||||||||||||||||||||||||
| Print buffer size of printer record for current mode. Normal buffer size and line size equals 40 bytes; double-width print equals 20 bytes (most printers use their own control codes for expanded print); sideways printing equals 29 bytes (Atari 820 printer only). Printer status request equals four. PBUFSZ is initialized to 40. The printer handler checks to see if the same value is in PBPNT and, if so, sends the contents of the buffer to the printer. | |||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 1F | PTEMP | |||||||||||||||||||||||||||||||||||||||||||||
| Temporary register used by the printer handler for the value of the character being output to the printer. | |||||||||||||||||||||||||||||||||||||||||||||||
| Locations 32 to 47 ($20 to $2F) are the ZIOCB: Page zero Input-Output Control Block. They use the same structure as the IOCB's at locations 832 to 959 ($340 to $3BF). The ZIOCB is used to communicate I/O control data between CIO and the device handlers. When a CIO operation is initiated, the information stored in the IOCB channel is moved here for use by the CIO routines. When the operation is finished, the updated information is returned to the user area. | |||
| 32 | 20 | ICHIDZ | |
| Handler index number. Set by the OS as an index to the device name table for the currently open file. If no file is open on this IOCB (IOCB free), then this register is set to 255 ($FF). | |||
| 33 | 21 | ICDNOZ | |
| Device number or drive number. Called MAXDEV by DOS to indicate the maximum number of devices Initialized to one. | |||
| 34 | 22 | ICCOMZ | |
| Command code byte set by the user to define how the rest of the IOCB is formatted, and what I/O action is to be performed. | |||
| 35 | 23 | ICSTAZ | |
| Status of the last IOCB action returned by the device, set by the OS. May or may not be the same status returned by the STATUS command. | |||
| 36,37 | 24,25 | ICBALZ/HZ | |
| Buffer address for data transfer or the address of the file name for commands such as OPEN, STATUS, etc. | |||
| 38,39 | 26,27 | ICPTLZ/HZ | |
| Put byte routine address set by the OS. It is the address minus one byte of the device's "put one byte" routine. It points to CIO's "IOCB not OPEN" on a CLOSE statement. | |||
| 40,41 | 28,29 | ICBLIZ/HZ | |
| Buffer length byte count used for PUT and GET operations; decreased by one for each byte transferred. | |||
| 42 | 2A | ICAZ1Z | |
| Auxiliary information first byte used in OPEN to specify the type of file access needed. | |||
| 43 | 2B | ICAX2Z | |
| CIO working variables, also used by some serial port functions. Auxiliary information second byte. | |||
| 44,45 | 2C,2D | ICAX3Z/4Z | |
| Used by BASIC NOTE and POINT commands for the transfer of disk sector numbers. These next four bytes to location 47 are also labelled as: ICSPRZ and are defined as spare bytes for local CIO use. | |||
| 46 | 2E | ICAX5Z | |
| The byte being accessed within the sector noted in locations 44 and 45. It is also used for the IOCB Number multiplied by 16. Each IOCB block is 16 bytes long. Other sources indicate that the 6502 X register also contains this information | |||
| 47 | 2F | ICAX6Z | |
| Spare byte. Also labelled CIOCHR, it is the temporary storage for the character byte in the current PUT operation. | |||
| 48 | 30 | STATUS | |
| Internal status storage. The SIO routines in ROM use this byte to store the status of the current SIO operation. See page 166 of the OS User's Manual for status values. STATUS uses location 793 ($319) as temporary storage. STSTUS is also used as a storage register for the timeout, BREAK abort and error values during SIO routines. | |||