(:toc:) 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 [[#LegacyModePalette|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 [[ControlPort|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: (:source lang=z80:)[@ ld hl, $C011 ; CRAM address $0011 with top two bits set to indicate a CRAM write ld c, $BF ; writing to control port out (c), l ; output address out (c), h ; ld a, $3F ; for the SMS, setting all six colour bits 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: (:source lang=z80:)[@ ld hl, $C000 ; CRAM address $0000 with top two bits set to indicate a CRAM write ld c, $BF ; writing to control port out (c), l ; output address out (c), h ; ld a, $FF ; lower byte of color data out ($BE), a ; data port write, CRAM unchanged, latch = $FF ld hl, $C021 ; CRAM address $0021 with top two bits set to indicate a CRAM write ld c, $BF ; writing to control port out (c), l ; output address out (c), h ; ld a, $0F ; upper byte of 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: (:table border=1:) (:headnr:)Byte (:head:)SMS1 Colour (:head:)SMS2 Colour (:cellnr:)%00010000 (:cell style="background:#000068; color:#fff":) (:cell style="background:#000055; color:#fff":) (:cellnr:)%00010001 (:cell style="background:#550068; color:#fff":) (:cell style="background:#550055; color:#fff":) (:cellnr:)%00010010 (:cell style="background:#aa0068; color:#000":) (:cell style="background:#aa0055; color:#000":) (:cellnr:)%00010011 (:cell style="background:#ff0068; color:#000":) (:cell style="background:#ff0055; color:#000":) (:cellnr:)%00010100 (:cell style="background:#005568; color:#fff":) (:cell style="background:#005555; color:#000":) (:cellnr:)%00010101 (:cell style="background:#555568; color:#fff":) (:cell style="background:#555555; color:#000":) (:cellnr:)%00010110 (:cell style="background:#aa5568; color:#fff":) (:cell style="background:#aa5555; color:#000":) (:cellnr:)%00010111 (:cell style="background:#ff5568; color:#000":) (:cell style="background:#ff5555; color:#000":) (:cellnr:)%00011000 (:cell style="background:#00aa68; color:#fff":) (:cell style="background:#00aa55; color:#000":) (:cellnr:)%00011001 (:cell style="background:#55aa68; color:#fff":) (:cell style="background:#55aa55; color:#000":) (:cellnr:)%00011010 (:cell style="background:#aaaa68; color:#fff":) (:cell style="background:#aaaa55; color:#000":) (:cellnr:)%00011011 (:cell style="background:#ffaa68; color:#000":) (:cell style="background:#ffaa55; color:#000":) (:cellnr:)%00011100 (:cell style="background:#00ff68; color:#fff":) (:cell style="background:#00ff55; color:#000":) (:cellnr:)%00011101 (:cell style="background:#55ff68; color:#000":) (:cell style="background:#55ff55; color:#000":) (:cellnr:)%00011110 (:cell style="background:#aaff68; color:#fff":) (:cell style="background:#aaff55; color:#000":) (:cellnr:)%00011111 (:cell style="background:#ffff68; color:#000":) (:cell style="background:#ffff55; color:#000":) (:tableend:) !!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 [[Games/F16FightingFalcon-SMS|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: (:table border=1:) (:headnr:)Value (:head:)Name (:head:)Colour (:cellnr:)$00 (:cell:)Transparent (:cell style="background:#000000; color:#fff":)#000000 (:cellnr:)$01 (:cell:)Black (:cell style="background:#000000; color:#fff":)#000000 (:cellnr:)$02 (:cell:)Medium Green (:cell style="background:#21C842; color:#000":)#21C842 (:cellnr:)$03 (:cell:)Light Green (:cell style="background:#5EDC78; color:#000":)#5EDC78 (:cellnr:)$04 (:cell:)Dark Blue (:cell style="background:#5455ED; color:#000":)#5455ED (:cellnr:)$05 (:cell:)Light Blue (:cell style="background:#7D76FC; color:#000":)#7D76FC (:cellnr:)$06 (:cell:)Dark Red (:cell style="background:#D4524D; color:#000":)#D4524D (:cellnr:)$07 (:cell:)Cyan (:cell style="background:#42EBF5; color:#000":)#42EBF5 (:cellnr:)$08 (:cell:)Medium Red (:cell style="background:#FC5554; color:#000":)#FC5554 (:cellnr:)$09 (:cell:)Light Red (:cell style="background:#FF7978; color:#000":)#FF7978 (:cellnr:)$0a (:cell:)Dark Yellow (:cell style="background:#D4C154; color:#000":)#D4C154 (:cellnr:)$0b (:cell:)Light Yellow (:cell style="background:#E6CE80; color:#000":)#E6CE80 (:cellnr:)$0c (:cell:)Dark Green (:cell style="background:#21B03B; color:#000":)#21B03B (:cellnr:)$0d (:cell:)Magenta (:cell style="background:#C95BBA; color:#000":)#C95BBA (:cellnr:)$0e (:cell:)Gray (:cell style="background:#CCCCCC; color:#000":)#CCCCCC (:cellnr:)$0f (:cell:)White (:cell style="background:#FFFFFF; color:#000":)#FFFFFF (:tableend:) (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. (:table border=1:) (:headnr:)Value (:head:)Name (:head:)Palette value (:head:)SMS2 Colour Approximated (:head:)TMS Colour Original (:cellnr:)$00 (:cell:)Transparent (:cell:)$00 (:cell style="background:#000000; color:#fff":)#000000 (:cell style="background:#000000; color:#fff":) (:cellnr:)$01 (:cell:)Black (:cell:)$00 (:cell style="background:#000000; color:#fff":)#000000 (:cell style="background:#000000; color:#fff":) (:cellnr:)$02 (:cell:)Medium Green (:cell:)$08 (:cell style="background:#00aa00; color:#000":)#00AA00 (:cell style="background:#21C842; color:#000":) (:cellnr:)$03 (:cell:)Light Green (:cell:)$0C (:cell style="background:#00ff00; color:#000":)#00FF00 (:cell style="background:#5EDC78; color:#000":) (:cellnr:)$04 (:cell:)Dark Blue (:cell:)$10 (:cell style="background:#000055; color:#fff":)#000055 (:cell style="background:#5455ED; color:#000":) (:cellnr:)$05 (:cell:)Light Blue (:cell:)$30 (:cell style="background:#0000ff; color:#fff":)#0000FF (:cell style="background:#7D76FC; color:#000":) (:cellnr:)$06 (:cell:)Dark Red (:cell:)$01 (:cell style="background:#550000; color:#fff":)#550000 (:cell style="background:#D4524D; color:#000":) (:cellnr:)$07 (:cell:)Cyan (:cell:)$3C (:cell style="background:#00ffff; color:#000":)#00FFFF (:cell style="background:#42EBF5; color:#000":) (:cellnr:)$08 (:cell:)Medium Red (:cell:)$02 (:cell style="background:#aa0000; color:#fff":)#AA0000 (:cell style="background:#FC5554; color:#000":) (:cellnr:)$09 (:cell:)Light Red (:cell:)$03 (:cell style="background:#ff0000; color:#fff":)#FF0000 (:cell style="background:#FF7978; color:#000":) (:cellnr:)$0a (:cell:)Dark Yellow (:cell:)$05 (:cell style="background:#555500; color:#fff":)#555500 (:cell style="background:#D4C154; color:#000":) (:cellnr:)$0b (:cell:)Light Yellow (:cell:)$0f (:cell style="background:#ffff00; color:#000":)#FFFF00 (:cell style="background:#E6CE80; color:#000":) (:cellnr:)$0c (:cell:)Dark Green (:cell:)$04 (:cell style="background:#005500; color:#fff":)#005500 (:cell style="background:#21B03B; color:#000":) (:cellnr:)$0d (:cell:)Magenta (:cell:)$33 (:cell style="background:#ff00ff; color:#000":)#FF00FF (:cell style="background:#C95BBA; color:#000":) (:cellnr:)$0e (:cell:)Gray (:cell:)$15 (:cell style="background:#555555; color:#fff":)#555555 (:cell style="background:#cccccc; color:#000":) (:cellnr:)$0f (:cell:)White (:cell:)$3f (:cell style="background:#ffffff; color:#000":)#FFFFFF (:cell style="background:#ffffff; color:#000":) (:tableend:) 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.