Re: [cc65] Atari TGI drivers, finally

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2009-10-25 16:05:18
On Sun, Oct 25, 2009 at 06:23:31AM -0700, Fatih Aygün wrote:
> Maybe we should take a hybrid approach: Adding setpaletteindex but keeping
> setcolor too (which would do the mapping between colors and palettes)?

I think that approach would ask too much of most casual programmers.

> That's the exact problem I'm trying to describe. It works for c64 because
> COLOR_WHITE happens to be defined as 1. For atari it's defined as 0x0E
> and setcolor wrapper prevents me from doing any reverse mapping. Either
> the definition should change, which would break conio color routines, or
> the wrapper should pass the setcolor parameter intact. Or maybe we should
> define a new set of constants like TGI_COLOR_XXX?

The palette functions expect a palette of as many entries as there are colors
for a graphics mode, so for a two color mode, there can only be two palette
entries and 0x0E would be invalid. As you've pointed out, one of the problems
is probably mixing conio and tgi colors. But adding tgi constants is not the
solution, because they may differ from driver to driver.

What would we gain when changing tgidemo so that it doesn't use conio colors?
COLOR_FORE would then be always 1 and the program would use just the first two
color entries. Are the atari drivers able to handle

    static const unsigned char Palette[2] = { COLOR_WHITE, COLOR_BLACK };
    ...
    tgi_setpalette (Palette);

?

> There is one more problem. Should the default palette be defined as white
> on black? I assumed it would be whatever the platform's default palette is.
> So, Atari returns whitish on bluish for mode 8 and reddish on black for other
> 2-color modes. Should I change them?

This question pops up often. It boils down to something like "do we want
common behaviour between cc65 targets, or do we want common behaviour for a
specific system". I'm usually choosing the former if this is not too
disrupting for users of a specific machine. In this case, I would say use
white on black for all modes if this is possible. Please note that tgi_init
calls "tgi_setpalette (tgi_getdefpalette ());" so all that should be necessary
is to setup the default palette accordingly.

> > As soon as someone starts using palettes it becomes non portable anyway.
>
> Why is that? If the driver doesn't implement palettes, it returns an error code,
> and everything else works as expected except you get, let's say a red circle
> on a blue backrground instead of a white circle on a black background.

That is what I would call "non portable". Stuff could become non readable. Or
how about a miscoloured jpeg? Or assume you're writing an elite type game and
the background is yellow instead if black:-) This could be fixed by using
platform specific palette or color code - and having platform specific code
means the code is not portable by itself.

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 16:06:06 2009

This archive was generated by hypermail 2.1.8 : 2009-10-25 16:06:08 CET