September 13, 2010

Developing kernel: Hex for text color?

I'm developing a kernel, but I want to know the hex values for colors. I don't really know how to phrase this question, so here's the code:

#define WHITE_TXT 0x07 // white on black text
#define GREEN_TXT //what I want to know
#define BLUE_TXT //what I want to know
#define RED_TXT //what I want to know

void k_clear_screen();
unsigned int k_printf(char *message, unsigned int line);

k_main() // like main in a normal C program
{
k_clear_screen();
k_printf("mcKlos 1.0.1 -- Copyright (c) Matthew Caswell, 2010\n", 0);
}

void k_clear_screen() // clear the entire text screen
{
char *vidmem = (char *) 0xb8000;
unsigned int i=0;
while(i < (80*25*2))
{
vidmem[i]=' ';
i++;
vidmem[i]=WHITE_TXT;
i++;
};
};

unsigned int k_printf(char *message, unsigned int line) // the message and then the line #
{
char *vidmem = (char *) 0xb8000;
unsigned int i=0;

i=(line*80*2);

while(*message!=0)
{
if(*message=='\n') // check for a new line
{
line++;
i=(line*80*2);
*message++;
} else {
vidmem[i]=*message;
*message++;
i++;
vidmem[i]=WHITE_TXT;
i++;
};
};

return(1);
};

please give me a list.