wrong background color in some games

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
wrong background color in some games
by on (#90994)
the vast majority of games have the correct background color in my emu, but a few like startropics and punchout show the wrong color. the background color should always use the color specified in $3F00, correct? this is what punchout looks like:

Image

has anybody else had this sort of a bug before? is my palette mirroring code correct? i handle it like this:

Code:
   if (addr>=0x3F00) addr = 0x3F00 | (addr & 0x1F);
   if (addr==0x3F10) addr = 0x3F00;
   if (addr==0x3F14) addr = 0x3F04;
   if (addr==0x3F18) addr = 0x3F08;
   if (addr==0x3F1C) addr = 0x3F0C;

by on (#90995)
The mirroring looks correct to me... are you applying the same rules for writing as well? When $3F10 is written to, $3F00 is overwritten.

by on (#90996)
tokumaru wrote:
The mirroring looks correct to me... are you applying the same rules for writing as well? When $3F10 is written to, $3F00 is overwritten.


yep, the code is the same in both the read and write functions.

by on (#91002)
fixed it! in case anybody else runs into this problem, these games were writing palette indexes greater than 63 into the palette RAM. when rendering, i have it AND the palette index with $7F. looks perfect.

Image

by on (#91003)
Shouldn't that be 3F?

by on (#91004)
of course, dumb mistake. thanks. i did know that, i swear. :lol: