Page 1 of 1

Wrong palette on a few Donkey Kong squares (SOLVED)

Posted: Wed Aug 03, 2022 12:58 pm
by radicant
dk-blue.png
As you can see, things look good except for a 2x4 region on the right side of DK and a 1x10 region on the score.

For the DK glitch at least, my attribute lookup, $22, is the same as Mesen except Mesen picks palette 2 for all four tiles instead of only the left tiles. That doesn't seem right.

BIG CAVEAT: I'm not doing real scanline emulation and instead I'm directly reading the nametable. Is the choice of palette 2 some timing thing that happens once you do the real PPU rendering?

Thanks!

Re: Wrong palette on a few Donkey Kong squares

Posted: Wed Aug 03, 2022 1:31 pm
by rainwarrior
radicant wrote: Wed Aug 03, 2022 12:58 pmBIG CAVEAT: I'm not doing real scanline emulation and instead I'm directly reading the nametable. Is the choice of palette 2 some timing thing that happens once you do the real PPU rendering?
The nametable should have sufficient/correct data for this case. There is no mid-screen trickery going on in this game.

Maybe put a breakpoint in Mesen where that particular attribute byte is written, and try finding the corresponding thing happening in your emulator?


Edit: Actually... no, something is wrong here. Your "wrong" colours are splitting attribute regions in half already. Each 2 bits of attribute data should colour a 16x16 pixel region, not 8x8. Is this something you are doing correctly?

The score under the BONUS indicator is in the wrong colour too, and once again, it's in the same 16x16 region as the BONUS line above it, so it should be impossible for them to have different colours.

I suspect the rest of the screen below would have errors too, except for the fact that the entire rest of the screen is attribute 00.

Re: Wrong palette on a few Donkey Kong squares

Posted: Wed Aug 03, 2022 4:03 pm
by radicant
Yes, thank you! I wasn't applying the bits to four tiles. I failed at fancy bitwise math so I resorted to a lut :)