New PPU quirk while swapping palettes mid-frame?

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems.

Moderator: Moderators

Post Reply
User avatar
Vectrex2809
Posts: 94
Joined: Mon Jul 14, 2014 6:05 am
Location: Lausanne, Switzerland

New PPU quirk while swapping palettes mid-frame?

Post by Vectrex2809 » Sat Jun 22, 2019 9:40 am

So I noticed something pretty odd with my palette swapping routine on real hardware. Sometimes, when I swap palettes mid-frame, the background colour is wrong.

https://cdn.discordapp.com/attachments/ ... 000309.jpg
https://cdn.discordapp.com/attachments/ ... 001405.jpg

Here's how it should look like
https://cdn.discordapp.com/attachments/ ... 001531.jpg
https://cdn.discordapp.com/attachments/ ... 001541.jpg

Turns out it goes away if I write to $2006 before reenabling the background. (Doing 7>1>6>6 does the glitch, but 7>6>6>1 doesn't).
Also, it only happens sometimes. Sometimes it swaps the palettes as it should. By the way this was tested on a real board and on an INL board (MMC3). Is this a new quirk?

User avatar
dougeff
Posts: 2617
Joined: Fri May 08, 2015 7:17 pm
Location: DIGDUG
Contact:

Re: New PPU quirk while swapping palettes mid-frame?

Post by dougeff » Sat Jun 22, 2019 10:07 am

Is it just color index zero that is the wrong color?

If so. It could maybe be fixed by having the last write be the correct color to one of the mirrors of 3f00
nesdoug.com -- blog/tutorial on programming for the NES

User avatar
tokumaru
Posts: 11469
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: New PPU quirk while swapping palettes mid-frame?

Post by tokumaru » Sat Jun 22, 2019 12:31 pm

Mid-frame palette changes are full of "gotchas", so I wouldn't hurry into calling any odd behavior a new quirk. First we'd have to take a look at the actual code doing the palette changes, how it's timed, and try to understand why it works some of the time.

lidnariq
Posts: 8791
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: New PPU quirk while swapping palettes mid-frame?

Post by lidnariq » Sat Jun 22, 2019 12:42 pm

Other things I'd try testing:

Does it glitch if you try 7>6>1>6? 7>waste four cycles>1>6>6 ?

I can't think of a way that the known existing glitches would cause a palette write to have failed, but I could be forgetting something.

Post Reply