winedos: Implement VGA_WritePixel for int10 service in CGA mode.

This commit is contained in:
Peter Dons Tychsen 2008-11-10 03:17:50 +01:00 committed by Alexandre Julliard
parent db0a4b9c9b
commit 9d15a99a10
3 changed files with 39 additions and 2 deletions

View File

@ -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 */

View File

@ -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

View File

@ -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);