BILL WILKINSON SPECIAL
RAM Banks on the 130XE
Access the full 128K memory
I have included a diagram (Figure 1) that will help you understand all that follows. Please study it before you continue. As the diagram shows, you should visualize the Atari 130XE as a 64K computer with several "extra" banks of memory tacked on.
Why a 64K computer? Quite simply, because that is as much memory as a 6502 microprocessor can address. Technical reason for this: It uses 16 address lines, and 2^16 is 65536-- which is 64K, the number of possible unique addresses.
What is the "default" configuration of this 64K computer? Just follow down the leftmost column of boxes in the diagram. There's 10K of OS (Operating System) ROM, 2K of I/O, etc. And yes, if you add it all up, it comes to 64K. If you simply turn on your computer and do nothing special, this default configuration is what you get. Notice that Atari BASIC is "on" and available in the default configuration!
There are three ways to alter this configuration. First, you can plug a cartridge into the port on the back.
Depending on the design of the cartridge, either 8K (Atari Assembler/Editor) or 16K (cartridge version of AtariWriter) of your memory becomes dedicated to the cartridge. Notice that there is no way within the 130XE to override a cartridge! (OSS SuperCartridges have special circuitry which allows them to be turned off via software. But that circuitry is in the cartridge, not the 130XE.)
Second, in a similar fashion, hardware devices which plug into both the cartridge and the extended interface slots may "pre-empt" the area normally used by the floating point math routines in the OS ROMs. (This is how the SupraDrive hard disk and several devices from ICD are hooked into the memory map of a 130XE.)
Finally, the easiest way to control the selection of the "Extra RAM" (look for this designation in the diagram) is via PORTB, the hardware control port at location $D301. I am not going to discuss how the various bits in this control port work, since Atari's manual gives a brief description and since. . . Well, keep reading.
I said the "easiest way" to use more of your 130XE's memory than the default configuration provides is to use the $D301 control port. But even though it's easiest, it is not at all easy! This is not a contradiction: A 90% difficulty rating may be easier than 95% or 98%--but it is still pretty tough.
My recommendation: If you are not at least an intermediate-level assembly language programmer, don't mess with the extra RAM banks. It is very, very easy to lock up your programs irretrievably if you use the $D301 port at all.
You can mistakenly turn off the piece of memory your program currently occupies, thereby causing the CPU to get completely lost. You can turn off the OS ROMs just before an interrupt happens and send the computer to sleep. Or, more subtly, you can disable the carrier detection capability of an XM301 or 1030 modem. And I've just started.
The extra RAM banks are located between $4000 and $8000. Be sure the other ports of your program avoid this range.
If you are an intermediate assembly language (or perhaps ACTION!) programmer, you might be able to take advantage of the extra RAM banks which are located between $4000 and $8000. Just be sure that the program which changes the banks does not reside anywhere in this range or use data stored in one bank while another is active.
But I would still avoid the RAM from $C000 upwards. Aside from the difficulty of handling such things as interrupts, character sets, etc, more and more versions of DOS are beginning to use that area. This makes sense because it is difficult for the average programmer to access this memory. So why not let the (hopefully expert) DOS programmers use it to save space in the more readily programmable "lower" memory? DOS XL and SpartaDOS already serve you in this way, and I think I can confidently predict at least one more significant DOS in the offing. (Is this the Atari 8-bit DOS for 3 1/2-inch disks, Bill? --ANTIC ED)
And what about you Atari BASIC programmers? How can you use the 130XE's extra memory banks? Two good ways: 1. Use a commercial RAMdisk program such as the one provided with Atari DOS 2.5 and be happy. 2. Use BASIC XE. This may seem a bit self-serving, since we at OSS produce BASIC XE. But the truth of the matter is that there is no equivalent of BASIC XE.
BASIC XE is the only language specifically designed to use as much of the 130XE's memory as possible. It lets you write programs as large as about 62K and still have about 32K left for data--variables, including strings and arrays. And all this capacity while maintaining 98% -plus compatibility with Atari BASIC. So you don't need to relearn all you already know. (Can I also mention that BASIC XE is two to six times faster than Atari BASIC? Faster even than an IBM PC? Thanks.)
The bad news is that writing programs to use the "extra" memory of an Atari 130XE is not at all easy (except with BASIC XE). The good news is that you do have access to a full 64K of memory at all times. 'Nuff said?
Bill Wilkinson is the longest-running Atari Programming columnist and the founder of Optimized Systems Software. In May, 1986 OSS won the Antic Award for Lifetime Achievement, honoring such major programming tools as MAC/65, ACTION!, Personal Pascal and BASIC XE.
BASIC XE OSS, Inc. 1221-B Kentwood Avenue San Jose, CA 95129 XL/XE, cartridge plus disk $79 (408) 446-3099