Implement VGA_WritePixel for int10 service in CGA mode. This causes many artifacts in older game to render correctly. E.g. the bullets in "Paratrooper".
Peter Dons Tychsen
donpedro at tdcadsl.dk
Sun Nov 9 20:17:50 CST 2008
---
dlls/winedos/int10.c | 9 +++++++--
dlls/winedos/vga.c | 31 +++++++++++++++++++++++++++++++
dlls/winedos/vga.h | 1 +
3 files changed, 39 insertions(+), 2 deletions(-)
diff --git a/dlls/winedos/int10.c b/dlls/winedos/int10.c
index 783e575..4765450 100644
--- a/dlls/winedos/int10.c
+++ b/dlls/winedos/int10.c
@@ -1272,8 +1272,13 @@ void WINAPI DOSVM_Int10Handler( CONTEXT86 *context )
break;
case 0x0c: /* WRITE GRAPHICS PIXEL */
- /* Not in graphics mode, can ignore w/o error */
- FIXME("Write Graphics Pixel - Not Supported\n");
+
+ /* Only supported in CGA mode for now */
+ if(data->VideoMode >= 4 && data->VideoMode <= 6)
+ {
+ VGA_WritePixel(AL_reg(context), BH_reg(context), CX_reg(context), DX_reg(context));
+ }
+ else FIXME("Write pixel not implemented for current mode\n");
break;
case 0x0d: /* READ GRAPHICS PIXEL */
diff --git a/dlls/winedos/vga.c b/dlls/winedos/vga.c
index 772c06e..6d19350 100644
--- a/dlls/winedos/vga.c
+++ b/dlls/winedos/vga.c
@@ -1083,6 +1083,37 @@ void VGA_SetPaletteIndex(unsigned index)
vga_fb_palette_index = index;
}
+/**********************************************************************
+ * VGA_WritePixel
+ *
+ * Write data to the framebuffer
+ * This is a property of the CGA controller, but might be supported
+ * later by other framebuffer types
+ */
+void VGA_WritePixel(unsigned color, unsigned page, unsigned col, unsigned row)
+{
+ int off;
+ int bits;
+ int pos;
+
+ /* Calculate CGA byte offset */
+ char *data = vga_fb_window_data;
+ off = row & 1 ? (8 * 1024) : 0;
+ off += (80 * (row/2));
+ off += col/4;
+
+ /* Calculate bits offset */
+ pos = 6 - (col%4 * 2);
+
+ /* Clear current data */
+ bits = 0x03 << pos;
+ data[off] &= ~bits;
+
+ /* Set new data */
+ bits = color << pos;
+ data[off] |= bits;
+}
+
/*** TEXT MODE ***/
/* prepare the text mode video memory copy that is used to only
diff --git a/dlls/winedos/vga.h b/dlls/winedos/vga.h
index 60444a9..10f5c49 100644
--- a/dlls/winedos/vga.h
+++ b/dlls/winedos/vga.h
@@ -42,6 +42,7 @@ void VGA_ShowMouse(BOOL show);
void VGA_UpdatePalette(void);
void VGA_SetPaletteIndex(unsigned index);
void VGA_SetBright(BOOL bright);
+void VGA_WritePixel(unsigned color, unsigned page, unsigned col, unsigned row);
/* text mode */
void VGA_InitAlphaMode(unsigned*Xres,unsigned*Yres);
--
1.5.4.3
--=-ogruyErNGJimmcBj7co3--
More information about the wine-patches
mailing list