www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/06/08/17:07:50

Xref: news2.mv.net comp.os.msdos.djgpp:4726
From: matrix AT ionsys DOT com (MCheu)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: mode 13h -- setting/modifying pallettes?
Date: Thu, 06 Jun 1996 09:09:31 GMT
Organization: ionsys.com
Lines: 45
Message-ID: <4p5sdt$jjm@maggie.ionsys.com>
References: <4otpbl$boi AT maggie DOT ionsys DOT com>
NNTP-Posting-Host: ip-013.ionsys.com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

matrix AT ionsys DOT com (MCheu) wrote:

>Hello all,

>Could someone please direct me to a faq or something that can show me
>how to set or modify the pallette in mode 13h under djgpp?  I've found
>info on how to plot points and get into and out of mode 13h in the v2
>faq, but not on how to set the pallette with djgpp v2.  If possible,
>I'd like to find C code examples since the only examples I've been
>able to find are in ASM code for Borland C++ (they're from the Aus
>online version of Game Developer Magazine).

>Thanks very much.

>-MCheu
>-matrix AT ionsys DOT com

Thanks to everyone for the help.  I got a few suggestions on how to do
it.  It's much easier than I ever could have guessed.  In case anyone
else is interested this is the easiest method:

/* Select colour # from 0-255 (256 possible colours)
     to start from, in this case colour 0, by sending 
     the colour number to port 0x3c8 */

outportb (0x3c8, 0);

/* change colour 0 by sending colour information 
    using red, green, blue intensity numbers (valued 0-63)
    in that order to port 0x3c9 */

outportb (0x3c9, red);
outportb (0x3c9, green);
outportb (0x3c9, blue);

/* to change the rest of the pallete, just keep sending
    values to port 0x3c9
        ie.  the next 3 values sent would modify colour 1,
              the next 3 ... colour 2, etc  */



Special thanks to Mr. Daniel Kullman and Snarfy? for explaining this.


- Raw text -


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