Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated the CRCs of INIR->NOP'/INDR->NOP' for z80memptr. #3

Merged
merged 1 commit into from Dec 2, 2023

Conversation

redcode
Copy link
Contributor

@redcode redcode commented Nov 30, 2023

I've discovered a new undocumented behavior of the inir/indr/otir/otdr instructions:

As in cpir/cpdr/ldir/lddr, when the repeat condition is met, the CPU generates an extra M-cycle of 5 T-states to decrement PC. This M-cycle performs additional flag changes, but until now it was not known that MEMPTR is also modified, being set, as in all other block instructions during this M-cycle, to PCi + 1 (PCi = value of PC at the start of the instruction, before it is incremented).

After adding this behavior to my Z80 core, z80memptr.tap fails in the following 2 steps:

102 INIR->NOP'            FAILED
CRC:F3B1BE2F   Expected:0A537B63
103 INDR->NOP'            FAILED
CRC:F3B1BE2F   Expected:0A537B63

Which matches the results obtained on real hardware by Richard Chandler, who kindly tried the test at my request on one of his machines with NEC CPU:

imagen

imagen

Of course, this "new" behavior has been tested on Visual Z80 Remix.

@raxoft
Copy link
Owner

raxoft commented Dec 1, 2023

Nice find. Surprised no one noticed before, when the block instructions were scrutinized.

I'll prepare an updated release in a short time.

@redcode
Copy link
Contributor Author

redcode commented Dec 1, 2023

OK, thanks. BTW, this behaviour is confirmed on Zilog and NEC. There is no reason to think that ST CMOS will behave differently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants