This page is incomplete. You can refer to http://www.smspower.org/maxim/HowToProgram/Palette for additional information.

Video modes 0, 1, 2, and 3 use a fixed 16-colour palette, while the Mark III and SMS's mode 4 has two assignable 16-colour palettes; one for sprites, and one for backgrounds. The colours use two bits each for red, green and blue, and are packed in the form %00BBGGRR. To write to a palette, the colour byte is loaded into CRAM via the VDP control port, with the first 16 bytes of CRAM as the background palette and the next 16 bytes as the sprite palette. CRAM addresses after the first 32 are mirrored to the first 32. As an example, to set the second colour of the background palette to white, you'd do something like this:

    ld a, $11       ;address
    out ($BF), a
    ld a, $C0       ;code 3, CRAM write
    out ($BF), a    ;control port set
    ld a, $3F       ;all colour bits on, makes white
    out ($BE), a    ;data port write

When the first entry in the sprite palette is used by a sprite, the pixel is not drawn over the background pixel.

Updates after writes

For the SMS in mode 4, the displayed colours are updated immediately after a write to CRAM.

For the SMS in legacy modes, the colours displayed are unchanged - the TMS9918a modes use a fixed palette, but the CRAM is updated and can be used by switching back to mode 4.

For the GG in SMS mode 4, the behaviour is the same as an SMS.

For the GG in GG mode, any writes to an even address will go to a latch, and CRAM is unchanged. Any subsequent write to an odd address (even a non-consecutive one) will write two bytes to CRAM to define a single palette entry:

    ld hl, $C000       ; CRAM address $0000
    rst 10h            ; Assume this function sets the VDP address
    ld a, $FF          ; Color data
    out ($BE), a       ; CRAM unchanged, latch = $FF
    ld hl, $C021       ; CRAM address $0021
    rst 10h            ; Set the address again
    ld a, $0F          ; Color data
    out ($BE), a       ; CRAM word at $0020 is now $0FFF, and the data at $0000 is unchanged.

Nonlinear Blue

The Mark III and SMS1's VDP has the first level of blue slightly boosted in brightness, affecting 16 colours:

Byte SMS1 Colour SMS2 Colour
%00010000
%00010001
%00010010
%00010011
%00010100
%00010101
%00010110
%00010111
%00011000
%00011001
%00011010
%00011011
%00011100
%00011101
%00011110
%00011111

Legacy Mode palette

Modes 0, 1, 2, and 3 are legacy MSX1-compatible video modes. They are used by all SG-1000/SC-3000 software. The Mark III, Master System and Game Gear have some form of support for those legacy modes but the palettes are quite off. Unlicensed Korean or Taiwanese conversions of MSX1 games typically use the legacy video modes. Those games would be best played on a SG-1000 or SC-3000 but are modernly commonly experienced on a Master System with the wrong colors.

The only Master System game released in the west that uses a legacy video mode is F-16 Fighter / F-16 Fighting Falcon. Also see tagged games: http://www.smspower.org/Tags/LegacyVideo

SG-1000/SC-3000

These are the colours corresponding to the colour indices on an NTSC TMS9918a:

Value Name Colour
$00 Transparent #000000
$01 Black #000000
$02 Medium Green #21C842
$03 Light Green #5EDC78
$04 Dark Blue #5455ED
$05 Light Blue #7D76FC
$06 Dark Red #D4524D
$07 Cyan #42EBF5
$08 Medium Red #FC5554
$09 Light Red #FF7978
$0a Dark Yellow #D4C154
$0b Light Yellow #E6CE80
$0c Dark Green #21B03B
$0d Magenta #C95BBA
$0e Gray #CCCCCC
$0f White #FFFFFF

(Colour values are taken from http://bifi.msxnet.org/msxnet/tech/tms9918a.txt)

Master System/Mark III

The SMS VDP converts the TMS9918a colours into approximate equivalents in the SMS's standard 64-colour palette.

Value Name Palette value SMS2 Colour

Approximated

TMS Colour

Original

$00 Transparent $00 #000000
$01 Black $00 #000000
$02 Medium Green $08 #00AA00
$03 Light Green $0C #00FF00
$04 Dark Blue $10 #000055
$05 Light Blue $30 #0000FF
$06 Dark Red $01 #550000
$07 Cyan $3C #00FFFF
$08 Medium Red $02 #AA0000
$09 Light Red $03 #FF0000
$0a Dark Yellow $05 #555500
$0b Light Yellow $0f #FFFF00
$0c Dark Green $04 #005500
$0d Magenta $33 #FF00FF
$0e Gray $15 #555555
$0f White $3f #FFFFFF

The rightmost column is a comparison to the standard TMS9918a colours. As you can see, the SMS choices are markedly different (generally, darker).

Game Gear

The Game Gear maps the TMS9918a colours to the corresponding palette indices. However, it does not set the palette, so they are all black (or possibly other values on a console with a BIOS). If a valid palette is written, games are playable; some pirate games were hacked to do this and there is a hacked Tototek menu available that does the same thing.




Return to top
0.243s