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

Donkey Kong 64 black screen #35

Open
Dillonb opened this issue Aug 14, 2022 · 0 comments
Open

Donkey Kong 64 black screen #35

Dillonb opened this issue Aug 14, 2022 · 0 comments

Comments

@Dillonb
Copy link
Owner

Dillonb commented Aug 14, 2022

Information about how it broke in ares:

To elaborate more on how "making the games work" is hard to use as a measure for accuracy, today invertigo and I investigated why DK64 broke after my PI DMA change to make it slower and theoretically more accurate.

First we verified on real hardware that the PI DMA timing in Ares is close enough to the real one, and it indeed is. That is, my patch that implemented correctly the "9 cop0 cycles per byte" formula is correct.

What happens is that DK64 has a short RSP loop waiting for the PI DMA to finish, with a timeout. The loop is:

1e4  lui     a1,$0020
1e8  bltz    a1,$258
1ec  mfc0    v1,SP_SEMAPHORE
1f0  bne     v1,0,$1e8
1f4  subi    a1,a1,$1

so basically it timeouts after 0x200000 iterations, and if it timeouts, DK64 is frozen. There is basically a race between PI DMA and the RSP doing 2M iterations of that loop. The PI DMA being now slower means that the RSP reaches 2M iterations before the DMA is finished.

The problem seems to be that Ares emulates the 4-insn loop in 4 RSP cycles per loop, but on real hardware we measured it takes 7 RSP cycles per loop. That's because of pipeline stalls which are not emulated in Ares. So to get DK64 unblocked with our full accuracy goal, we need to correctly emulate pipeline stalls in RSP to make sure that that loop is slow enough.

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

1 participant