Mail Archives: djgpp/1998/04/25/19:32:57
Magnus Lindström wrote:
>
> I've been trying to config my own palette for a while now but nothing
> seems to work.. I'm using 640x480x256
> It looks like this..
>
> typedef struct {
> char alignment;
> char r;
> char g;
> char b;
> } RGB;
>
> typedef RGB Palette[256];
>
> I put my values in and calls function 09h to set the palette with the
> addres to my struct in ES:DI
> in.x.ax = 0x4F09;
> in.x.bx = 0x00;
> in.x.cx = 256;
> in.x.dx = 0;
> in.x.di = FP_OFF( Palette );
> segs.es = FP_SEG( Palette );
> int86x( 0x10, &in, &out, &segs );
> every setting is ok acording to my docs.. but failure.. when i try to
> read the palette i'm not even close to the values i put in there..
> I've also tryed this...
> outp (0x03C8,color);
> outp (0x03C9,r);
> outp (0x03C9,g);
> outp (0x03C9,b);
> I would be gratefull for any help...
>
> _______________________________________
> E-mail-> dal97mlm AT mds DOT mdh DOT se
> WWW-> mds.mdh.se/~dal97mlm/
> ICQ UIN -> 3959951
> _______________________________________
The outp() version is much faster as it doesn't have to use the slow
BIOS. You have it almost correct, but one minor modification:
outp( 0x03C6, 0xFF ); // this one
outp( 0x03C8, color );
outp( 0x03C9, r );
outp( 0x03C9, g );
outp( 0x03C9, b );
What the first outp() does is enable an update of the palette registers
inside the DAC. Otherwise, you might me updating the values of
something else and things can get a little screwy.
Hope this helps.
Michael
mgaugy AT ix DOT netcom DOT com
- Raw text -