Mail Archives: djgpp/1997/08/02/17:15:11
Elliott Oti schrieb:
> David Orme wrote:
> >
> > I'm displaying PCX files to the screen in VESA mode 0x101 (640x480x256, all
> > calls being VESA 1.2 for convenience). The problem is that the palette
> > either:
> > a) isn't being loaded correctly, or
> > b) isn't being set correctly.
> >
> > This is what I'm doing:
> >
> > byte pal[768];
> > FILE f;
> >
> > /* open the file and load the palette */
> > f=fopen("file.pcx","rb");
> > fseek(f,-768,SEEK_END);
> > fread(pal,1,768,f);
> > fclose(f);
>
>
> > /* 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.
That's just NOT CORRECT! The guys at IBM weren't as stupid as that when they
invented the VGA! Every VGA compatible graphics card increases the pel write
adress automatically after receiving 3 bytes from the pel data port. This was
done for providing fast & simple palette programming
- Raw text -