www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/12/28/22:30:41

From: aho450s AT nic DOT smsu DOT edu (Tony O'Bryan)
Newsgroups: comp.os.msdos.djgpp
Subject: Palette mirrors every 16 entries?
Date: 29 Dec 1996 01:02:15 GMT
Organization: Southwest Missouri State University
Lines: 46
Message-ID: <5a4fun$5b2@nr1.vancouver.istar.net>
NNTP-Posting-Host: webserver.vertigo3d.com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I am using the bcclib library that came with djgpp 2.1 to write a
sprite editor, but have run into a problem I have never encountered
before.

I set the graphics driver to SVGA256 (I even tried VESA256) with the
mode set to RES640x480.  I had intended to get a 640x480x256 graphics
screen, and I seemed to have gotten what I was after until I started
working on the palette routines.  Now the palette seems to be divided
into 16 palette of 16 identical sections: Colors
0,16,32,48,64,80,96,112,128,144,160,176,192,208,224,240 are all
identical, and any change to any one of these palettes causes the
identical change in all the other listed palettes.  The same
relationship exists for all the other 15 sets.  Here are my routines
which (attempt to) read and write the palette.  My video card is VESA
1.1 compliant.  Perhaps I am doing something wrong within these two
routines?

void Sprite::ReadDac(void)
  {
  __dpmi_regs                    Regs;

  memset(&Regs,0,sizeof(Regs));
  Regs.x.ax = 0x1017;
  Regs.x.bx = 0;
  Regs.x.cx = 256;

  Regs.x.dx = __tb & 0x0f;
  Regs.x.es = (__tb >> 4) & 0xffff;
  __dpmi_int(0x10,&Regs);
  dosmemget(__tb,256,Sprite::Palette);
  }

void Sprite::WriteDac(void)
  {
  __dpmi_regs                    Regs;

  memset(&Regs,0,sizeof(Regs));
  Regs.x.ax = 0x1012;
  Regs.x.bx = 0;
  Regs.x.cx = 256;

  dosmemput(Sprite::Palette,256,__tb);
  Regs.x.dx = __tb & 0x0f;
  Regs.x.es = (__tb >> 4) & 0xffff;
  __dpmi_int(0x10,&Regs);

- Raw text -


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