›SUPPLIED BY THE CHAOS BBS› (517) 371-1106››› A 130XE-COMPATIBLE 256K› UPGRADE FOR THE ATARI 800XL› by Claus Buchholz›› I designed the 256K upgrade described in my article, "The Quarter-Meg Atari" (BYTE, September, 1985 and recapped here in this article), in December, 1984. Since this predated the 130XE, there was no precedent for extended memory on the XLs. I felt free to implement a system of eight 32K banks. The major reason was to keep the add-on circuit as simple as possible. The 130XE, introduced in early 1985, set a different standard for bank-select memory. It uses 16K banks and makes them separately available to both the CPU and the video controller (ANTIC). The XE has 128K total memory. The 64K extended RAM is split into four 16K banks. A 256K 800XL has 192K extended RAM, which requires 12 16K banks. I have designed a new upgrade for the 800XL that implements such a scheme. Its similarity to the 130XE's scheme allows use of software for the XE on a 256K 800XL.› To select one of four banks, the XE uses two bits, #2 and #3, in the memory control register (port B of the 6520 PIA, addressed at $D301 or 54017 decimal). Zeroing bit #4 makes the selected bank appear at addresses $4000-$7FFF (16384 to 32767 decimal), as seen by the CPU. Zeroing bit #5 makes it appear there as seen by ANTIC.› In my upgrade, bits #2, #3, #5 and #6 select one of the twelve banks. Zeroing bit #4 makes the selected bank appear at $4000-$7FFF to both the CPU and ANTIC. So, any program for the XE that uses the extended RAM for CPU storage will work on an 800XL with this mod. Those programs won't use the additional 128K, though. Programs that use the video banking feature of the XE might run on the modified XL, but the screen display will be wrong.››The Dynamic RAM›› Each chip inputs or outputs one bit at a time, so each bit has a unique address. For the 256K-bit chip the address requires eighteen bits. The chip has nine address inputs, each of which does double-duty. During the first part of a memory access, half of the address bits are presented to the chip. This half is called the row address. Later in the access cycle, the chip receives the other half of the address, called the column address. The storage cells in the chip lie in a matrix, and the cell being addressed lies at the intersection of the row and column specified. To complete the access cycle, the chip reads or writes the selected bit.› The 800XL uses 64K-bit RAM chips, which have eight address inputs for an eight-bit row address and an eight-bit column address. This is fine for the 16-bit addresses the 6502 gives. There are eight of these chips, each contributing one bit to each byte of RAM.› The 256K-bit RAM is practically identical to the 64K-bit RAM except that it has one extra pin to accommodate the two additional address bits it needs. This extra pin is pin #1 on the chip. Pin #1 on the 64K-bit chip has no function. The functions of all the other pins on both chips are identical.› Therefore, our upgrade involves unplugging the eight 64K-bit RAMs and plugging eight 256K-bit chips in their place. We must also add some circuitry to provide two extra address bits for pin #1.› The storage cells in dynamic RAM chips are actually microscopic capacitors, storing an amount of electric charge that represents a 0 or 1 bit. Since capacitors leak charge, they must be periodically recharged or refreshed. The chip refreshes one or two entire rows when accessed. This means that every row must be accessed frequently to keep the stored data accurate. Since normal operation of RAM can't guarantee that, the computer system must provide special access cycles called refresh cycles. A refresh cycle is a dummy read cycle in which a refresh address is used as the row address.› The 16K- and 64K-bit RAMs require seven-bit refresh addresses. The computer must provide all 128 possible refresh addresses every few thousandths of a second to keep the RAM refreshed. In the Atari, the video controller provides refresh cycles in addition to its screen memory accesses. It automatically provides seven bits for the refresh address. It turns out, the Atari spends four percent of its time refreshing RAM.› One snag in designing the 256K-byte upgrade is that standard 256K-bit RAMs require an eight-bit refresh address. Older versions of the Atari video controller chip provide only seven bits of refresh address, whereas newer versions give all eight. So, there are two versions of the upgrade's interface circuit. The more complex one must add another bit to the Atari's refresh address.››Notes on Bank-selection›› To fit 256K bytes into the 6502's 64K memory space, we must divide it into banks. If a program in RAM were to replace the entire 64K RAM with another bank, it would cause itself to disappear, and the system would certainly crash. Also, the top 32K of the Atari's address space is cluttered enough with hardware addresses and ROMs that can be switched in and out themselves. The screen RAM is usually in the top 32K and we don't want to switch that out and cause glitches to appear on the screen. Additionally, the operating system keeps important data in the lower part of RAM and it expects the data to be there when it is called. Further, the 6502's stack is in low memory. Worse, interrupts occur frequently and the routines they invoke also keep data in low RAM. Programs must therefore follow a strict rule: Keep the "normal" bank enabled as much as possible. If you select another bank, you must first disable all interrupts and not call the operating system until the "standard" bank is restored.››Interfacing the RAM›› The interface circuit for the 256K RAM is to be assembled on a small circuit board and installed inside the computer, as the computer's expansion slot doesn't carry the signals we need. The circuit consists of four (or five for older models) chips and replaces one of the chips on the computer motherboard. It also requires jumper wires to various points on the motherboard and connection to 5 pins of the PIA (U23).› The circuit plugs into the socket at position U27 on the motherboard. This gives it access to six important signals, including power and ground. The chip that was at U27 becomes IC1 in the circuit. As U27, this chip was one of the two responsible for selecting which eight of the sixteen address bits are passed to the 64K RAMs at one time.› If your ANTIC (U7) part number is CO21697, use the circuit described by the first connection list at the end of this article. If it is CO12296, include the circuit in the second list. The circuit requires five connections to the PIA (U23). So, pins 12 through 16 must be bent up and connected to the circuit. › The extra circuitry for the older version of the 800XL is an eight-bit binary counter that counts the refresh cycles. It supplies the eighth bit of the refresh address that the 256K chips need. The refresh signal it uses comes to the circuit through a jumper wire from the motherboard.››Performing the Upgrade›› To disassemble the 800XL, remove the six screws on the underside and separate the top and bottom portions of the plastic case. Be careful of the flexible keyboard cable. Pull it straight up out of its socket on the motherboard. To detach the motherboard from the case bottom, remove three screws: one on the right side, one in the right rear corner, and one in the left rear. Gently pull the board free of the case.› Next, remove the small nuts and bolts around the metal shielding that encases the motherboard. On the left side of the exposed motherboard, locate the row of eight 16-pin RAM chips. Just to their right is U27. Behind U27 is a three-inch square area that fits inside the shielding. The circuit goes there, because the shielding is highest toward the rear.› Replace the 64K RAMs with the 256K RAM chips. The new RAMs are very easily destroyed by static discharges, so extreme care is necessary in their handling. Lay aluminum foil on the work surface and keep the motherboard, RAM chips, tools and hands in contact with the foil at all times. This keeps everything at the same potential, decreasing the possibility of damage.› On the motherboard, locate the video controller, the 40-pin chip at U7. If the part number stamped on it reads "CO21697," you are lucky! You may use the simpler circuit. If the number reads "CO12296," you must use the larger circuit.› Assemble the appropriate circuit on a two by three inch circuit board (Radio Shack's #276-150 is ideal). Use very low profile sockets or no sockets at all, as height is severely limited by the shielding. If you use no sockets, be careful not to apply heat to the IC pins for too long a time. Keep the wiring on the chip side of the board to conserve space. The wiring must be soldered, as there is no room for wire-wrap posts.› The board plugs into the socket at U27 via a 16-pin DIP header and short ribbon cable. Finally, install the jumper wires. Find a resistor marked R32 immediately behind the row of RAM chips and remove it. A trace from one of the holes runs to pin 1 of the RAMs. Solder the first jumper to that hole.› The next jumpers run to a parallel port which the Atari uses to control ROM switching. We need pins 12 through 16, which are normally unused and not connected to any traces. Locate U23 and carefully pry the 40-pin chip from its socket. Bend up pins 12, 13, 14, 15 and 16 so that they point straight out. Reinsert the chip. Cut five adjacent pin positions from an IC socket and solder the jumpers to them. Use this custom socket to connect the jumpers to the three protruding pins. Cover the connector with electrical tape, as the shielding is very low at this point.› If you are using the circuit for the older 800XL, you must install an additional jumper. Locate a trace on the motherboard from pin 8 of the video controller, U7. Along the trace find a hole and solder the jumper there.› Finally, insert a thin piece of stiff cardboard or plastic under the small circuit board to avoid shorting the circuit. Refasten the shielding to the motherboard. If it doesn't fit over the circuit, carefully pound a dent out of the shielding with a hammer. Reassemble the computer.› If all has gone well, the computer should power up and perform normally, although with the 256K in your XL, be sure to wait at least ten seconds after turning the computer off, else it may not coldstart properly when you turn it back on.› The computer is ready to try some software that utilizes the large RAM space.›››››The RAM-disk Software›› Bank-select RAM is useless without software to control it. The software must obey strict rules as outlined above to work properly. The software must also be tailored to fit the application. Applications vary.› For example, many graphics screens may be stored in the RAM, possibly to be displayed in quick succession for animation. Alternately, the RAM may act as a print spooler. A word processor would print an entire document quickly into the RAM and go on to other jobs while the RAM empties slowly to a printer.› These applications are rather specific and might not appeal to all users. A more universal application is the RAM-disk, a RAM-based disk drive simulator. To DOS and to the user's programs, the RAM-disk appears just as another disk drive, except that it is very fast. The application program may then use standard DOS commands to access the large RAM space. The 192K bytes of available RAM hold more data than two Atari 810 drives or one double-density drive.› The RAMdisk software I have prepared, QMEGXLD.SRC, offers a choice of either two single-density RAMdisks or one double-density. Also available is QMEGXLS.SRC, a RAMdisk program that sets up one single-density RAMdisk and leaves the XE-equivalent banks free for XE software. This is quite useful with BASIC XE, DOS 2.5, or the new Synapse software.› Assemble the source code with any assembler that accepts the syntax of the Atari Assembler/Editor. Assembly produces an object file that performs several tasks as it loads. First, it copies the operating system from ROM into the underlying RAM. Next, the RAM-disk routines load into the RAM-based OS, overwriting the international character set, a little-used feature of the 800XL. Lastly, it patches the OS to install the RAM-disk program and calls DOS's initialization routine to let DOS recognize the new drive.› The source code allows two options: the drive number and the density. The RAM-disk can act as any drive numbered 1 to 8. If you have one real drive, you might want the RAM-disk to be drive number 2. Remember that your DOS must be set up to look for the drive number chosen. See the DOS manual for instructions concerning drive numbers. Typicallly, you must POKE memory location 1802 with a value of 15 in order to recognize disk drive numbers up to #4. Then you will write new DOS files which will thereafter always include your POKE.› The RAM-disk object file should be made to boot in after DOS so the user needn't worry about it. In Atari DOS, naming the file AUTORUN.SYS accomplishes this. Once the object file has loaded, the RAM-disk MUST BE FORMATTED before use. You may do it manually from DOS, or the application program may do it automatically (use the BASIC XIO command or a call to CIO in machine code).› RESET won't harm the contents of the RAM-disk, nor will rebooting the computer, as long as the computer is not turned off (to reboot without powering down, POKE 580,1 and press RESET, or jump to $E477 in machine code). After rebooting, the RAM-disk program must be reloaded to access the data, which should then be found unharmed in the RAM-disk. This is why the RAM-disk program does not automatically format the RAM-disk upon loading.› The major disadvantage to the RAM-disk approach is that all data is lost when the computer is turned off. The application must take care to save important data to a real disk before ending. However, the speed, convenience, and versatility of the RAM-disk overshadow its drawbacks.››Uses›› An assembly language programmer, after studying the RAM-disk source code and heeding the rules above, can devise many practical uses for a quarter-megabyte of RAM. The large RAM space, joined with the Atari's versatile hardware and low price, gives a performance/price ratio that is unbeatable in today's microcomputer market.›› I ask one thing in return for this information: Please pass it around to all your interested friends. Put it in your club's library or on your favorite BBS. Encouraging software support of 256K will result in many interesting uses for it. Thank you and enjoy!››››››NOTE: SEVER FILE HERE AND COPY THE REMAINDER TO YOUR PRINTER FOR BEST RESULTS!›› › › › DEFINITION OF MEMORY CONTROL REGISTER AT $D301 (54017 DECIMAL)› › XL MOD 130XE› › bit: 7 6 5 4 3 2 1 0 bit: 7 6 5 4 3 2 1 0› D a b E c d B R D V C x y B R› › D=0 enables diagnostic ROM D=0 enables diagnostic ROM› B=0 enables BASIC ROM B=0 enables BASIC ROM› R=1 enables OS ROM R=1 enables OS ROM› E=0 enables extended RAM V=0 enables extended RAM for video› abcd is 4-bit extended RAM bank # C=0 enables extended RAM for CPU› - ranges from 4 to 15 xy is 2-bit extended RAM bank #› - banks 12 to 15 are equivalent - ranges from 0 to 3› to XE's banks 0 to 3› › › › PARTS LIST› › 8 41256 256K-bit dynamic RAM (200ns or less)› 1 74LS153 Dual 4-to-1 multiplexer (IC2)› 1 74LS139 Dual 2-to-4 decoder (IC3)› 1 - 33 ohm, 1/4 watt resistor› › ADDITIONAL PARTS FOR ANTIC #CO12296› › 1 74LS158 Quad inverting 2-to-1 multiplexer (IC4)› 1 74LS393 Dual 4-bit counter (IC5)› › › › LIST OF CONNECTIONS FOR THE UPGRADE CIRCUIT› › Instead of a drawing of the upgrade circuit, below is a list of› connections. Each entry in the list begins with the name of the signal› followed by all the IC pins that connect together and share the signal.› IC3-13 means pin 13 of IC3. The IC numbers appear in the parts list above.› IC1 is the 74LS158 chip from socket U27 on the XL motherboard. DIP is the› DIP header to be plugged into socket U27. U23-xx refers to the pins you bend› up on the PIA chip at U23 on the motherboard.› › Vcc : DIP-16, IC1-16, IC2-16, IC3-16, IC3-13› Vss : DIP-8, IC1-8, IC2-8, IC2-1, IC2-15, IC3-8› A7 : DIP-11, IC2-10, IC2-11› A15 : DIP-10, IC2-13, IC3-3› A6 : DIP-14, IC2-6, IC2-5› A14 : DIP-13, IC2-3, IC3-2› MUX : DIP-1, IC1-1, IC2-2› A4 : DIP-2, IC1-2› A12 : DIP-3, IC1-3› RA4 : IC1-4, DIP-4› A5 : DIP-5, IC1-5››››››››››› A13 : DIP-6, IC1-6› RA5 : IC1-7, DIP-7› -E : DIP-15, IC1-15› RA7 : IC2-9, DIP-9› RA6 : IC2-7, DIP-12› PB2 : U23-12, IC2-4› PB3 : U23-13, IC2-12› PB4 : U23-14, IC3-1› PB5 : U23-15, IC1-10› PB6 : U23-16, IC1-11› -Zd : IC1-9, IC3-14› -O1a : IC3-5, IC3-15, IC2-14› -O2b : IC3-10, One side of resistor› RA8 : Other side of resistor, Pin 1 of all RAMs› › If your U7 part number is CO12296, do not connect signal A7 above, and› make the following additional connections. The connection to U7 is to a› trace on the motherboard that runs from pin 8 of U7.› › Vcc : DIP-16, IC4-16, IC5-14, IC4-3› Vss : DIP-8, IC4-8, IC4-2, IC4-15, IC5-7, IC5-2, IC5-12› A7 : DIP-11, IC4-6› -REF : U7-8, IC4-1› REF : IC4-4, IC5-1› A7' : IC4-7, IC2-10, IC2-11› Q7 : IC5-8, IC4-5› Q3 : IC5-6, IC5-13›››SUPPLIED BY THE CHAOS BBS› (517) 371-1106››