Classic Computer Magazine Archive Article from Compute! magazine

Atari Amnesia
I recently bought an Atari 800XL which claims to have 64K, but which seems to have only 48K user memory. The other 16K supposedly is available only with certain software programs. Which ones? I am also having trouble with the memory test. The other day I bought a game requiring at least 48K. I tried to load it on my 1050 disk drive, but the picture is distorted. I tried again, but got the same results. So I tried the memory test by holding down the OPTION key while turning on the computer. The ROM checks green. So does all my RAM, up to 44K. I checked it again, still 44K. What do I do?
Steve Whitlow

It sounds like your computer is behaving normally, but the software may not be compatible with the 800XL. Check with the dealer who sold you the program or with the software publisher. Some programs designed for the older Atari computers have trouble running on the newer XL machines because of changes in the computer's operating system. The fault still lies with the software, though, because from the beginning Atari made it clear that programmers should follow certain rules to insure compatibility with future models.
    One solution might be to obtain a translation disk which, in effect, temporarily converts your XL into an older-model Atari 800. The disks are available from Atari for a nominal fee and from some independent companies.
    The memory discrepancies you discovered are unrelated to the software problem. The Atari 800XL does indeed have 64K of Random Access Memory (RAM), but as with the Commodore 64 and 64K Apple IIe, not all of this RAM is immediately accessible. All these computers use 6502-family chips for their Central Processing Units (CPUs). The 6502 is limited to accessing, or addressing, a total of 64K of memory at a time. Part of this 64K must be allocated for internal programs necessary to operate the computer. This includes the operating system and BASIC language.
    The Atari operating system, stored in Read Only Memory (ROM), requires 10K of space. Additional ROM space is used for the international character set and self-test routines. BASIC, when selected, uses a little over 8K of space. The input/output chips need 2K of address space, since they are controlled as if they were memory locations. This leaves less than 40K of RAM when using BASIC. Roughly the same amount of memory is available for BASIC on a Commodore 64 or 64K Apple IIe.
    If you switch off BASIC in your 800XL (equivalent to unplugging the BASIC cartridge on the older Atari 400, 800, and 1200XL computers), 48K of RAM is directly addressable. To switch off BASIC, hold down the OPTION button when powering up. Don't think you're being misled by the 64K RAM claim; it's there, but it takes some special programming to access it. Not many commercial programs take advantage of this extra memory, though, because they would not be compatible with the large number of older 800s still in use.
    If you have some programming experience, you can reach this additional memory with your own programs. The PIA chip in your Atari, used for the two joystick ports, also helps control memory mapping and other special XL functions. These functions are controlled with memory location 54017 (PORTB, $D301), formerly used on the 400/800 to read joystick ports 3 and 4, which are omitted on the XL models. (Incidentally, if you try to read the shadow registers for joysticks 3 and 4, or use STICK(2) or STICK(3) in BASIC, the values returned will be those of joystick ports 1 and 2.) The eight bits at $D301 control eight functions (see chart).

  Bit
Position
    Bit
   Value
  Decimal
Equivalent
Functiom
0
0
0
Disable operating system ROM, enable RAM from $0000 to $FFFF.
0
1
1
Enable OS ROM (default).
1
0
0
Disable built-in BASIC ROM
1
1
2
BASIC off, RAM on at $A000-$BFFF.
2
0
0
Turn on LED #1.
2
1
4
Turn off LED #1.
3
0
0
Turn on LED #2.
3
1
8
Turn off LED #2.
4-6
-
-
Not presently used.
7
0
0
Enable self-test ROM
7
1
128
Disable self-test ROM, enable RAM at $5000-$57FF (default after power-up complete).

    Add up the decimal values of the functions you want to enable or disable, then store the sum into location 54017. Of course, you would not want to turn off BASIC or the operating system with a POKE from BASIC (without a language, operating system, or controlling program, the computer would be reduced to a prism of pure memory with nothing to remember). Feel free to flicker the LEDs (found only on the 1200XL) from BASIC, but memory mapping should always be done with a machine language program.
    With both BASIC and the operating system disabled, there is free RAM from $A000 to $FFFF, 16K of additional RAM space. Well, almost 16K. The computer is pretty useless without its video and input/output chips, so they are kept active from $D000 to $D7FF, leaving this 2K of RAM inaccessible.
    If you're going to tackle the job of accessing all of the Atari's hidden RAM, there's another consideration, too. The video chip generates a non-maskable interrupt (NMI) every 1/60 second so that the operating system can update screen variables. This NMI cannot be disabled, so if the operating system is out to lunch when the interrupt happens, the 6502 tries to make an indirect jump through the NMI vector at $FFFA, finds nothing of value there, and crashes. So before you switch out the RAM, write the address of a nominally functional NMI routine into $FFFA and $FFFB. This can simply point to an RTI (return from interrupt) so that NMIs will be ignored.
    Remember also that with the operating system and interrupts disabled, you cannot make use of any of the shadow registers for input/output. You must store directly into the hardware locations. And naturally, you have to reenable the operating system to call routines like CIO (Central Input/Output).