super mario bros attribute problems

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
super mario bros attribute problems
by on (#18567)
i got super mario bros working execpt some have problems with the attributes. running out of ideas on what i am doing wrong.

these pics will probably be removed after i fix this...

Image

Image

any suggestions to what i might have wrong ?

thanks

matt

edit: i do not have a good dump either. but the black doesnt show up on tuxnes or fceu.

by on (#18568)
The background color always comes from the first palette - you're loading it from whichever palette is being used in the tile.

by on (#18569)
thanks for the reply. here is the code for the background:

Code:
if((sprite_pixel_color & 0x3) && (!sprite_priority || ((pf_pixel_color & 0x3) == 0)))
{
   pixel_color_map[pixel_counter++] = pallet_sprite[sprite_pixel_color];
}
else
{
   pixel_color_map[pixel_counter++] = pallet[pf_pixel_color];
}


i thought i was using the correct palette for the background, unless i missing something.

thanks

matt

by on (#18570)
mattmatteh wrote:
thanks for the reply. here is the code for the background:

Code:
if((sprite_pixel_color & 0x3) && (!sprite_priority || ((pf_pixel_color & 0x3) == 0)))
{
   pixel_color_map[pixel_counter++] = pallet_sprite[sprite_pixel_color];
}
else
{
   pixel_color_map[pixel_counter++] = pallet[pf_pixel_color];
}


i thought i was using the correct palette for the background, unless i missing something.

thanks

matt


Code:
else
{
   pixel_color_map[pixel_counter++] = pallet[(pf_pixel_color & 3) ? pf_pixel_color : 0];
}


Either that, or just assure that pf_pixel_color is never 4, 8, or 12 - whenever it would normally come up with those values, it must be forced to zero.

by on (#18571)
fixed !!!!! thanks :-D

matt

by on (#21370)
does this apply to sprites too ? i would assume so.

Code:
else
{
   pixel_color_map[pixel_counter++] = sprite_pallet[(sprite_pixel_color & 3) ? sprite_pixel_color : 0];
}


thanks

matt

by on (#21371)
With sprites it's irrelevant, since color 0 is always transparent.

by on (#21377)
Quietust wrote:
With sprites it's irrelevant, since color 0 is always transparent.


So if a sprite pixel is either 0, 4, 8 or 12 then it's transparent?

Btw, don't forget the one byte PPU read delay. That's causing the title screen to appear incorrectly (unless of course you have that REALLY bad Super Mario Bros. dump).

by on (#21379)
- Just read this quote:

Quote:
Addresses $3F04/$3F08/$3F0C can contain unique data,
though these values are not used by the PPU when rendering.

Addresses $3F10/$3F14/$3F18/$3F1C are mirrors of $3F00/$3F04/$3F08/$3F0C.

by on (#21397)
wednesday wrote:
unless of course you have that REALLY bad Super Mario Bros. dump

yes, i have a bad dump. cant seem to find a good one :(

matt

by on (#21399)
As many holes as the GoodNES set has -- you'll find it very useful when developing an emu. Look around on torrent sites or P2P apps or something for the GoodNES set.

Super Mario Bros. (JU) (PRG1).nes
and
Super Mario Bros. (JU) (PRG0) [!].nes

are the dumps to look for (I generally stick with the [!] dump).

by on (#21404)
SMB/Duck Hunt is also more likely to be a good dump if you can get GNROM (one of the four easiest mappers) going.