Sideways Memory

Sideways memory was developed in 1982 to overcome a problem with the Apple ][ computer expansion slots.

Due to the addressing limitations of the 6502 and most 8 bit microprocessors of the day, total addressable memory was limited to 64k bytes.

The Apple ][ tried to address this problem by having a shared 2k of memory reserved for use by the 6 expansion slots along with their individual 256 bytes of on card memory. In many cases the was ok but with video expansion cards this caused a problem which showed itself as screen flicker or sometimes a blank screen when the shared memory was switched in and out of use by another expansion card.

With the Super Clock 1 card from Namal electronics, designed by David Anderson, this was an unacceptable problem as one of the functions on the card was to display the current time at the top of the screen.

A method was needed to have more than the 256 bytes of Memory for the expansion slot without using the 2k shared memory.

By using a 6522 Versatile Interface Adapter (VIA) with its 2 x 8 bit I/O, It is possible to use one set of this PIAs outputs to control the clock chip and the second set of outputs to extend the memory addressing on the expansion card.

Another aspect of the 6502 processor is its Indirect addressing. As part of the instruction set of the 6502 processor as well as the standard jump (JMP) 3 byte instructions, the indirect addressing allowed a 2 byte JMP instructions known as branch (BRA). These are jumps that are limited to the current 256 byte page leading to coding for a 256 byte memory page to be extra efficient.

How it works.

By using the 6522 PIA to control the sideways switching of the memory, the firmware code in the ROM can be programmed thus.

Your code
.
.
.

Ending the page with:

PHA Push A; temp store the A register

LDA # Load A with the next page number; the pages don't have to be in sequence

STA Store this page in the 6522 PIA, this will make the RAM shift sideways the continuing code on the next selected page. This is why it is important to have this code line up at the same relative memory addresses.

The following code is at the same memory position but on a different page that has been slid sideways.

PLA restore A

BRA #00 branch to start of this new page and to continuation of your code.




Above: The red arrows show program flow.


The final expansion card.

The main parts:

2732 4k ROM containing firmware

RTC clock chip

6522 PIA

Rechargeable battery

transistors for charging and power management.

By using sideways memory technique this card supports over 2k bytes of memory but uses only 256 bytes of addressable memory.





(c) 1982 David Anderson
Cambridge, England