Re: [cc65] Atari TGI drivers, finally

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2009-10-25 13:40:35
On Sun, Oct 25, 2009 at 05:26:37AM -0700, Fatih Aygün wrote:
> So I assume that color values other than 0 and 1 doesn't even make it to the
> driver if it is a 2-color mode. That was what made me think that SETCOLOR
> accepts a palette index instead of colors. Or is it just that the comments are
> outdated? Even if it's the case, how one should interpret these numbers within
> the drivers with more colors in it?

You are right, I just looked at the driver, but the wrapper returns with an
error for invalid colors. Anyway, Oliver is right, the palette concept is not
very clean. This is because it was implemented as in the old Borland BGI
interface, which didn't implement it cleanly as well. Maybe I should have
shown more foresight, but now it is as it is.

> There is one additional problem with Atari. In the highest resolution mode
> (mode 8, 320x192x2), there is no way of setting the foreground color independently.
> Foreground must have the same hue as the background, but it can have a different
> brightness. There are similar restrictions for modes 9 and 11.

There are similar problems for other machines, so this is not really atari
specific.

> Well, think about this scenario: The user sets the drawing color to, let's say,
> COLOR_RED, but the default palette is white on black (or anything else, it doesn't
> matter, as long as there is no red in the palette). So he/she gets a white pixel instead
> of the expected red one. Isn't it more confusing?

That is true, but palettes *are* confusing. The alternative would be to no
longer work with colors. There wouldn't be something like tgi_setcolor() or
COLOR_RED, but tgi_setpaletteindex and PALETTE_3 or similar. This is highly
non intuitive, especially for new users.

So I would strongly suggest to keep it as it is: The palette functions are
addons that aren't really well integrated. The normal functions like
"setcolor" work with palette entries, but the names describe entries of the
default palette. So tgi_setcolor (COLOR_WHITE) will call tgi_setcolor with the
entry of the default palette that contains the color white. This has two
advantages: It is easy to grasp, as long as palettes aren't used. And it's
portable between platforms. As soon as someone starts using palettes it
becomes non portable anyway.

After all "tgi" means "tiny graphics interface". It was never thought to allow
access to the full range of possible functions for any given hardware.

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz@musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Sun Oct 25 13:41:03 2009

This archive was generated by hypermail 2.1.8 : 2009-10-25 13:41:07 CET