Arduino Mega based Z80 CPU board tester

Inspired by discussions at the TRS-80 Dutch Usergroup meetings, I created a board exorciser for Z80 CPU based computers. It allows memory inspection, writing to memory, I/O port reading and writing, and low level signal exercising. In short, a tool which can help troubleshooting Z80 boards.

As it does not use a real Z80, signals are easier to check as the Z80 refresh for dynamic RAM does not interfere. As a result a dynamic RAM test will not work, but all address, data and control lines can be exercised with simple patterns, slowing the process so a logic probe can effectively be used.

The Arduino Mega is the only expensive parts needed, other parts need some soldering experience. But beware, this will not fix your broken computer. It can only help you fixing it!

There are two modes of operation;

exerciser with TRS-80 moldel I

What it doesn't do is execute Z80 code. It is an Arduino Mega board with a passive shield, wiring pins to the Z80 socket. The Arduino Mega is used as it has the required 37 pins available needed to fully exercise the Z80 pins. Only the Clk signal is not connected to an Arduino pin.

exerciser connector to Z80 socket exerciser shield

To use the Z80 exer, the Z80 CPU is removed from its socket and the flatcable socket pod inserted. The other end of the flatcable is connected to the Arduino shield and the Arduino to a modern PC with a terminal emulator.

exerciser shield exerciser shield solder side exerciser cable

The exerciser is controlled by a simple command set via the Arduino USB port. This can be used via the Arduino IDE console or any terminal emulator. The wiring is quite simple, just connecting Arduino pins to the Z80 connector. The shield, flatcable and 40-pin socket connector are completely passive, only 1-to-1 connections. No diagram yet, but the connections are defined in the Z80pins.h and README.txt file in the download tgz-files.

The commands:

    -- Z80 exerciser v0.8                                          
     -- debugging command set --
    Aaaaa            - set address bus to value aaaa
    Bpp or B#ss      - blink pin p (in hex) or symbol: A0-AF,D0-D7,RD,WR.MQ,IQ,M1,RF,HT,BK
    MRaaaa[+]        - Read memory address aaaa, optionally repeating
    MWaaaa vv[+]     - Write vv to address aaaa, optionally repeating
    PRaa[+]          - Read port address aa, optionally repeating
    PWaa:vv[+]       - Write vv to address aa, optionally repeating
    Tp               - exercise Arduino port p: ACDHKL
    V                - view data bus, pins INT, NMI, WAIT, BUSRQ, RESET
    Wpp v or W#ss v  - Write pin (in hex) or symbol: A0-AF,D0-D7,RD,WR.MQ,IQ,M1,RF,HT,BK; values 0, 1
    Xt               - Tri-state all Arduino pins. 0: off, 1: on.
     -- operational command set --
    Cssss-eeee       - Calculate checksum over a range
    D[ssss[-eeee]|+] - Dump memory from ssss to eeee (default 256 bytes)
    Issss-eeee       - Generate hex intel data records
    O                - Input Port map
    Sssss-eeee:vv    - fill memory range with a value
    Ussss-eeee       - test RAM range (walking 1s)
     -- misc. command set --
    E                - Toggle echo
    H                - This help text
    R[+|-]           - Refresh on/off
    Qn               - Repeat rate; 1, 2, 4, 8, 16, ..., 32678 ms (n=0-9,A-F)
    ?                - This help text

Some commands have a repeat suffix; allowing the operation to be repeated. The repeat rate is determined by the Q command, and exponential: 1, 2, 4, 8, 16, ..., ms. Of course some commands like 'D' are so slow fast repeat times do not make much sense.

Usage and start of the Model I ROM

This shows a dump of the first two 256 byte blocks of the memory map. Clearly a TRS-80 model I with a 'Japanese' ROM. The commands were "?", "D0000", "D". (The latter uses the next block by default)

keyboard map with SPACE, Enter and a pressed

This shows three views of the keyboard area with respectively the SPACE, ENTER and 'A' key pressed.

For computers with static video RAM and a fixed character frame buffer like the TRS-80 Model I, III, 4 line, the exerciser can be used to fill the video memory with a known character value, which are immediatly visible on the screen. Bit errors are easy to find this way. Clearing the screen would be "S3C00 3FFF 20".

The code is currently ~11.5 kByte large, so plenty of room for future expansion (Mega has 256 kByte Flash memory). With code changes it could even work on a Uno, but this would make the shield more complex because a pin expander would be required.

The exersized pins can of course be checked with a multimeter or scope, but I usually use a logic probe which indicates the level of a signal; high, low or undefined.

Plans are:

Of course, if nobody is interested, not much would probably happen. Plenty of other projects.

Z80 & TRS80 M1 shield

David Mutimer <> created an expanded shield, allowing connection to both the Z80 socket as well as the TRS-80 Model 1 expansion interface. He also improved the firmware. See this thread: TRS-80-diagnostic-ICE-card.

At one time I created a real board, version 1.1. It has some flaws:

A new board is planned, but it has to wait for some testing of the TRS-80 MI header.

Software versions:

The latest version is on GitHub.

The pictured version 1.1 had some issues but it easy to patch. There is a schematic and KiCAD files for a version 1.2 but it was never produced and tested. I'm confident the Z80-CPU header will work, but the TRS-80 M1 extension header (used by the David Mutimer code) is completely untested.

The Z80exer Arduino sketch is released under the 3-clause BSD license.

Last updated: 2023-05-24