How can I read the values of each palette entry? I suppose I could set it myself and store the values in an array so I can look them up, but it would suck because I might wanna use the default palette.
Printable View
How can I read the values of each palette entry? I suppose I could set it myself and store the values in an array so I can look them up, but it would suck because I might wanna use the default palette.
You can only use one palette at a time...
no, I meant like make an array, and make my own set_palette() function so every time it put a palette entry into the vga whatever stuff, it also put it into my custom array so I would know exactly what is where, but that would suck because I usually like using the standard palette entries.
On my site I have a DOS program handling my own palettes. It's called Spriter. You could check that out, the source is included.
Basically, to set a new palette you do this:
Code://Palette structure, contains the RGB data for the palette
typedef struct
{
unsigned char Data[256*3];
} PALETTE;
//Sets RGB colors of a palette. Use this in a 256 iterations loop to build your own palette.
void SetPart(int Nr, unsigned char R, unsigned char G, unsigned char B)
{
Palette.Data[(Nr*3)]=R;
Palette.Data[(Nr*3)+1]=G;
Palette.Data[(Nr*3)+2]=B;
}
//Sets a new palette. Call this when you want to switch to your palette. It must be done when in mode 13, not else.
outp(0x03c8, 0);
for(int i=0; i<256*3; i++)
{
outp(0x03c9, Palette.Data[i]);
}
No, I can do that just fine, I want to read the palette. I want to get the rgb values of an entry, not set it to a certain value.