From 9d15a99a10303edb40c557016d52f9196c8447d1 Mon Sep 17 00:00:00 2001 From: Peter Dons Tychsen Date: Mon, 10 Nov 2008 03:17:50 +0100 Subject: [PATCH] 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 4132f58235e..fbe04eb4c85 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 f25599418bc..772038c24aa 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 60444a90afe..10f5c496074 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); -- 2.11.4.GIT