SNES 256 direct color mode 3 ?

Discussion of hardware and software development for Super NES and Super Famicom.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
Post Reply
alekmaul
Posts: 54
Joined: Tue Apr 24, 2012 12:22 pm
Contact:

SNES 256 direct color mode 3 ?

Post by alekmaul »

Hi all,
i'm trying to implement such mode in my library, just want to know how to manage each pixel, I read that I need to have a palette entry and also a tile entry for each pixel ...

Here is what I found about it :
The 256 color mode of mode 3/4 is called direct color mode because the values from the accumulated bitplanes are not indirect pixels for a palette like with other consoles, but instead carry direct RGB values:

BBGGGRRR

Notice there aren't all 5 bits of the master palette. So it can't access all of it. But it can access direct RGB. This has it's use. But there is something else that adds to this. The PPP palette data from the tilemap, now becomes the missing bits for the remaining RGB values from the tile:

RRR1x GGG2x BB3xx
I really don't understand how to address each pixel, does I need to put each pixel in tile entry and also in palette entry for the additionnal palette value ?
Does anyone knows how to manage it ?
Shiru
Posts: 1161
Joined: Sat Jan 23, 2010 11:41 pm

Post by Shiru »

It is called CG Direct in the official docs, so you can check these. It is optional mode. You can just use palettized 256-color graphics in Mode 3 instead.

In the CG Direct mode color is defined in a weird but simple way: every 8-bit pixel of the BG (DA0-DA7) is converted into 15-bit color as DA7 DA6 CL2 0 0 DA5 DA4 DA3 CL1 0 DA2 DA1 DA0 CL0 0. The extra three bits, CL0-CL2, are the tile palette number.
alekmaul
Posts: 54
Joined: Tue Apr 24, 2012 12:22 pm
Contact:

Post by alekmaul »

well, I checked the official docs and it's not really easy to understand (except that I need to change b0 of 1230h register) ... :(
ok, so it's also a tiled mode or a pixel per pixel mode ?
does the pixel need to be address in tile address memory or map address memory ?
Is the init for this mode the same as standard mode 3 and i just leave the palette memory uninitialized because each pixel contains the color ?
Jsolo
Posts: 27
Joined: Mon Jun 27, 2011 4:14 am
Location: Lurker Cave

Post by Jsolo »

It's still a tile mode. You upload 8 bitplanes for each tile; this tile data (also called character data) contains the highest bits of red, green, blue components.
Map data is uploaded as for all other tile modes with the exception that one bit of the 3 bit palette index is appended to each color components:

From "registers.txt"
In this mode, instead of ignoring ppp and using the character data
as the palette index, you treat the character data as expressing a color
BBGGGRRR, and use the 3 bits of ppp as bgr to make the color
Red=RRRr0, Green=GGGg0, Blue=BBb00
Post Reply