Palette Number in Pattern Name Data

How does the palette number in pattern name data correspond to color data in color ram? Is the color ram divided into 16 identically sized areas and indexed by the palette number?

Is there a difference when the color ram mode is set to 1024?
 
The palette number is concatenated with the colour index to form the VDP2 colour RAM index. See page 22 of the VDP1 manual (Pixel Data in Frame Buffer) and the explanation of the different modes in the CMDPMOD command.
 
The palette number is concatenated with the colour index to form the VDP2 colour RAM index. See page 22 of the VDP1 manual (Pixel Data in Frame Buffer) and the explanation of the different modes in the CMDPMOD command.

I may not have understood OP's question, but I think he's referring to the Pattern Name Data (VDP2 normal/rotation screens).

If so, depending whether the PND is 1-word or 2-word and what BPP. If it's 1-word and 4-BPP, then you have the upper 3 of the 7 bits (supplementary palette number as it's referred in the VDP2 manual) concatenated with the lower 4 bits in a PND entry.

So, you have 2,048 colors. That's 128 16-color banks. From that, you need 7 bits to select one of the 128 banks. At 256-colors, you have only 8 banks, so you only need 3 bits to select one of the 8 banks. In this case, you don't need to set the supplementary palette number bits in the pattern name control register.

All of these issues go away when you go with 2-word PND.
 
Yes, that's I was looking for. I understand better now. I was confused because when copying palette data to color ram, it uses an address but accessing it used an index. In the SaturnOrbit sample I'm working from, the one with the controller, it's assuming it's working with 256 colors.

What I haven't figured out is which setting determines the number of banks in color ram. Is there one? I'm using the SGL so it might be setting one by default.

Thanks!
 
Last edited:
Yes, that's I was looking for. I understand better now. I was confused because when copying palette data to color ram, it uses an address but accessing it used an index. In the SaturnOrbit sample I'm working from, the one with the controller, it's assuming it's working with 256 colors.

What I haven't figured out is which setting determines the number of banks in color ram. Is there one? I'm using the SGL so it might be setting one by default.

Thanks!

I talked about banks to show you how many 16-color or 256-color palettes you can have stored in CRAM. If you had set NBG0/1 to be 2,048 colors, then you obviously only have 1 bank (all 2,048 colors which is 4,096 bytes). In fact, for 2,048 colors, in the PND you have no bits available for the palette index.

The other part is setting the Color RAM mode. There are 3 modes, and the general rule of thumb is that if you're not dealing with the rotational backgrounds or any other "fancy" feature, then stick with mode 0. You want all 2,048 colors. You can read more about this in the VDP2.

As for SGL, there is a function available, but I don't remember what the function name is.
 
From the docs, slCharNbg sets up the color depth and slPageNbg tells the background the addresses of where the tileset and palette are. The samples I've seen ignore passing the palette VRAM address and use Map2VRAM to add a palette index for each map element.
 
Back
Top