Re: [cc65] Colormania (was: TGI summary)

From: Ullrich von Bassewitz <>
Date: 2009-10-27 19:02:22
On Tue, Oct 27, 2009 at 12:55:10PM +0100, Oliver Schmidt wrote:
> Such a platform can define their color macros starting with black = 0
> and white = 1 for monochrome drivers, then assign the values 2 - 7 to
> the remaining colors of 3-bit drivers and then assign the values 8 -
> 15 to the remaining colors of 4-bit drivers.
> Then the macros can work for all drivers of that platform :-)

There is a case that cannot be covered by reassigning palette indices. Assume
a four color driver and an eight color driver, where the four color palette is
not a subset of the eight color palette. In this case, the colors are not
platform, but driver depdendent, so there cannot be platform speficic
TGI_COLOR_XXX #defines for a platform.

> A palette driver sets a default palette according to the values.
> Additionally - and this seems to me the important aspect missing in
> the OP above - the driver does a table lookup for every palette entry

But what is the advantage over platform specific TGI_COLOR_XXX color defines?

If we make sure that drivers for one platform have common colors at the same
indices (this may be done internally in the driver by a color remap table),
all we need are platform specific defines and we're done. This will probably
force TGI_COLOR_WHITE to be always 1, because it's usually the foreground
color for a two color driver. Platforms like the Atari, where white may
actually be represented by $0E may use a replacement table in the driver that
maps 0 => 0 for black and 1 => $0E for white.

> Then SETPALETTE needs to convert i.e. Palette[0] from '1' to '$F'
> because here the ambivalence of the color macros being both indexes
> and color values shows up.

After reading this again, I notice that we may actaally mean the same thing:-)

> Conclusion:
> - Platforms with issues due to conflicting TGI driver (and proably
> conio) color values can decide to do a "runtime color mapping" a laid
> out above.


> - At least I personally don't see an addional benefit of aligning the
> color values of all platforms (although it would be nice to have a
> large set of aligned color _names_).

Ok. Maybe we can come up with a 2, 4, 8 and 16 color palette that is usable
and where the smaller palettes are a subset of the larger ones. This is
somewhat difficult for a 4 color palette, since besides black and white there
are only two other colors. In cases where color translation to these values is
not possible, we can use platform specific color defines.



Ullrich von Bassewitz                        
To unsubscribe from the list send mail to with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Tue Oct 27 19:10:46 2009

This archive was generated by hypermail 2.1.8 : 2009-10-27 19:10:48 CET