[comp.os.msdos.programmer] A faster alternative to

elee24@castle.ed.ac.uk (H Bruce) (02/25/91)

I am using the 320 X 200 X 256 colour graphics mode to display greyscale images.
This involves setting up each of the 256 entries in the palette with 
a grey scale. Using the _remapallpalette function this takes several seconds for
what must be a trivial task. I guess the BIOS is getting in the way.
Assuming I have a "register compatible" VGA card (which almost all of them are)
I should be able to write directly to the VGA chip.
Does anyone know the relevant port addresses for programming the VGA palette ?

Thanks,

Henry Bruce.

csq031@umaxc.weeg.uiowa.edu (02/27/91)

In article <8705@castle.ed.ac.uk> elee24@castle.ed.ac.uk (H Bruce) writes:

>I am using the 320 X 200 X 256 colour graphics mode to display
>greyscale images. This involves setting up each of the 256 entries in
>the palette with a grey scale. Using the _remapallpalette function
>this takes several seconds for what must be a trivial task. I guess
>the BIOS is getting in the way.  Assuming I have a "register
>compatible" VGA card (which almost all of them are) I should be able
>to write directly to the VGA chip.  Does anyone know the relevant port
>addresses for programming the VGA palette ?

What it looks like is that the remapallpallete calls the function to 
remap one color 256 times.  If you go direct to Bios, you can pass
a pointer to an array of RGB triples and a count of colors to update, and
do the whole palette at once.

You could also go to hardware.  The best way I've found to figure out
VGA programming is to look at the fractint sources.  (Fractint is a fractal
generator)  Fractint has a VGA driver that works transparently with nearly
all VGA cards.  They also do palette remapping with outsb, interrupts disabled.
This updates the entire palette set instantly on the user time scale.


--
             Kent Williams --- williams@umaxc.weeg.uiowa.edu 
"'Is this heaven?' --- 'No, this is Iowa'" - from the movie "Field of Dreams"
"This isn't heaven, ... this is Cleveland" - Harry Allard, in "The Stupids Die"