Open r-lyeh opened 6 months ago
Hey @floooh ,
I have been told that in order to pass Rak's 1.2a it is recommended that Z80 Block Flags Test is a pass beforehand. This Z80 Block Flags test is currently failing (check screenshot below).
Additional infos can be found at: https://github.com/redcode/Z80/blob/master/sources/Z80.c#L937-L969 https://github.com/hoglet67/Z80Decoder/wiki/Undocumented-Flags
Hmm, we should confirm those findings against the netlist simulation:
https://floooh.github.io/visualz80remix/
I had looked at those instructions here: https://floooh.github.io/2021/12/06/z80-instruction-timing.html, but didn't pay particular attention to the flag bits.
...still strange that those are not caught be ZEXALL though, but I guess if those differing flag states only happen during the LDIR/LDDR loops, but not when the loop is finished it might explain it (e.g. ZEXALL most likely only cares about the end result after the loop has finished).
Btw, many thanks for listing all this information here, it's a great reference.
Man, @hoglet67 really is the Z80 master mind, he also figured out what was wrong with the netlist simulation code in https://github.com/floooh/v6502r (https://stardot.org.uk/forums/viewtopic.php?p=349760#p349760).
Hey @floooh,
Below you can find information about some very complete test suites for the Z80. The tests have been running in a ZX Spectrum emulator of mine. Please check the results for each test where possible. I have used tests, documentation and guidelines found in https://github.com/redcode/Z80 to create this ticket. Please do not hesitate to ask me to re-run tests under different conditions and/or ask for new tests if needed.
Zilog Z80 CPU Test Suite, by Patrik Rak
Github
This set of programs is intended to help the emulator authors to reach the desired level of the CPU emulation authenticity. Each of the included programs performs an exhaustive computation using each of the tested Z80 instructions, compares the results with values obtained from a real Sinclair ZX Spectrum 48K with Zilog Z80 CPU, and reports any deviations detected.
Download suite v1.0
CCF
after each instruction tested (z80ccf).BIT N,(HL)
after each instruction tested (z80memptr).Download suite v1.2a
CCF
after each instruction tested (z80ccf).CCF
instruction (z80ccfscr).BIT N,(HL)
after each instruction tested (z80memptr).Results v1.0 (69 issues found)
[z80memptr.tap.txt](https://github.com/floooh/chips/files/15284684/z80memptr.tap.txt) [z80ccf.tap.txt](https://github.com/floooh/chips/files/15284685/z80ccf.tap.txt) [z80doc.tap.txt](https://github.com/floooh/chips/files/15284686/z80doc.tap.txt) [z80docflags.tap.txt](https://github.com/floooh/chips/files/15284687/z80docflags.tap.txt) [z80flags.tap.txt](https://github.com/floooh/chips/files/15284688/z80flags.tap.txt) [z80full.tap.txt](https://github.com/floooh/chips/files/15284689/z80full.tap.txt)Results v1.2a (83 issues found)
[z80memptr.tap.txt](https://github.com/floooh/chips/files/15284673/z80memptr.tap.txt) [z80ccf.tap.txt](https://github.com/floooh/chips/files/15284674/z80ccf.tap.txt) [z80ccfscr.tap.txt](https://github.com/floooh/chips/files/15284675/z80ccfscr.tap.txt) [z80doc.tap.txt](https://github.com/floooh/chips/files/15284676/z80doc.tap.txt) [z80docflags.tap.txt](https://github.com/floooh/chips/files/15284677/z80docflags.tap.txt) [z80flags.tap.txt](https://github.com/floooh/chips/files/15284678/z80flags.tap.txt) [z80full.tap.txt](https://github.com/floooh/chips/files/15284679/z80full.tap.txt)Z80 Test Suite, by Mark Woodmass
This suite performs a series of tests to verify the MEMPTR documents - (English, Russian), which are spot on, as well as a brief run through several of the
CBh/DDh/FDh
opcode ranges. The test results in the program are compared against those from a NEC D780C-1 CPU, but Simon Conway kindly tested several other Z80 clones, confirming the same results.Results (3 issues found)
[z80tests.tap.1.txt](https://github.com/floooh/chips/files/15284698/z80tests.tap.1.txt) [z80tests.tap.2.txt](https://github.com/floooh/chips/files/15284699/z80tests.tap.2.txt)Z80 Instruction Set Exerciser, by Frank D. Cringle
Frank Cringle's Z80 Instruction Set Exerciser attempts to execute every Z80 opcode, putting them through a cycle of tests and comparing the results to actual results from running the code on a real Z80. The exerciser is supplied with Frank's Yaze (Yet Another Z80 Emulator). It is often difficult to track down, so Jonathan Graham Harston put it together here, as well as some conversions. The latest release of Yaze is available at Andreas Gerlich's website.
bit
instructions.Results (2 issues found)
[zexbit.tap.txt](https://github.com/floooh/chips/files/15284708/zexbit.tap.txt) [zexall.tap.txt](https://github.com/floooh/chips/files/15284709/zexall.tap.txt) [zexall2.tap.txt](https://github.com/floooh/chips/files/15284783/zexall2.tap.txt) [zexfix.tap.txt](https://github.com/floooh/chips/files/15285721/zexfix.tap.txt) [zexdoc.tap.txt](https://github.com/floooh/chips/files/15285722/zexdoc.tap.txt)Z80 XCF Flavor, by Manuel Sainz de Baranda y Goñi
Github project
Finally, this is a test for the ZX Spectrum that detects the Z80 CPU type. It is based on the behavior of the undocumented flags in the ccf and scf instructions.
The test is reporting a NEC NMOS type whereas I think we want it to be a pure Zilog one. Please double check the resulting image for a detailed matrix of all the flag combinations involved.
Results
![Z80 XCF Flavor](https://github.com/floooh/chips/assets/35402248/5687a155-9b6f-43b8-81fd-88c55897d8ff) [Z80 XCF Flavor.tap.txt](https://github.com/floooh/chips/files/15284797/Z80.XCF.Flavor.tap.txt)