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

LYC int RUPO PAGO #163

Closed
paulb-nl opened this issue Nov 19, 2023 · 2 comments
Closed

LYC int RUPO PAGO #163

paulb-nl opened this issue Nov 19, 2023 · 2 comments

Comments

@paulb-nl
Copy link

FF41 bit 2 (RUPO) is set by ROPO (LYC int). That makes sense but then at the same time it is reset by PAGO if nLYC_STAT_RESET is high or not writing to FF41.

So the only way RUPO is not reset is during a PPU hard reset and also writing to FF41 which of course is impossible.

Is it actually being reset all the time? What does that NOR latch output when it is reset and set at the same time?

As we know from the Mooneye test suite, FF41 bit 2 is slightly delayed with a 0->1 transition compared to 1->0 where it reads a NOP later during the lyc0->1 test. Is this related?
https://github.com/Gekkio/mooneye-test-suite/blob/8d742b9d55055f6878a2f3017e0ccf2234cd692c/acceptance/ppu/lcdon_timing-GS.s#L108

@msinger
Copy link
Owner

msinger commented Nov 19, 2023

If both inputs of RUPO (FF41 bit 2) are 1 at the same time, both NOR gates that make up the latch should output a zero. So Q and /Q should be 0 at the same time.

I see in the simulation that RUPO.Q is always 0 and RUPO.~Q is the inverted state of ROPO (LYC int). So after the tri-state inverter SEGO, the value read from FF41 bit 2 should always be just the same as ROPO. (I haven't tested the case where nLYC_STAT_RESET and RYJU are both 0 though.)

I don't know why they put the latch here. Should also work without it. Maybe it has "historic" reasons like many of such nonsensical looking things.

I can't tell where the slight 0->1 delay compared to 1->0 comes from. That's too complicated for me now. :)

@msinger
Copy link
Owner

msinger commented Jun 26, 2024

I close the issue, since I don't think that there is anything to fix. If I missed something or if you have further questions, feel free to reopen it.

@msinger msinger closed this as completed Jun 26, 2024
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

2 participants