MDFS::Software.Z80.Exerciser.Spectrum Search

Z80 Instruction Exerciser for the Spectrum

I modified the source of Frank Cringle's Z80 instruction set exerciser ZEXALL so that it would assemble with ZMAC and MAXAM, and provided a pre-assembled ZEXALL.COM file for CPM systems. I then created a modified version to run on the Spectrum. The changes made are:
  • the output is trimmed slightly to fit the Spectrum's 32-column screen
  • the output calls the Spectrum output routines instead of CPM's BDOS routines
  • as the Spectrum ROM modifies (IY+x) every 256/50s second, IY is preserved around the test framework.

    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.sna zexdoc.sna 48K   Standard Spectrum snapshot file.
    zexall.z80 zexdoc.z80 8K   Z80 Spectrum snapshot file.
    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 on an actual hardware Z80. ZEXALL is not intended to diagnose implementation errors, it just compares the execution against a known baseline.

    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>...
      ERR: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.

    Possible bugs

    I have just run these tests on my hardware Spectrum, today 27-Dec-2003. Surprisingly, it failed! See the results here for ZEXALL and ZEXDOC. I am going to check the code carefully to see if I have made any errors in porting it to the Spectrum. For instance, the fact it executes at &8000 instead of &0100 could make a difference. Check here for updates.

    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  

    Spectrum hardware

    See comments above.

    Speculator (D.J.Lawrence, RISC OS)

    Loads: .SSN, .STA, .TAP

    Z80Em (Warm Silence, RISC OS)

    Loads: .SNA, .Z80, .TAP

    MZXSpeccy (Graham Willmott, RISC OS)

    Loads: .Z80, .SNA

    Spec128 (Joe Kelleher, RISC OS)

    Loads: .Z80, .SNA

    Z80/WinZ80 (Gerton Lunter, DOS/Windows)

    Loads: .SNA, .TAP

    Z80Tube (J.G.Harston, RISC OS)

    Loads: .COM

    MyZ80 (Simeon Cran, DOS/Windows)

    Loads: .COM

    Z80mu (Joan Riff, DOS/Windows)

    Loads: .COM
    HOME   DOCUMENTS   LINKS   RECENT CHANGES   BROWSE FILES
    Hosted by Force9 Internet - Domain Registration by EasySpace - Authored by J.G.Harston - Last update: 28-Dec-2003