www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2003/01/10/20:30:18

From: "Joel_S" <jbs30000 DOT news DOT invalid AT web2news DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: VGA DAC programming
Date: Sat, 11 Jan 2003 02:14:42 +0100
Organization: Web2news.com
Message-ID: <10780N882@web2news.com>
MIME-Version: 1.0
NNTP-Posting-Host: 198.81.26.238
X-Complaints-To: abuse AT web2news DOT net
Lines: 49
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I just ran into a problem that I've never had before trying to alter the
palettes in screen mode 0x12.  I can do this just fine using a VBDOS
compiler (QuickBasic compatible) but using DJGPP, or even the real mode
Turbo C++ 3.0 not all of the colors from 0 to 8 can be changed, and none
of the colors from 9 to 15 can be changed at all.
Here's a simple program that's supposed to
1) Switch to VGA mode 0x12
2) Change the color 12 to puple.
3) Draw a line using the color 12.
It doesn't work.  Here it is...
#include <dpmi.h>
main()
{
        // Switch to screen 12h
        unsigned int X;
        __dpmi_regs r;
        r.x.ax = 0x12;
        __dpmi_int(0x10, &r);
        /*******************/
        // Set the color 12 to bright purple
        outportb(968, 12);
        outportb(969, 63);
        outportb(969, 0);
        outportb(969, 63);
        /*******************/
        // Plot a line across half the screen
        for(X = 0; X < 320; X++) {
              r.h.ah = 0x0C;
              r.h.al = 12;
              r.h.bh = 0;
              r.x.cx = X;
              r.x.dx = 240;
              __dpmi_int(0x10, &r);
        }
        /******************/
        // Wait for a key press
        r.x.ax = 0;
        __dpmi_int(0x16, &r);
        /******************/
        // Return to text mode
        r.x.ax = 3;
        __dpmi_int(0x10, &r);
        /********************/
        // Exit this program.
        return 0;
}
Any help is appreciated, thanks.
--
Posted via http://web2news.com the faster web2news on the web

- Raw text -


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