Z80-MBC2 fits a CP/M computer into four core chips by handing I/O to an AVR

Z80, AVR, homebrew computing

This is the read-only HTML version. For the full Visual Space experience, open the app.

Z80 single-board computer — Im

Z80 single-board computer — Im
Z80 single-board computer — Im
Z80 single-board computer — Im
Z80 single-board computer — Im

Source: Z80-MBC2: a 4 ICs homebrew Z80 computer on Hackaday.io · Just4Fun

Retrocomputing, CP/M

Just4Fun’s Z80 board pairs a real CPU and 128KB of banked RAM with an ATmega32A that handles boot support, peripherals and clock generation. The low chip count shifts work into firmware—and makes the timing between the two processors especially interesting.

🤩 1
👍 1

A homebrew Z80 computer doesn’t have to recreate a whole board’s worth of vintage peripheral circuitry. Just4Fun’s Z80-MBC2 on Hackaday.io keeps the Z80 processor but delegates much of its supporting hardware to an ATmega32A. The result is a four-chip base system with SD-backed disk emulation, banked memory for CP/M 3 and a development workflow that can load programs directly from a PC.

The project dates to July 25, 2018. The supplied development logs cover cross-compilation instructions from October 2023, while visible discussion continues into August 2025. It’s an established design worth examining for how it divides work between old and newer hardware, rather than a newly launched board.

Four chips, with firmware doing the peripheral work

The base system uses a CMOS Z80, an ATmega32A, a 128KB SRAM and a 74HC00 quad NAND-gate chip. An optional MCP23017 adds 16 bidirectional GPIO pins; SD and real-time-clock functions use add-on modules. So “four chips” describes the core board, not every semiconductor in an expanded setup.

The ATmega takes on several jobs that would otherwise need separate hardware. It supplies the Z80’s reset and selectable 4/8MHz clock, provides the EEPROM-emulation role and runs the I/O Subsystem firmware, or IOS. That firmware presents the peripherals the Z80 software expects to find.

This also changes how the machine is brought up. Rather than burning a legacy EPROM, the builder first flashes an Arduino bootloader into the ATmega, then uploads IOS as an Arduino sketch. The initial bootloader still needs programming; the convenience comes afterward, when firmware uploads can use a serial-USB adapter and the Arduino IDE.

Just4Fun lists CP/M 2.2, CP/M 3, QP/M 2.71, UCSD Pascal, Collapse OS and Fuzix among the supported environments. The 128KB banked RAM is specifically part of the design’s support for CP/M 3. The project also supplies a Z80-MBC2 repository, alongside the schematic and bill of materials identified on its Hackaday.io page.

A NAND latch buys the ATmega time

The interesting hardware compromise is how a small microcontroller keeps up with the Z80’s I/O requests. Part of the 74HC00 forms an RS latch that holds the Z80 in a wait state during an I/O operation, giving the ATmega time to service the bus. The same chip also contributes to the memory-management circuitry.

A November 2024 discussion gets into an easily missed detail: how does the circuit release WAIT while the Z80 still asserts its I/O request?

In Just4Fun’s explanation, the ATmega drives WAIT_RES low. That takes the latch into what the creator calls its “undefined region,” but the individual NAND gate’s output is not mysterious: a low input forces its output high. Because that output drives WAIT, the Z80 can leave the wait state. Once the processor deasserts its I/O request, the ATmega can release WAIT_RES and leave the latch reset for the next operation.

The distinction matters. A combination that isn’t a valid storage state for the latch can still produce a definite output from an individual gate. Just4Fun also recalled checking the bus behavior with a logic analyzer, and described using BUSRQ to make the CPU relinquish the bus as it exits the I/O operation. The small parts count depends on this carefully coordinated handoff, not simply on connecting two processors together.

Cross-compilation makes the board a working target

The software workflow is another reason to build this particular machine. The October 5, 2023 SDCC log describes compiling C on a PC, sending the executable over serial and running it on the Z80 through the iLoad boot mode. Board-specific startup and support files live in the SD image, with separate compilation choices for interrupt support.

There’s a consequential loader detail: iLoad starts execution at the first address in the Intel HEX stream. The SDCC instructions therefore call for sorting the generated file into ascending address order with srec_cat, because SDCC’s output order is not guaranteed. It’s a small step that can separate a successful upload from a program that starts in the wrong place.

The October 9 TASM log provides a corresponding assembly-language route. TASM can produce Intel HEX for iLoad, or a flat binary that is renamed autoboot.bin and placed in the SD card’s root directory for Autoboot. One path suits repeated edit-and-test cycles; the other gives the board a program to start from its own storage.

Check compatibility, then keep diagnosing

A low chip count doesn’t make every substitute suitable. The design specifies a CMOS Z80, with an 8MHz-or-faster part for full-speed operation. Just4Fun explains that the CMOS requirement follows from logic-level compatibility with the ATmega32A and 74HC00. A 4MHz CMOS part can instead be used with the clock set to 4MHz.

One builder’s November 2024 troubleshooting thread shows why that requirement and the actual fault must be kept separate. Jon Whiteside reported a board that reached the IOS menu but halted after loading programs. Its NMOS CPU was unsuitable for the specified design, and he replaced it with an 8MHz CMOS part. But his November 21 follow-up identified dead RAM as the fault whose replacement fixed the machine. Finding an out-of-spec component hadn’t finished the diagnosis.

The same division of responsibilities guides expansion. In a May 2024 reply, Just4Fun noted that using the I²C connection for devices beyond the supported GPIO expander and RTC would require changes to IOS. The port exists, but new peripheral behavior still needs firmware behind it.

That’s the useful lesson of the Z80-MBC2: reducing hardware doesn’t remove complexity; it relocates it. Here, much of that complexity lands in inspectable firmware, a precise bus handshake and a few toolchain conventions. For anyone modifying the board, understanding those boundaries is more valuable than the four-chip headline alone.

Source: Z80-MBC2: a 4 ICs homebrew Z80 computer

Hardware

3 Followers

A workshop for electronics and physical computing. Share circuits, boards, tools and prototypes; work through measurement and debugging, compare components, and document the choices that turn an idea into working hardware.

Visual Space is built for projects like this—where creators collaborate, organize goals, and grow communities around real work.