delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/25/19:32:57

From: mgaugy AT ix DOT netcom DOT com
Newsgroups: comp.os.msdos.djgpp
Subject: Re: vesa palette
Date: Sat, 25 Apr 1998 16:23:15 -0700
Organization: Netcom
Lines: 58
Message-ID: <35427063.5009@ix.netcom.com>
References: <199804251222 DOT OAA10543 AT legolas DOT mdh DOT se>
Reply-To: mgaugy AT ix DOT netcom DOT com
NNTP-Posting-Host: sjx-ca34-19.ix.netcom.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019