Skip to content

mooneye's lcdon_write_timing-GS fails #6

@Rodrigodd

Description

@Rodrigodd

I investigated this failed test, but could not reach a conclusion on what the solution is. But I want to document here my investigation.

Analysis of test lcdon_write_timing

This test checks at which points of the PPU timeline a write to OAM and VRAM are blocked or not. They are blocked when the PPU is neither in mode 3 nor in mode 2. It tests by turning on the PPU, waiting N NOP opcodes, and then writing to the memory region.

The test is failing to write to OAM after waiting 9 NOPs when it should succeed. A NOP before or after, the writes fail as expected.

The signal that controls if the OAM is blocked is AJUJ (low if block, high if not). It is a NOR3 between ACYL (high if in mode 2), AJON (high if mode 3), and DMA_RUN.

What appears to be happening is that the test expects that a write that happens when PPU is changing from mode 2 to mode 3 should reach the OAM memory. One way for this to happen is if ACYL falls a little before AJON rises, giving a little pulse on AJUJ, enough to enable the write to OAM memory.

So I checked for the common signal responsible for changing those values. That signal is AVAP (STOP_OAM_PARSING). It resets both the latch that drives ACYL and the latch that drives AJON.

But looking at the path between those signals, it is expected that AJON rises before ACYL, which does not explain the bug:

avap -> OR -> asen -> reset.NOR_LATCH.q -> besu -> AND2 -> acyl -> in2.NOR3 -> ajuj
avap -> reset.NOR_LATCH.nq -> nxymu -> AND2 -> ajon -> in3.NOR3 -> ajuj

avap -> acyl = OR + LATCH + AND2
avap -> ajon = LATCH + AND2

Image

Close up:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions