« on: February 14, 2013, 11:34:22 am »
Okay, I found the palette select data, but I can’t get my head around the last bit.2 bits always control a 16x16 area (1 BYTE controls a 32x32 area), that's how the PPU works.
Let’s use this one as an example (makes most of the “2” in the title use an alternative palette).
23 E3 02 88 22
23E2 = PPU Offset to store the values
02 = Number of bytes to copy
8822 = Palette select for the tiles.
From what I understand (I could be wrong), each 2 bits covers a certain area (either 16 x 16 pixels or 32 x 32 pixels, depending on the game). So converting 8822 into binary gets this:
10 00 10 00 00 10 00 10
From memory, the key would be:
00 = Palette 1
01 = Palette 2
10 = Palette 3
11 = Palette 4
So I can see the game is told to use “Palette 2”, but I don’t get how those bits tell the PPU which tiles to select.
Hopefully someone can explain it.
PPU $2000-23BF is the tilemap for the upper-left screen in VRAM (which is typically used for single-screen images like title screens). That is the area to change if you want a different tile on the screen. (each of the 4 potential screens are $400 bytes. Note that most games only support 2 screens, using either the top half or the left half, called mirroring. 4 screens requires extra PPU RAM in the cart, and I've heard prohibits the use of on-cart CPU RAM.)
To change which palette is assigned to each 16x16 pixel region, you change the attribute table. That is 23C0-23FF.
Each byte controls 4 of the 16x16 regions (2 16x16 blocks wide by 2 16x16 blocks tall). Bits 0 and 1 (the last 2-bit pair) control the upper left region, bits 2 and 3 control the upper right, bits 4 and 5 control the lower-left region, and bits 6 and 7 (the first 2-bit pair you listed) would control the lower-right.