Palette Mode
Title:Palette Mode
Author:89.85.199.41
Published:Sat, 11 Apr 2009 20:07:40 GMT

NTSC Palette Mode

The propeller's build in video hardware is designed for displaying graphics in 2 color mode or 4 color mode NTSC.

2 Color Mode

Using this mode a program can display 2 colors per 32 horizontal pixels.
Data is sent to the video hardware using a WAITVID palette,pixels instruction. palette is a long value with a palette of 2 colors.

Byte 3 (MSB)

Byte 2

Byte 1

Byte 0 (LSB)

don't care
don't care
Color 1
Color 0
data is a long containing 32 single bit pixels. The color displayed is looked up from the palette. The least significant bit is displayed first.

4 Color Mode

Using this mode a program can display 4 colors per 16 horizontal pixels.
Data is sent to the video hardware using a WAITVID palette,pixels instruction. palette is a long value with a palette of 4 colors.

Byte 3 (MSB)

Byte 2

Byte 1

Byte 0 (LSB)

Color 3
Color 2
Color 1
Color 0
pixels is a long containing 16 two-bit pixels. The color displayed is looked up from the palette. The least significant bit-pair is displayed first.

Hi-Color Mode

This is a trick used for a mode that can display all 86 colors on any pixel. The VCFG register is set up for a 4 color mode, but the VSCL register is set up such that it only outputs 4 pixels per WAITVID. Data is then sent to the video hardware using a WAITVID palette,#%%3210 instruction. So each of the 4 pixels will always display one of the 4 palette colors. This means that we can just set the palette to the 4 colors we want to display in order.

e.g. To display 4 pixels of black ($02), white ($06), yellow ($5D) and blue ($FB):
WAITVID colors,#%%3210
' %%3210 == 11 10 01 00 (4 pixels pattern)
' 1st pixel will be color 0 ($02, black)
' 2nd pixel will be color 1 ($06, white)
' 3rd pixel will be color 2 ($5D, yellow)
' 4th pixel will be color 3 ($FB, blue)
...
colors LONG $02_06_5D_FB