Wrong palette on a few Donkey Kong squares (SOLVED)

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

Post Reply
radicant
Posts: 5
Joined: Wed Aug 03, 2022 12:49 pm

Wrong palette on a few Donkey Kong squares (SOLVED)

Post 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!
Last edited by radicant on Wed Aug 03, 2022 4:03 pm, edited 1 time in total.
User avatar
rainwarrior
Posts: 8402
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Wrong palette on a few Donkey Kong squares

Post 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.
radicant
Posts: 5
Joined: Wed Aug 03, 2022 12:49 pm

Re: Wrong palette on a few Donkey Kong squares

Post 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 :)
Post Reply