Ben Ryves Unlocks More Memory in a Homebrew Z80 Microcomputer Build — with a Single NAND Chip
Going from 49kB of transient program area to 60kB took only a single NAND chip, in this interesting experiment in vintage bank-switching.
Vintage computing enthusiast Ben Ryves has upgraded his Zilog Z80-based CP/M computer build to boast a generous 60kB of accessible transient program RAM — by dint of adding a single NAND gate chip to the layout.
"This is a home-made Z80 computer I built back in 2010 that features a 10MHz Z80 CPU with 64kB RAM that runs CP/M 3," Ryves writes of his creation. "It can drive an internal LCD, TV, or VGA monitor at 320×240 (monochrome only) and unfortunately is a project I was never too happy with due to several compromises I had to make in its design – though at the time I was happy enough I got it to work at all!"
Picking the project back up this year, in an update brought to our attention by Adafruit, Ryves set about adding a few upgrades — including color and higher-resolution graphics outputs, based on the Acorn Computers BBC Micro display modes. The only niggle remaining: of the 64kB installed in the computer, only 49kB was accessible to the machine's CP/M 3.0 operating system as transient program memory. The solution, oddly, was not to add more RAM — but a NAND gate chip to give the system bank-switching capabilities.
"The memory layout of banked CP/M is actually quite a bit simpler than a lot of the threads I could find online seemed to make out," Ryves writes. "All you really need is a shared common area at the top of memory that will always be accessible regardless of the current state of the selected bank, and memory below that which can be switched between multiple banks. A simple way to implement a common area in upper memory is with AND (to detect the high address) and OR (to force the A16 high if it's a high address) logic."
Fitting a single chip with four two-input NAND gates was enough to implement the bank-switching logic. The result: a transient program area of 60kB, up from the original 49kB. "It does eat into the amount of memory available on page 0 for disk and directory buffers," Ryves admits. "As I'm loading from an SD card (which is much faster than the floppy discs of yore) the reduced buffer space is less of a concern to me."
The full write-up, which includes instructions in building a banked version of CP/M, is available on Ryves' website.
Freelance journalist, technical author, hacker, tinkerer, erstwhile sysadmin. For hire: freelance@halfacree.co.uk.