Re: [cc65] SimpleMenu 1.0

Date view Thread view Subject view

From: Christian Groessler (cpg_at_aladdin.de)
Date: 2002-12-06 23:44:44


Hi,

On 12/04/2002 02:46:56 PM PST "Shawn Jefferson" wrote:
>
>>
>>Hi!
>>>> Ullrich von Bassewitz <uz_at_musoftware.de> 12/04/02 12:44PM >>>
>
>>On Wed, Dec 04, 2002 at 08:23:35AM -0800, Shawn Jefferson wrote:
>>> The program compiled as is (with the modification of replacing cbm.h with
>>> atari.h), but since the Atari default text mode only supports 1 color, you
>>> only get one color.  It's a hardware difference.  There were several tricks
>>> that people did to get a 40x24 color text mode though.
>>
>>OOPS, I didn't know that, sorry. So what does then textcolor() function do?
>>Will it set all existing text to the passed color?

As already noticed, Atari 40x24 text mode is very restricted in it's
color choices. The background, border and text colors are controlled
by 3 different color registers. For background and border all
combinations are possible. But the text color is always the same color
as the background, the color register only selects the brightness.

The textcolor(), bgcolor() and bordercolor() set these color
registers.

>
>It's even worse than that, since in Graphics mode zero, the background and text are both controlled by the same color register.  Another 
>register controls the luminance value, IIRC.  So textcolor sets the color of the text AND the background!
>
>Doing a textcolor(COLOR_RED) on the atari doesn't give you red text, at least it didn't for me.

Use bgcolor() to set the color. textcolor() only selects the luminance
of the text. The c64-compatible COLOR_xxx defines don't make much
sense in this context. The brightness is specified by bits 1 to 3 of
the colorvalue, use textcolor (0xe) for max. bightness, or
textcolor(0) for max. darkness of the text.

I've attached a simple text program to explore the effects of bgcolor,
bordercolor and textcolor on the Atari.

regards,
chris


------------------------
/* $Id: color.c,v 1.3 2002/12/06 01:31:14 chris Exp $
 *
 * color test
 */

#include "conio.h"
#include "stdio.h"
#include "atari.h"

unsigned char colors[] = {
    COLOR_BLACK,
    COLOR_WHITE,
    COLOR_RED,
    COLOR_CYAN,
    COLOR_VIOLET,
    COLOR_GREEN,
    COLOR_BLUE,
    COLOR_YELLOW,
    COLOR_ORANGE,
    COLOR_BROWN,
    COLOR_LIGHTRED,
    COLOR_GRAY1,
    COLOR_GRAY2,
    COLOR_LIGHTGREEN,
    COLOR_LIGHTBLUE,
    COLOR_GRAY3,
};
#define NUMCOLORS (sizeof(colors) / sizeof(unsigned char) - 1)

unsigned char *color_names[] = {
    "COLOR_BLACK",
    "COLOR_WHITE",
    "COLOR_RED",
    "COLOR_CYAN",
    "COLOR_VIOLET",
    "COLOR_GREEN",
    "COLOR_BLUE",
    "COLOR_YELLOW",
    "COLOR_ORANGE",
    "COLOR_BROWN",
    "COLOR_LIGHTRED",
    "COLOR_GRAY1",
    "COLOR_GRAY2",
    "COLOR_LIGHTGREEN",
    "COLOR_LIGHTBLUE",
    "COLOR_GRAY3",
};

int main(void)
{
    unsigned char bg, border, text, c;
    unsigned int x, y;

    clrscr();
    printf("***********************\n");
    printf("*                     *\n");
    printf("* C O L O R   T E S T *\n");
    printf("*                     *\n");
    printf("***********************\n\n\n");

    printf("q    -  quit\n\n");
    printf("1/2  -  loop thru bgcolor\n");
    printf("5/6  -  loop thru bordercolor\n");
    printf("8/9  -  loop thru textcolor\n\n\n");

    bg = 6;      /* COLOR_BLUE */
    border = 14; /* COLOR_LIGHTBLUE */
    text = 14;   /* COLOR_LIGHTBLUE */

    x = wherex(); y = wherey();

    do {
        textcolor(colors[text]);
        bgcolor(colors[bg]);
        bordercolor(colors[border]);
        gotoxy(x,y);
        cprintf("bg:     <%02d>  %3d $%02X  %s               \r\n",
                bg, colors[bg], colors[bg], color_names[bg]);
        gotoxy(x,y + 1);
        cprintf("border: <%02d>  %3d $%02X  %s               \r\n",
                border, colors[border], colors[border], color_names[border]);
        gotoxy(x,y + 2);
        cprintf("text:   <%02d>  %3d $%02X  %s               \r\n",
                text, colors[text], colors[text], color_names[text]);
        c = cgetc();
        switch (c) {
            case '1': bg--;     if (bg == 0xff) bg = NUMCOLORS;         break;
            case '2': bg++;     if (bg > NUMCOLORS) bg = 0;             break;
            case '5': border--; if (border == 0xff) border = NUMCOLORS; break;
            case '6': border++; if (border > NUMCOLORS) border = 0;     break;
            case '8': text--;   if (text == 0xff) text = NUMCOLORS;     break;
            case '9': text++;   if (text > NUMCOLORS) text = 0;         break;
        }
    }
    while (c != 'q' && c != 'Q');

    printf("\nhit <return> to exit\n");
    cgetc();
}
------------------------

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2002-12-06 23:53:43 CET