Back to Projects or Publications
Internal Function RAM
The Commodore128 had an empty 28-pin socket for what was referred to as an 'Internal Function Rom.' This could hold a 32k ROM of third-party software such as JiffyDOS, or a user-programmed EPROM. I devised a way to install a Static RAM that could be battery backed. My first version worked, but with limitations. Rev2 not only performed better but was also simpler and could, if one could provide control bits from somewhere, allow 'banks' of 32K in a mix of SRAM, EPROM or ROM.
Normally, like other read-only devices in the C128, the Internal Function ROM is selected by bringing /OE (Ouput Enable, pin 22,) low. Chip Select /CS is always low -- grounded. If the PLA and MMU detect that a Write cycle is called for in an address range and Bank that is supposed to be ROM, the enable (called /FROM in the case of Function ROM,) doesn't go low and system RAM is instead selected. Write is said to "fall through" to system RAM "under" the ROM. The 74HC138 in Figure 1 bypasses the PLA and MMU logic, eliminating the state of R/W from the decision, relying only on MS0=0 and MS1=1 (and the 2MHz clock=1 for proper timing,) to enable the Static RAM during Read or Write. /OE, still connected to /FROM, still goes low during a Read, as it should, and remains high during a Write, as it should.
The SRAM was inserted into the socket with four pins bent out because their functions are different from a ROM or EPROM the socket was intended for. The arrangment shown in Figure 1 was for the low-profile or 'flat' C128. This could also be done in the C128D, but if one wanted two Static RAMS, or a combination of SRAM and EPROM, a small board that plugged into the Function Rom socket could be built. (Suggested layout in Fig. 2.) The state of the Select switch in Fig. 1 would detemine which device was selected. This could also be a bit from, say, the Cassette ports, assuming cassette storage was unused. The scheme could be extended to a total of four 32K devices by utilizing input C of the 74HC138. Usable '138 outputs are Y1, 3, 5 and 7.
In the flat C128, the Basic Interpreter existed in two 16K ROMs, designated BASL and BASH. It was possible to free another 28-pin socket by piggy-backing one ROM to the other with its /OE pin bent out and wired to the proper pc trace. A user could also burn a 32Kx8 EPROM combining BASL and BASH in one package and use diode-ANDing ('Mickey Mouse Logic') to enable the EPROM. (There was no socket to free up in the 128D because the Basic Interpreter was already in a 32K ROM, hence the need for the plug-in board in Fig. 2.)
Writes to memory locations that were supposed to be ROM would still write to underlying RAM ('URAM'?), possibly corrupting a BASIC program in RAM0 or variables in RAM1, because during WRites Figure 1 enables the Static RAM while the PLA/MMU enable system RAM. Both types of memory are written simultaneously! More logic could've corrected that but that would have brought about an unacceptable change in the normal operation of the C128 hardware. I wrote a routine in assembler to safely move data to Static RAM in the Function ROM socket. It would first read the location in underlying RAM, store it on the processor stack, write the Internal Function SRAM (and underlying system RAM), then restore the byte from the stack to URAM. This routine could be called in M.L. or BASIC and it performed a few checks of start and end address and which memory configuration was in effect to ensure that I/O or the MMU registers would not get clobbered by the memory move.
Thanks to SmallCleverDinosaur (Carl) at http://c-128.freeforums.net/