32K SRAM for the ZX81

Author(s): Wilf Rigter
Publication: LISTing Newsletter
Date: September 1996
Pages: 17-18

[This article came with a lengthy discussion of the various ways to attach extra RAM to the ZX81. Taken from COMP.SYS.SINCLAIR and spot edited by John Pazmino. Wilf Rigter is at [e-mail address omitted].]

Here is my tried and proven idea for full decoding of a 32K SRAM chip in the ZX81 memory map:

As you know the ZX81 uses an incomplete decoding scheme for RAMCS and ROMCS. This was not just to save money but is also related to the way that the video display is generated. In a nut shell the video circuit in the ULA is activated when any program is “executed” above 32K.

Strange as it sounds, the display file is literally “executed” by a JP (DFILE+32K). If you attempt to decode 32K SRAM in the 16K to 48K area without an echo in the 48-64K area the thing will crash since it will “execute” the DFILE above 48K but won’t be able to access it. The trick is to create a “conditional echo” which decodes the 48K-64K area to the 16K-32K area only if the M1 signal is present.

M1, which is active low when an opcode is fetched (remember [it is] “executing” the DFILE), can be combined with A14 and A15 to enable the RAM chip as though it is mapped in the 48-64K area. Now you can have the SRAM mapped anywhere in the memory map without problems. Most RAM projects include M1 decoding but I think you will like my favorite circuit for this application using the 74HC251 as shown below.

It is designed to be mounted on a small piece of perf board with feedthrough PCB connectors to plug into the rear of the ZX81. The RAM WR, Data and Address lines are also connected to the corresponding edge connector lines.

The DIP switch is used to select 8K segments in the memory map from 0-48K. Yes, it’s true, you can overlay the ROM (S1) and still have video because the character pattern data is fetched with RD high which disables the RAM 0-8K segment and reads the data from the ROM. Now you can install those nice features in the ROM like function keys for 0-9 and auto running BASIC from power up (just what you need for control applications) and it is write protected to boot. You can even install new printer character patterns or a little program in the 7680-8191 area (I keep my RAMDOS there). Because the 0-8K is a write protected RD only RAM segmen, you have to load the ROM overlay data at location 32-40K (S5). [By the way,] the internal RAM is now accessable in 48-64K segment.

The logical configurations are: 0-32K (S1+2 closed) 8K-40K (S2+3 closed) and 16-48K (S3+4 closed). As mentioned S1 is used to deselect the ROM overlay and is also needed if you used 7680 -8191 for anything other than character patterns and you want to use the 2040 printer which must be able to “read” the character patterns. Alternatively change the ROM printer routine to get your new and improved font style patterns else where. I hope that this freedom to experiment with the OS will lead to a lively followup on the software side.

Next [some future] installment, I will show you, how by duplicating the circuit with some small changes, you can control a 128K x 8 SRAM memory configured as RAMDISK memory. Of course the DIP switches can be replaced with a register to give you software controlled memory mapping and bank switching and then the world’s simplest and most effective battery back up circuit.

ZX81 CONNECTOR - 32K SRAM decoding circuit (74HC251 and 62256)
ZX81 CONNECTOR – 32K SRAM decoding circuit (74HC251 and 62256)

* [at dip switch] = 10K pullup resistor network from 74HC251 pins 1, 4, 14 and 15 to +5V.