From: Shawn Hargreaves Newsgroups: comp.os.msdos.djgpp Subject: Re: URGENT! repost: palette problems, please help. Date: Fri, 1 Aug 1997 19:30:28 +0100 Organization: None Distribution: world Message-ID: <83U8pGAEti4zEwwO@talula.demon.co.uk> References: <5rpu2i$40p$1 AT grissom DOT powerup DOT com DOT au> <33E245D5 DOT 36B8 AT stud DOT warande DOT ruu DOT nl> NNTP-Posting-Host: talula.demon.co.uk MIME-Version: 1.0 Lines: 29 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk 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.