Mail Archives: djgpp/1997/08/04/16:50:32
Elliott Oti writes:
>> /* set the vga palette */
>> outportb(0x3c8,0);
> ^_______ THIS IS WHERE YOUR MISTAKE IS ***** !!!!!
>
>> for(i=0;i<768;i++)
>> outportb(0x3c9,pal[i]);
>
>Your problem is, you're only setting the *first* colour in your palette.
>For EACH entry, from 0 to 255, you have to outportb(0x3c8, i) where 0 <
>i < 255.
Actually that isn't true. The VGA hardware automatically increments the
index register after every third write, so it's quite valid to just set
the index once and then transfer an entire 768 bytes of color
information...
>Another problem with PCX files you will encounter, is that many programs
>save each rgb entry in 8 bits ie a number from 0-255, but the VGA CLUT
>is 6 bits ie from 0 to 63. You will probably need to shift each entry
That is more likely to be the problem. The color components must be
divided by four to get them into the correct format for the VGA
hardware.
--
Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
Beauty is a French phonetic corruption of a short cloth neck ornament.
- Raw text -