Re: [cc65] Re: TGI colors revisited

From: Karri Kaksonen <>
Date: 2011-05-06 17:13:18
On 05/05/2011 03:23 PM, Oliver Schmidt wrote:
> I'm pretty lost now: Is the brush table an indexed palette? I've been
> researching for more Lynx info but didn't come up with something
> explaining how the 'brush table' and the '12-bit hardware palette'
> work...
No wonder. The lynx has double-indexing in use.

First we have a palette with 16 12-bit entries like:

0 - RGB
1 - RGB

The sprite may have 1, 2, 3 or 4 bits per pixel.

So how can a 1-bit sprite choose a color for its pixel?

With a color lookup table containing two numbers.

If the sprites lookup table contains
$27 $00 $00 $00 $00 $00 $00 $00

Then the color 2 will be drawn if the sprite pixel is 0 and color 7 if 
the sprite pixel is one.

In the screen buffer every pixel is stored as a 4-bit value. This 4-bit 
value is drawn through the palette. So if you change the RGB values of 
color number 1 then all pixels with the value of 1 in the buffer will 

> If a TGI driver reports 16 colors than the palette used for
> tgi_getdefpalette/tgi_getpalette/tgi_setpalette _HAS_ to consist of 16
> 'unsigned char's.

Now you are missing the point. If the TGI driver reports 16 colors then 
it means that it can draw with a pen that can have values between 0 and 15.

Also the setpixel/getpixel returns a single byte that has a value 
between 0 and 15.

There is no place in the driver where we work with RGB values.For the 
sake for target-independence I'd suggest - as discussed - to
> use the C64 names.
Suits me fine.



To unsubscribe from the list send mail to with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Fri May 6 17:13:32 2011

This archive was generated by hypermail 2.1.8 : 2011-05-06 17:13:35 CEST