z80test icon indicating copy to clipboard operation
z80test copied to clipboard

Updated CRCs for ST variant CCF/SCF tests with undocumented flags

Open rzumer opened this issue 1 year ago • 1 comments

Recent research has shown that the CCF/SCF instructions, on ST CMOS variants, only change the 5th bit of the flag register (aka "Y") if flags were modified by the previous instruction. If flags are stable, then only bit 3 is set according to the A register.

This subtle difference in behavior does not appear to influence the output of the z80ccfscr program, but it does change the register state reflected in the checksums of the standard test suite.

Reference: https://github.com/redcode/Z80_XCF_Flavor/issues/2#issuecomment-2118869832

I don't have an assembler set up, so I tested this by editing the CRCs in the tap files from release 1.2a directly (using a hex editor) and validating the checksums in my emulator. With v1.2a, if flags are stable (i.e. they were untouched in the previous instruction), bit flags must be set to A & 0b0010_1000 | F & 0b0000_1000 to pass. With this change, bit flags must be set to A & 0b0010_0000 | F & 0b0000_1000.

I also have a test case to compare a screen capture of the ccfscr program with the reference images, and it looks like the output matches whether bit 5 is produced from A | F or just F, so that shouldn't need to be updated. I also didn't get an error from z80ccf.

rzumer avatar Dec 15 '24 10:12 rzumer