Palette Memory
9.1 Overview
The palette memory is a 512-byte read/write region that stores 256 colors in RGB565 format (5 bits red, 6 bits green, 5 bits blue). Each color entry is 16 bits (2 bytes), stored in little-endian format, meaning the low byte comes first, followed by the high byte.
Since the data bus is 8 bits wide, the Zeal Video Board latches the low byte when written, and only completes the 16-bit update when the high byte is written. For this reason, the low byte must always be written first, followed by the high byte. Writing the bytes in reverse order will result in incorrect color data.
On boot (but not on reset), the palette is preloaded with the standard VGA Mode 13h 256-color palette, providing a familiar baseline for indexed color graphics:
9.2 Writing the Palette (Z80 Example)
Let's say we have a Z80-based host system, and the video RAM is mapped at address 0x8000. The palette is located at offset 0xe00 within that space (i.e., at address 0x8e00). Here's how to write a new color to the palette memory:
; Set HL to palette base address (color 0 = 0x8e00)
ld hl, 0x8e00
; Write color 0xf4e1 to palette entry 0 (RGB565, little-endian)
ld (hl), 0xe1 ; Write low byte first
inc hl
ld (hl), 0xf4 ; Then write high byte
Alternatively, since the Z80 is little-endian, you can also write the 16-bit value directly:
ld hl, 0xf4e1
ld (0x8e00), hl ; Stored as 0xE1 (LSB), then 0xF4 (MSB)
Important: Again, Zeal Video Board latches the low byte first, so even if you're writing the word directly, make sure the low byte hits the bus before the high byte. This will happen automatically with
ld (word), hlon the Z80.
9.3 Interactive Color Picker
Choose a color using the picker below. The RGB565 value will be automatically calculated and displayed. This format is used by the Zeal video board's palette.
0x0000