Mail Archives: djgpp/2003/01/10/20:30:18
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 -