Beginnings of dos set palatte
admiral coeyman
admiral at corner.net
Tue Mar 19 01:39:07 CST 2002
This is just the beginnings of the code that should allow DOS programs to set
their color palette.
God Bless.
--Admiral Coeyman
--
---
May you live as long as you wish and age but a single day.
http://www.dotguy.net/ admiral at corner.net
Webmaster/ Linux Administrator Computer Co-Op/CornerNet
-------------- next part --------------
Index: dlls/winedos/int10.c
===================================================================
RCS file: /home/wine/wine/dlls/winedos/int10.c,v
retrieving revision 1.2
diff -u -u -r1.2 int10.c
--- dlls/winedos/int10.c 9 Mar 2002 23:44:32 -0000 1.2
+++ dlls/winedos/int10.c 19 Mar 2002 06:32:07 -0000
@@ -562,7 +562,9 @@
case 0x10:
switch AL_reg(context) {
case 0x00: /* SET SINGLE PALETTE REGISTER */
- FIXME("Set Single Palette Register - Not Supported\n");
+ FIXME("Set Single Palette Register - Not tested\n");
+ /* BH is the value BL is the register */
+ VGA_SetColor16((int)BL_reg(context),(int)BH_reg(context));
break;
case 0x01: /* SET BORDER (OVERSCAN) */
/* Text terminals have no overscan */
@@ -570,12 +572,16 @@
break;
case 0x02: /* SET ALL PALETTE REGISTERS */
FIXME("Set all palette registers - Not Supported\n");
+ /* DX:ES points to a 17 byte table of colors */
+ /* No return data listed */
+ /* I'll have to update my table and the default palette */
break;
case 0x03: /* TOGGLE INTENSITY/BLINKING BIT */
FIXME("Toggle Intensity/Blinking Bit - Not Supported\n");
break;
case 0x07: /* GET INDIVIDUAL PALETTE REGISTER */
FIXME("Get Individual Palette Register - Not Supported\n");
+ /* BL is register to read [ 0-15 ] BH is return value */
break;
case 0x08: /* READ OVERSCAN (BORDER COLOR) REGISTER */
FIXME(
Index: dlls/winedos/vga.c
===================================================================
RCS file: /home/wine/wine/dlls/winedos/vga.c,v
retrieving revision 1.4
diff -u -u -r1.4 vga.c
--- dlls/winedos/vga.c 9 Mar 2002 23:44:32 -0000 1.4
+++ dlls/winedos/vga.c 19 Mar 2002 06:32:08 -0000
@@ -46,6 +46,33 @@
typedef HRESULT (WINAPI *DirectDrawCreateProc)(LPGUID,LPDIRECTDRAW *,LPUNKNOWN);
static DirectDrawCreateProc pDirectDrawCreate;
+/*
+ * For simplicity, I'm creating a second palette.
+ * 16 color accesses will use these pointers and insert
+ * entries from the 64-color palette into the default
+ * palette. --Robert 'Admiral' Coeyman
+ */
+
+static char vga_16_palette[17]={
+ 0x00, /* 0 - Black */
+ 0x01, /* 1 - Blue */
+ 0x02, /* 2 - Green */
+ 0x03, /* 3 - Cyan */
+ 0x04, /* 4 - Red */
+ 0x05, /* 5 - Magenta */
+ 0x14, /* 6 - Brown */
+ 0x07, /* 7 - Light gray */
+ 0x38, /* 8 - Dark gray */
+ 0x39, /* 9 - Light blue */
+ 0x3a, /* A - Light green */
+ 0x3b, /* B - Light cyan */
+ 0x3c, /* C - Light red */
+ 0x3d, /* D - Light magenta */
+ 0x3e, /* E - Yellow */
+ 0x3f, /* F - White */
+ 0x00 /* Border Color */
+};
+
static PALETTEENTRY vga_def_palette[256]={
/* red green blue */
{0x00, 0x00, 0x00}, /* 0 - Black */
@@ -67,6 +94,80 @@
{0,0,0} /* FIXME: a series of continuous rainbow hues should follow */
};
+/*
+ * This palette is the dos default, converted from 18 bit color to 24.
+ * It contains only 64 entries of colors--all others are zeros.
+ * --Robert 'Admiral' Coeyman
+ */
+static PALETTEENTRY vga_def64_palette[256]={
+/* red green blue */
+ {0x00, 0x00, 0x00}, /* 0x00 Black */
+ {0x00, 0x00, 0xaa}, /* 0x01 Blue */
+ {0x00, 0xaa, 0x00}, /* 0x02 Green */
+ {0x00, 0xaa, 0xaa}, /* 0x03 Cyan */
+ {0xaa, 0x00, 0x00}, /* 0x04 Red */
+ {0xaa, 0x00, 0xaa}, /* 0x05 Magenta */
+ {0xaa, 0xaa, 0x00}, /* 0x06 */
+ {0xaa, 0xaa, 0xaa}, /* 0x07 Light Gray */
+ {0x00, 0x00, 0x55}, /* 0x08 */
+ {0x00, 0x00, 0xff}, /* 0x09 */
+ {0x00, 0xaa, 0x55}, /* 0x0a */
+ {0x00, 0xaa, 0xff}, /* 0x0b */
+ {0xaa, 0x00, 0x55}, /* 0x0c */
+ {0xaa, 0x00, 0xff}, /* 0x0d */
+ {0xaa, 0xaa, 0x55}, /* 0x0e */
+ {0xaa, 0xaa, 0xff}, /* 0x0f */
+ {0x00, 0x55, 0x00}, /* 0x10 */
+ {0x00, 0x55, 0xaa}, /* 0x11 */
+ {0x00, 0xff, 0x00}, /* 0x12 */
+ {0x00, 0xff, 0xaa}, /* 0x13 */
+ {0xaa, 0x55, 0x00}, /* 0x14 Brown */
+ {0xaa, 0x55, 0xaa}, /* 0x15 */
+ {0xaa, 0xff, 0x00}, /* 0x16 */
+ {0xaa, 0xff, 0xaa}, /* 0x17 */
+ {0x00, 0x55, 0x55}, /* 0x18 */
+ {0x00, 0x55, 0xff}, /* 0x19 */
+ {0x00, 0xff, 0x55}, /* 0x1a */
+ {0x00, 0xff, 0xff}, /* 0x1b */
+ {0xaa, 0x55, 0x55}, /* 0x1c */
+ {0xaa, 0x55, 0xff}, /* 0x1d */
+ {0xaa, 0xff, 0x55}, /* 0x1e */
+ {0xaa, 0xff, 0xff}, /* 0x1f */
+ {0x55, 0x00, 0x00}, /* 0x20 */
+ {0x55, 0x00, 0xaa}, /* 0x21 */
+ {0x55, 0xaa, 0x00}, /* 0x22 */
+ {0x55, 0xaa, 0xaa}, /* 0x23 */
+ {0xff, 0x00, 0x00}, /* 0x24 */
+ {0xff, 0x00, 0xaa}, /* 0x25 */
+ {0xff, 0xaa, 0x00}, /* 0x26 */
+ {0xff, 0xaa, 0xaa}, /* 0x27 */
+ {0x55, 0x00, 0x55}, /* 0x28 */
+ {0x55, 0x00, 0xff}, /* 0x29 */
+ {0x55, 0xaa, 0x55}, /* 0x2a */
+ {0x55, 0xaa, 0xff}, /* 0x2b */
+ {0xff, 0x00, 0x55}, /* 0x2c */
+ {0xff, 0x00, 0xff}, /* 0x2d */
+ {0xff, 0xaa, 0x55}, /* 0x2e */
+ {0xff, 0xaa, 0xff}, /* 0x2f */
+ {0x55, 0x55, 0x00}, /* 0x30 */
+ {0x55, 0x55, 0xaa}, /* 0x31 */
+ {0x55, 0xff, 0x00}, /* 0x32 */
+ {0x55, 0xff, 0xaa}, /* 0x33 */
+ {0xff, 0x55, 0x00}, /* 0x34 */
+ {0xff, 0x55, 0xaa}, /* 0x35 */
+ {0xff, 0xff, 0x00}, /* 0x36 */
+ {0xff, 0xff, 0xaa}, /* 0x37 */
+ {0x55, 0x55, 0x55}, /* 0x38 Dark Gray */
+ {0x55, 0x55, 0xff}, /* 0x39 Light Blue */
+ {0x55, 0xff, 0x55}, /* 0x3a Light Green */
+ {0x55, 0xff, 0xff}, /* 0x3b Light Cyan */
+ {0xff, 0x55, 0x55}, /* 0x3c Light Red */
+ {0xff, 0x55, 0xff}, /* 0x3d Light Magenta */
+ {0xff, 0xff, 0x55}, /* 0x3e Yellow */
+ {0xff, 0xff, 0xff}, /* 0x3f White */
+ {0,0,0} /* The next 192 entries are all zeros */
+};
+
static void VGA_DeinstallTimer(void)
{
if (poll_timer) {
@@ -222,6 +323,17 @@
{
if (!lpddraw) return;
IDirectDrawPalette_SetEntries(lpddpal,0,start,len,pal);
+}
+
+/* set a single color in 16 color mode. */
+void VGA_SetColor16(int reg,int color)
+{
+ PALETTEENTRY *pal;
+
+ if (!lpddraw) return;
+ pal= &vga_def64_palette[color];
+ IDirectDrawPalette_SetEntries(lpddpal,0,reg,1,pal);
+ vga_16_palette[reg]=(char)color;
}
void VGA_SetQuadPalette(RGBQUAD*color,int start,int len)
Index: dlls/winedos/vga.h
===================================================================
RCS file: /home/wine/wine/dlls/winedos/vga.h,v
retrieving revision 1.2
diff -u -u -r1.2 vga.h
--- dlls/winedos/vga.h 9 Mar 2002 23:44:32 -0000 1.2
+++ dlls/winedos/vga.h 19 Mar 2002 06:32:08 -0000
@@ -29,6 +29,7 @@
int VGA_GetMode(unsigned*Height,unsigned*Width,unsigned*Depth);
void VGA_Exit(void);
void VGA_SetPalette(PALETTEENTRY*pal,int start,int len);
+void VGA_SetColor16(int reg,int color);
void VGA_SetQuadPalette(RGBQUAD*color,int start,int len);
LPSTR VGA_Lock(unsigned*Pitch,unsigned*Height,unsigned*Width,unsigned*Depth);
void VGA_Unlock(void);
More information about the wine-patches
mailing list