HuC6261 (NEW Iron Guanyin)

Controls the video output from all the VDPs.

I/O Ports

Register (W)300h
Status (R)300h
Data (R/W)304h

Status

BitsDescription
0 ~ 4Register
5 ~ 13Current raster
14When in interlaced mode, contains which field is being shown. 0 = Even field
1 = Odd field
15Currently displaying? (Not in V or H blank)

Register map

0x00Screen mode
0x01Palette number
0x02Palette data (R)
0x03Palette data (W)
0x04HuC6270 (7up) palette
0x05HuC6272 (KING) BG0/1 palette
0x06HuC6272 (KING) BG2/3 palette
0x07HuC6271 (Rainbow) palette
0x08Priority
0x09Priority
0x0AChroma Key Y
0x0BChroma Key U
0x0CChroma Key V
0x0DConstant Color
0x0ECellophane control
0x0FSprite cellophane bank select
0x10Cellophane Coefficient 1A
0x11Cellophane Coefficient 1B
0x12Cellophane Coefficient 2A
0x13Cellophane Coefficient 2B
0x14Cellophane Coefficient 3A
0x15Cellophane Coefficient 3B

Registers

0x00   Screen mode (Half)

Set screen properties.

BitsDescriptionValues
0 ~ 1Line count 00 = 263line
01 = 262line
10 = interlace
11 = Unknown
2Sync source 0 = Internal sync
1 = External sync
3Dot clock 0 = 5MHz (256px wide)
1 = 7MHz (320px wide)
6BG color depth 0 = 16 colors
1 = 256 colors
7Sprite color depth 0 = 16 colors
1 = 256 colors
8HuC6270 (7up) BG Display 0 = Hide
1 = Show
9HuC6270 (7up) SPR Display 0 = Hide
1 = Show
10HuC6272 (KING) BG0 Display 0 = Hide
1 = Show
11HuC6272 (KING) BG1 Display 0 = Hide
1 = Show
12HuC6272 (KING) BG2 Display 0 = Hide
1 = Show
13HuC6272 (KING) BG3 Display 0 = Hide
1 = Show
14HuC6271 (RAINBOW) Display 0 = Hide
1 = Show

0x01   Palette number (Half)

Select a palette/color for operation.

0x02   Palette data (Half)

Set the color data for the palette's color as selected in 0x01. Uses YUV format colors. Autoincrements 0x01 upon write.
Write only.

0x03   Palette data (Half)

The current palette color. Read only.

0x04   HuC6270 (7up) palette (Half)

HuC6270 (7up) palette offsets

BitsDescription
0 ~ 67up BG palette offset. (Upper 7 bits)
8 ~ 147up Sprite palette offset. (Upper 7 bits)

0x05   KING BG0/1 palette (Half)

HuC6272 (KING) BG0/1 palette offsets

BitsDescription
0 ~ 6KING BG0 palette offset. (Upper 7 bits)
8 ~ 14KING BG1 palette offset. (Upper 7 bits)

0x06   KING BG2/3 palette (Half)

HuC6272 (KING) BG2/3 palette offsets

BitsDescription
0 ~ 6KING BG2 palette offset. (Upper 7 bits)
8 ~ 14KING BG3 palette offset. (Upper 7 bits)

0x07   Rainbow palette (Half)

HuC6271 (Rainbow) palette offset

BitsDescription
0 ~ 6Rainbow palette offset. (Upper 7 bits)

0x08   Priority (Half)

BitsDescription
0 ~ 27up BG
4 ~ 67up SPR
8 ~ 10RAINBOW

0x09   Priority (Half)

BitsDescription
0 ~ 2KING BG0
4 ~ 6KING BG1
8 ~ 10KING BG2
12 ~ 14KING BG3

0x0A   Chroma Key Y (Half)

Chroma color key, Y portion. Top 8 bits are maximum, low 8 bits are minimum.

You can disable color keying by setting minimum greater than maximum.

0x0B   Chroma Key U (Half)

Chroma color key, U portion. Top 8 bits are maximum, low 8 bits are minimum.

You can disable color keying by setting minimum greater than maximum.

0x0C   Chroma Key V (Half)

Chroma color key, V portion. Top 8 bits are maximum, low 8 bits are minimum.

You can disable color keying by setting minimum greater than maximum.

0x0D   Constant Color (Half)

The set color register for front cellophane and back cellophane effects. Same color format as palettes.

Changes only take effect on every new line (no mid-scanline changes.)

See cellophane description for more information.

0x0E   Cellophane control (Half)

Cellophane control. The layer bits are for which coefficient set to use. 0 is disabled.

BitsDescription
0 ~ 17up BG
2 ~ 37up SPR
4 ~ 5KING BG0
6 ~ 7KING BG1
8 ~ 9KING BG2
10 ~ 11KING BG3
12 ~ 13RAINBOW
14Enable/Disable Cellophane 0 = Disable
1 = Enable
15Cellophane location 0 = Back
1 = Front

Changes only take effect on every new line (no mid-scanline changes.)

0x0F   Sprite cellophane bank select (Half)

Each bit corresponds to whether that color palette bank gets cellophane treatment.

Changes only take effect on every new line (no mid-scanline changes.)

0x10   Cellophane Coefficient 1A (Half)

Cellophane Coefficient set 1's A value.

See cellophane description for more information.

0x11   Cellophane Coefficient 1B (Half)

Cellophane Coefficient set 1's B value.

See cellophane description for more information.

0x12   Cellophane Coefficient 2A (Half)

Cellophane Coefficient set 2's A value.

See cellophane description for more information.

0x13   Cellophane Coefficient 2B (Half)

Cellophane Coefficient set 2's B value.

See cellophane description for more information.

0x14   Cellophane Coefficient 3A (Half)

Cellophane Coefficient set 3's A value.

See cellophane description for more information.

0x15   Cellophane Coefficient 3B (Half)

Cellophane Coefficient set 3's B value.

See cellophane description for more information.

Data Palette

PC-FX doesn't use an RGB palette, it uses YUV. Most common RGB -> YUV conversion formula:

Y =  0.2990R + 0.5870G + 0.1140B
U = -0.1686R - 0.3311G + 0.4997B + 0x80
V =  0.4998R - 0.4185G - 0.0813B + 0x80

The U and V values will be in the range 0 ~ 255. You must scale them to 1/16th to fit. Hword format for palette entry:

BitsDescription
0 ~ 3V (0 ~ 15)
4 ~ 7U (0 ~ 15)
8 ~ 15Y (0 ~ 255)

Cellophane description

The cellophane colors are determined using the constant color and the coefficients in the set chosen.

Coefficient values are packed like so:

BitsDescription
0 ~ 3Coefficient V value
4 ~ 7Coefficient U value
8 ~ 11Coefficient Y value

Output colors are then determined like so: (If they are above 0xFF, they get clipped back to 0xFF)

Y = ((AY / 8) *  FrontY        ) + ((BY / 8) *  BackY        )
U = ((AU / 8) * (FrontU - 0x80)) + ((BU / 8) * (BackU - 0x80)) + 0x80
V = ((AV / 8) * (FrontV - 0x80)) + ((BV / 8) * (BackV - 0x80)) + 0x80

[TOP]