LoadPalette

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
LoadPalette
by on (#48170)
Hi, I have some difficulties to load a palette correctly.

I'm using a FF1 black mage to learn how to load ressources. And If, in my sprite I have two 8x8 tiles that use different sub-palette, I load both like that :

Code:
set $2006 $3F
set $2006 $10

//Sub-palette 01
set $2007 $0E
set $2007 $00
set $2007 $17
set $2007 $22

//Sub-palette 02
set $2007 $0E
set $2007 $22
set $2007 $21
set $2007 $00


Using Bob Rost's tools, I've prepare a 4-colors .CHR file and I load it in bank 2. But the only colors used in my NES file are of the first sub-palette.

My question : Do I have to load the colors every time prior to draw a tile that use a different set of colors? Or they're is a way to load a 32 colors palette one time at boot?

(obviously, you can see that I'm not an english speaker, and I'm sorry if you had some difficulties in reading me)

by on (#48171)
You need to specify which palette to use for each block of 16x16 pixels in the attribute table. Right now, all attribute entries are probably 0 (as opposed to 1, 2, or 3), so the tiles show up in the first (as opposed to second, third, or fourth) set of colors.


EDIT: Oops, I misread it. Edgyr was talking about the sprite palette.

by on (#48172)
I've change my code from

Code:
set $2004 24
set $2004 9
set $2004 %00000000
set $2004 8


To

Code:
set $2004 24
set $2004 9
set $2004 %00000001
set $2004 8


and my sprite used palette #1 insteed of #0... exactly like you said.
Tyvm, Tepples.

by on (#48200)
Oh? Is there another palette other than sprite/bg palette?

by on (#48201)
No, but I didn't see the $10 and (incorrectly) assumed the background palette. The background attribute table has tended to be one of the hardest things for NES newbies to get their heads around.