Welcome to the glorious new year!

As the first post of the year, let me spin you a short story on a computer from a foreign land. In more than one sense. As L.P. Hartley observed, "the past is a foreign country", and indeed, this particular machine is from the '80s. Also, this machine originates from the UK, quite ways away from my current home. Not so much from my childhood though in either of the senses: it was one of the 'elite' class machines that I drooled over in shop windows as kid, never being able to afford it.

It was a really nice, Z80-based home computer of the day with advanced graphics and audio capabilities (even compared to my Commodore 64). It also had 128kB of RAM. As I completed my work on the Z80 core for the UnIC project, I was casting out for more than my initial PCW512 machine as a test subject. I came across this one on eBay and my old fascination got re-kindled.

Soon, the specimen showed up at my doorstep, straight from Cairo, and in a condition that I would assume a machine repeatedly exposed to the fertile yearly floods of the Nile would be in. After some furious scrubbing, it regained its original shape and color, so I turned it on, and ... nothing. I verified the power supplies, the reset and the clocks, all were fine, yet, no boot. Poking at the signals, I've seen that many of the controls of the processor (nRD, nWR, nIORQ etc.) were showing strange behavior: nice high levels, but rather inconsistent, erratic lows. This could be caused by two things: either the source (the Z80 processor) has faulty drivers and can't drive the lines properly or the sink has faulty inputs and load down the signals too much. This was bad news indeed. You see, this particular computer was built around a pair of ASICs (called Nick and Dave after their designers); if either of those were damaged, it would be game over; they are irreplaceable short of getting another machine. Even then, being surface mounted affairs, they would be difficult. Still, there's only one way to find out: replacing the Z80. The CPU on the motherboard was soldered in, so it took some effort to get it out, get a socket in and a replacement CPU (temporarily liberated from my XZ81) in said socket. Power up and boom! Or, rather, boot! It was a close one, but I got lucky: it was the CPU that kicked the dust.

Next I had to replace the keyboard membrane which was in unconscionable condition. Luckily, someone makes brand new replacements. Unluckily (but unsurprisingly), they are in the UK. Another long wait ensued after which I managed to get to the next step: realizing that the machine doesn't have a BASIC interpreter built in; for that one needs a ROM cartridge, which the seller conveniently didn't include. I also realized that the machine I got was the 64kByte RAM model, not the more popular (and useful) 128k one. Which finally gets me to the meat of this post: I re-created both boards.

The ROM cartridge

This is a very simple affair: the computer exposes a 16-bit address bus and an 8-bit data bus on the cartridge port with all the requisite control signals. One just have to directly hook them up to a ROM chip. The total addressable ROM space is 64k - as you can convince yourself by some math-ing - but I decided to include support for chips up to 4Mbit (512kByte). The reason for that is mostly why not, but also because they are still manufactured and cheap.

The remaining address pins are connected to jumpers:

Yet another jumper is provided to support re-flashing (the old days of EPROMs are long past, all these chips are single-supply, 5V programmable FLASH devices). Not that it's useful without someone writing some re-flashing utility, which I won't. It's also quite possible that the chip-select is connected incorrectly and would need to be hooked up to pin B4 instead of B3 if writes are needed; again something that's very hard to test without going the whole way of trying to flash the parts in-situ.

Sponsored content

The board was manufactured by PCBWay with their usual high quality and speed. In case you didn't know, they make affordable PCB prototypes and ship them to your doorstep. Not only that, but they can do PCBa assembly, 3D printing, even injection molding or CNC machining if that's your fancy. If you are reading these pages, chances are you are a tinkerer just as I am. You should check them out! The boards (as evidenced by the pictures) are of high quality, though I have to say: these designs should not stress the manufacturing capabilities of any supplier. One thing of note: the ROM board uses immersion gold as a surface finish. This is useful for edge connectors as it is much more corrosion-resistant then other finishes. It makes the board more expensive and slower to manufacture though. Immersion gold however is softer than the best option (hard gold finish). That means faster contact degradation during multiple insertion/removal cycles, something that a ROM cartridge would potentially be exposed to. Still, hard gold finish is much much expensive, so I did not choose that. Here's the best part: I learned this from PCBWays own web-site. I honestly say that their knowledge base database is one of the best ways to learn about the ins and outs of PCB manufacturing.

Putting the board together wasn't a big deal. Even from the schematic, it should be obvious, how simple this thing really is:

A more complicated question is how to get the content into the FLASH device. I went back to an old trick I've used to rescue an old ISA motherboard that lacked a BIOS: use an Ethernet card with a BIOS expansion socket and an old DOS utility that supported said Ethernet card. With that, I had all the pieces in place as far as ROM was concerned.

The RAM expanded

The second project was to create a memory expander board for my Enterprise. There were several old designs on the web ranging in capacity from 64k (bringing the total up to 128k) to 256k or even 512k. These designs all still used DRAM chips, something that would be next to impossible to track down these days, new at least. So, I adopted a different approach and used a more modern 512kByte SRAM chip instead. These are also dying out in their 5V incarnation, but some are still manufactured. Since these don't need to be pre-programmed, I opted for a surface-mount design which makes the board much more compact. The schematic is slightly more complicated, but only slightly:

The reason for the complication is that - for this particular internal connector - the whole 22-bit address bus is exposed, so address decoding needs to be implemented. Not only that, but full address decoding is required, otherwise the operating system (EXOS) will detect the incorrect RAM amount. Finally, I wanted to make it possible to select (through jumpers) the amount of RAM exposed to the system. This serves two purposes: The original 128k model has a very specific place in memory for the second 64k, one where there is room for only 64k. If there are programs out there that depend on the physical address of RAM instead of querying the OS for it or detecting it themselves, those would be incompatible with anything other than the base 128k model. The second is that the memory size detection code is rather slow: the more memory you add to the system, the slower it boots.

The PCB was manufactured by PCBWay as well and, after assembly has the following resemblance:

The shape of the pads around U2 might need some explanation: this particular package comes in several length variants. All compatible, except one longer than the other. I elongated the pads on one side to accommodate the whole range.

The original design connected the equivalent of this board to the main motherboard though a set of wires instead of board-to-bard connectors. I opted for simple headers instead: the sockets needs to be soldered in to the motherboard, the headers into the RAM board. That way they can part ways whenever I chose to without the involvement of a soldering iron and some choice words. Little did I know that the holes in the motherboard are too small to really fit the pins and the two rows are ever-so-slightly further apart than the standard 100mil as well. Some blunt force still convinced the socket to fit in the holes, but that was a not-so-pleasant surprise:

After that though, the board fit nicely. As an extra benefit, it doesn't cover the Nick chip, which needs a heat-sink (not shown here). This way cooling is going to be more efficient.

The moment of truth

Both cards being completed, FLASH programmed, I turned the machine on. Did it work? No, not at first. There was one bodge-wire that was needed on the ROM board and I screwed up the default-inversion of A19 on the RAM board which needs the inverse application of the first jumper. Both of these mistakes are corrected in the schematics shown above, but they did slow me down in the bring-up process. After realizing and fixing both mistakes though:

Ta-da! If you want to replicate any of these projects yourselves, you can find them on GitHub:

Enterprising with UnIC

I mentioned my UnIC project at the beginning. That is what's called foreshadowing. I went through all of this to get a second test platform for my Z80 core. Now, with a BASIC interpreter in place, a socketed CPU and a working keyboard, it should be easy to test it out. So I did. And did it work? No. No, it didn't. The initial memory test passed, but then a blank screen and an eventual reset followed instead of the colorful welcome screen. I guess, this is what I get for trying to be thorough. I will have to whip out my trusted shadow tracer and hunt for further differences between implementations. That however is a story for another day.

Coda

After finishing this document and the project, it was time to put the machine back together. That's when I realized that my fancy memory expander board interferes with the top cover of the machine. I was careful enough to design the PCB to be flexible for such an occasion: I had a secondary connector for the 10-pin header, one that can be used with a ribbon cable. I needed to solder the cable into the motherboard (yes, the case design doesn't allow for any connector there). My board at least still can have a connector, it can still be easily removed, if needed. I also had to saw off sections of the board that were interfering:

It looks much less professional now, but, it still works. And I can close the case too!

I have to say though: I'm really disappointed with the attention to detail that went into the engineering of the PCB. Why have two connectors for the memory expansion? If you must, why have them so close to the board edge? Why have them such that no standard headers fit in them? Why not make them so that the expansion board can be mounted as a mezzanine design on top of the motherboard, using headers? Why make it so that any non-wire-based design would surely interfere with the case design? Frustrating.

Leave a comment

Comments are reviewed before they are published, so yours will not show up right away.

You can use **strong** and *italic* text, `code`, and lists (lines starting with - or 1.). Everything else, HTML included, is shown as it was typed.