Peter Dons Tychsen : winedos: Implement VGA_WritePixel for int10 service in CGA mode.
Alexandre Julliard
julliard at winehq.org
Mon Nov 10 07:44:02 CST 2008
Module: wine
Branch: master
Commit: 9d15a99a10303edb40c557016d52f9196c8447d1
URL: http://source.winehq.org/git/wine.git/?a=commit;h=9d15a99a10303edb40c557016d52f9196c8447d1
Author: Peter Dons Tychsen <donpedro at tdcadsl.dk>
Date: Mon Nov 10 03:17:50 2008 +0100
winedos: Implement VGA_WritePixel for int10 service in CGA mode.
---
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 4132f58..fbe04eb 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 f255994..772038c 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);
More information about the wine-cvs
mailing list