Message-Id: Date: Sat, 2 Aug 97 23:02 MET DST To: djgpp AT delorie DOT com References: <5rpu2i$40p$1 AT grissom DOT powerup DOT com DOT au> <33E245D5 DOT 36B8 AT stud DOT warande DOT ruu DOT nl> <33E245D5 DOT 36B8 AT stud DOT warande DOT ruu DOT nl> Subject: Re: URGENT! repost: palette problems, please help. MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT From: Georg DOT Kolling AT t-online DOT de (Georg Kolling) Precedence: bulk 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