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

Show the actual value of the flags registers if there is a mismatch in the lower nybble #6

Open
yoursred opened this issue Dec 7, 2022 · 8 comments

Comments

@yoursred
Copy link

yoursred commented Dec 7, 2022

No description provided.

@robert
Copy link
Owner

robert commented Dec 7, 2022

Ahh do you mean show the full 2-digit hex, rather than just the 4 flags? In case there's a mismatch in the bits in the F register outside those used for the flags?

@yoursred
Copy link
Author

yoursred commented Dec 7, 2022

Yup. Only show it if there is a mismatch in the lower four bits.

@robert
Copy link
Owner

robert commented Dec 7, 2022

👍 makes sense, I'll do that at some point!

@CosmicBagel
Copy link

This sent me for a loop, I had to manually look at the logs to figure out what was going on. F register was getting bit 0 set, gb dr said the line was wrong, but the diff it displayed me was identical. Specifically happened for the 01-special.gb test.

@robert
Copy link
Owner

robert commented Feb 24, 2023

Thanks for the vote, I'll keep this in mind. If you're interested in submitting a patch then that would be awesome, although the code is a little gnarly so might be tricky XD.

@dan-mcdonald
Copy link

I think the lower nybble of F is always 0.

ld b, 0xff
ld c, 0xff
push bc
pop af
push af
pop bc

If you check c after all this in an emulator like BGB, the lower nybble will be zeroed out because when the values were pushed back onto the stack the lower f nybble is zeroed.
The cpu_instrs does something goofy like this to feed state to the CRC checker and I found the lower nybble was zeroed out.
Also this reference shows the lower nybble as zeroed out.

I'm not an expert though. If I'm wrong, please don't neglect your duty.

@robert
Copy link
Owner

robert commented Oct 12, 2023

Heh you're probably right. Do you think we should change anything about gameboy doctor or is this just interesting trivia?

@dan-mcdonald
Copy link

I just commented to be helpful since it sounded like a fellow GB emulator developer was on the wrong path, and people from the future finding for this issue might benefit.

I think the ideal output from gameboy-doctor would be to check the lower F nybble and when it is non-zero explain that it should never be zero.

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

No branches or pull requests

4 participants