delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/25/05:35:16

From: phreadd AT powerup DOT com DOT au (David Orme)
Newsgroups: comp.os.msdos.djgpp
Subject: problem with setting the palette
Date: 25 Jul 1997 06:19:40 GMT
Organization: Power Up
Lines: 34
Message-ID: <5r9ghs$5e8$2@grissom.powerup.com.au>
Reply-To: phreadd AT powerup DOT com DOT au
NNTP-Posting-Host: ts0315.powerup.com.au
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I'm displaying PCX files to the screen in VESA mode 0x101 (640x480x256). 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);
  for(i=0;i<768;i++)
    outportb(0x3c9,pal[i]);


This isn't working!

Should I be setting the palette some other way?

Thanx in advance,

-- 
|  David Orme                 <><   |  "Striving for Excellence"  |
|  phreadd AT powerup DOT com DOT au           |                             |
|  powerup.com.au/~phreadd          |    "Professional Newbie"    |

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019