[img] Z80 Instruction Exerciser for the Spectrum
 MDFS::Software.Z80.Exerciser.Spectrum Search  
I modified the source of Frank Cringle's Z80 instruction set exerciser ZEXALL and ZEXDOC so that it would assemble with ZMAC and MAXAM, and provided a pre-assembled ZEXALL.COM and ZEXDOC.COM file for CPM systems. I then created a modified version to run on the Spectrum. The changes made are: Stuart Brady updated the reference CRCs and fixed use of EI/DI around the Spectrum ROM calls.

The following files are supplied here:
zexall.src zexdoc.src 42K   ZEXALL and ZEXDOC source for Spectrum.
zexall zexdoc 8K   ZEXALL and ZEXDOC binaries, load=&8000, exec=&8000.
zexall.tap zexdoc.tap 8K   Spectrum Tapefile. LOAD "" will start zexall or zexdoc.

ZEXALL and ZEXDOC test the Z80 CPU implementation against a set of empirical results. That is, it compares the excution against results found from running ZEXALL/ZEXDOC on an actual hardware Z80. ZEXALL/ZEXDOC is not intended to identify implementation errors, it just identifies that there is an implementation error.

A test that passes will be displayed as:
  <adc,sbc> hl,<bc,de,hl,sp>...OK
A test that fails will be displayed as:
  <adc,sbc> hl,<bc,de,hl,sp>...
  CRC:xxxxxxxx expected:xxxxxxxx

There are 68 tests, each of which take about 3 to 4 minutes, so the whole program can take over four and a half hours! It will be useful if you can get your system to make a screen snapshot every five minutes or so, or spool the output, for later perusal.

Running the tests

It is very unlikely that any Z80 emulator will past all, or even most, of the tests. It is very difficult to emulate the hardware exactly down to the last bit-change, and have a usable emulator. Most emulators make reasonable compromises between fidelity and speed to get a useful implementation. The instructions that are most likely to pass on all systems are the register load instructions. Anything that changes the flags may operate correctly enough to be a useful emulator, but fail against the real hardware where unused flags may also be changed outside the specification of the documentation.

Another point to bear in mind is that if any of the instructions that make up the test code aren't implemented correctly, then the testing will give incorrect results. For instance, if RRCA actually does RLCA, then the calculation of the instruction CRCs will fail.

Testing Results

I have run ZEXALL on various systems, both to test ZEXALL, and to test the implementation of the emulators.
Hardware Speculator Z80Em MZXSpeccy Spec128
Z80/WinZ80 Z80Tube MyZ80 Z80mu  

HOME   DOCUMENTS   LINKS   RECENT CHANGES   BROWSE FILES
Best viewed with Any Browser Valid HTML 4.0! Authored by J.G.Harston
Last update: 28-May-2007