Re: [cc65] Re: TGI colors revisited

From: Oliver Schmidt <>
Date: 2011-05-07 12:21:31
Hi Karri,

>> 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.
> [...]
> 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 change.

Thanks a lot for the detailed and very helpful explanation :-)

>> 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.

Sorry, but I'm still trying to sort misunderstandings from different opinions...

Do you want to express that my statement above "If a TGI driver
reports..." is wrong?

If yes: See this section from tgi.h:
void __fastcall__ tgi_setpalette (const unsigned char* palette);
/* Set the palette (not available with all drivers/hardware). palette is
 * a pointer to as many entries as there are colors.
- The prototype requires a pointer to unsigned char's.
- The comment states that the array size corresponds to the number of colors.

I don't see any room for interpretation from the side of the TGI driver...

> There is no place in the driver where we work with RGB values.

Sorry, but I'm not able to interpret that statement.

From looking at lynx-160-102-16.s it seems to me that
tgi_getdefpalette/tgi_getpalette/tgi_setpalette all three work with 16
entities of 2 bytes each. And that those 2 byte entities are holding 4
bit color values for the three channels RGB.

My analysis stems from:
- the 32 byte sized default palette
- the fact that palettes are read/written without conversion to what I
presume the 12-bit-hardware palette
- you wrote in older postings that palettes were directly read/written
to the hardware

So how does that fit to your statement above?

To unsubscribe from the list send mail to with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Sat, 7 May 2011 12:21:31 +0200

This archive was generated by hypermail 2.1.8 : 2011-05-07 12:21:48 CEST