Sega Master System / Mark III / Game Gear
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:
When the first entry in the sprite palette is used by a sprite, the pixel is not drawn over the background pixel.
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:
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|
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.
These are the colours corresponding to the colour indices on an NTSC TMS9918a:
(Colour values are taken from http://bifi.msxnet.org/msxnet/tech/tms9918a.txt)
The SMS VDP converts the TMS9918a colours into approximate equivalents in the SMS's standard 64-colour palette.
|Value||Name||Palette value||SMS2 Colour
The rightmost column is a comparison to the standard TMS9918a colours. As you can see, the SMS choices are markedly different (generally, darker).
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.