Open fawtytoo opened 6 months ago
Ok. I'm comparing the results of my emulator with FBZX which does the same thing. FUSE gives the expected results of ok/skipped.
z80docflags
skips NEC & ST version, because the Zilog one worked fine. It's true that the skipped tests in this particular tap are kind of pointless, as all 3 types of cpu behave the same as far as documented flags are concerned.
z80flags
OTOH runs all three versions, because the Zilog one failed. This is to help to show which version of SCF/CCF behavior the CPU implements (if any). In your case, you have decided to go with NEC version instead of Zilog one, so it tells you exactly that. However, it also means that the z80ccf
will be useless for you, as all the CRCs are for Zilog behavior. So you won't be able to tell if your SCF and CCF correctly implements the behavior dependent on the prior instruction executed.
(In case you are not sure what that means, more details can be found in hoglet's link in the readme which describes the 3 CPU variants.)
BTW, I just noticed that hoglet's page mentions that NEC is always the same. Well, we know that's not true. Mark Woodmass when he was testing this was the first to find that on his NEC CPU, the only way he could get reliable result was to chain SCF and CCF together. For single CCF and SCF he was getting unreliable garbage. He couldn't explain the reason back then, it was discovered later that the behavior actually depends on the previous instruction.
That's the reason why emulators which wanted reliable and at the same time authentic behavior chose to stick with the Zilog behavior rather than going with NEC, which was not deterministic.
FYI, this page lists results of the tests on various machines and CPUs:
https://github.com/redcode/Z80/wiki/Zilog-Z80-CPU-Test-Suite
You can use it as a reference.
The videos of z80ccfscr
in action are in particular enlightening as to why the NEC behavior is not reliable.
Documentation is vague as to which Z80 it refers to, but Zilog's is the one I'm after. In fact, until now, I didn't realise there were 3!
I have the test suite, which is used in a paradoxical way as I need a working Z80 emulator in order to test the emulator, but documented flags are easier to implement for that to happen.
I now need to add something to recall the last instructions flag settings to correctly set XF/YF so SCF/CCF work in a Zilog way.
Documentation is vague as to which Z80 it refers to, but Zilog's is the one I'm after. In fact, until now, I didn't realise there were 3!
I have updated the wiki. Now, the article makes it clear that the screenshots in the "Expected results" section are for Zilog NMOS/CMOS.
I have the test suite, which is used in a paradoxical way as I need a working Z80 emulator in order to test the emulator, but documented flags are easier to implement for that to happen.
I now need to add something to recall the last instructions flag settings to correctly set XF/YF so SCF/CCF work in a Zilog way.
Take a look at Z80 XCF Flavor. The README explains everything. It may help you.
Also, you can check the logs of all three major test suites (including Patrik's v1.0 and v1.2a) for the different CPU variants here:
These logs are from the test runner included in my Z80 core.
If I run z80docflags, the SCF & CCF tests show "ok" with NEC/ST tests showing "skipped". If I run z80flags, all SCF & CCF tests fail except for SCF (NEC) & CCF+SCF.
I have included bit 3 & 5 from register A in the flags, which I believe is correct.