Code: Select all
/*
vgacol.h
Custom VGA colors kernel extension
This extension is "always enable". When it is
"disabled" (default ;)), it is only used to make
sure all colors are displayed appropriately on all
VGA screens (BIOS-independent).
Bibliography:
http://www.brackeen.com/vga/basics.html
http://www.brackeen.com/vga/bitmaps.html
*/
#ifndef _VGACOL_H
#define _VGACOL_H
#include <atom/kernel.h>
typedef struct color_struct
{
u8int red;
u8int green;
u8int blue;
} __attribute__ ((packed)) color_t;
color_t colors[16] = {
{1, 1, 1}, /* black */
{1, 1, 32}, /* blue */
{1, 32, 1}, /* green */
{1, 32, 32}, /* cyan */
{32, 1, 1}, /* red */
{32, 1, 32}, /* magenta */
{16, 16, 1}, /* brown */
{32, 32, 32}, /* light gray */
{16, 16, 16}, /* dark gray */
{1, 1, 63}, /* light blue */
{1, 63, 1}, /* light green */
{1, 63, 63}, /* light cyan */
{63, 1, 1}, /* light red */
{63, 1, 63}, /* light magenta */
{63, 63, 1}, /* yellow */
{63, 63, 63} /* white */
};
void vgacol()
{
/* write VGA colors */
while ((inb(0x03DA) & 0x08));
while (!(inb(0x03DA) & 0x08));
int i=0;
for (i=0; i<16; i++)
{
//outb(0x03C8, i);
printdec(colors[i].red); printk(" ");
printdec(colors[i].green); printk(" ");
printdec(colors[i].blue); printk("\n");
outb(0x03C9, colors[i].red);
outb(0x03C9, colors[i].green);
outb(0x03C9, colors[i].blue);
};
while (1);
};
#endif
And yes, I know that the palette I put there is exactly the same as VGA's original one, but when I change color 15 I don't see the effect, and that's why I'm asking. Is there something I'm doing wrong?
P.S. changing light red doesn't seem to work either... only color 0 is changing...