Resub: Add VGA memory mode information & Window addresses handling
Jeremiah Flerchinger
jeremiah.flerchinger at gmail.com
Tue Feb 17 23:01:23 CST 2009
List memory read/write modes and default video memory window address for
each VGA mode. Use known display & memory modes to render, instead of
guessing on correct method based on resolution and color depth (which
was often incorrect).
---
dlls/winedos/int10.c | 14 ++-
dlls/winedos/vga.c | 220 +++++++++++++++++++++++++-------------------------
dlls/winedos/vga.h | 5 +-
3 files changed, 122 insertions(+), 117 deletions(-)
diff --git a/dlls/winedos/int10.c b/dlls/winedos/int10.c
index d49eef1..8bed0ea 100644
--- a/dlls/winedos/int10.c
+++ b/dlls/winedos/int10.c
@@ -344,7 +344,14 @@ static BOOL INT10_FillModeInformation( struct _ModeInfoBlock *mib, WORD mode )
mib->YCharSize = ptr->CharHeight;
/* 24 - BYTE: number of memory planes */
- mib->NumberOfPlanes = 1; /* FIXME */
+ if (ptr->ModeType == PLANAR_4)
+ {
+ mib->NumberOfPlanes = 4;
+ }
+ else
+ {
+ mib->NumberOfPlanes = 1;
+ }
/* 25 - BYTE: number of bits per pixel */
mib->BitsPerPixel = ptr->Depth; /* FIXME: text modes? reserved bits? */
@@ -366,10 +373,7 @@ static BOOL INT10_FillModeInformation( struct _ModeInfoBlock *mib, WORD mode )
* 08-0F - Reserved for VESA.
* 10-FF - OEM memory models.
*/
- if (ptr->ModeType == TEXT)
- mib->MemoryModel = 0; /* text mode */
- else
- mib->MemoryModel = 3; /* FIXME */
+ mib->MemoryModel = ptr->ModeType;
/* 28 - BYTE: size of bank in KB */
mib->BankSize = 0; /* FIXME */
diff --git a/dlls/winedos/vga.c b/dlls/winedos/vga.c
index e4cb9ff..c0803ac 100644
--- a/dlls/winedos/vga.c
+++ b/dlls/winedos/vga.c
@@ -51,13 +51,11 @@ static BOOL vga_retrace_horizontal;
* there are programs that depend on having two windows.
*/
#define VGA_WINDOW_SIZE (64 * 1024)
-#define VGA_WINDOW_START ((char *)0xa0000)
/*
* Size and location of CGA controller window to framebuffer.
*/
#define CGA_WINDOW_SIZE (32 * 1024)
-#define CGA_WINDOW_START ((char *)0xb8000)
/*
* VGA controller memory is emulated using linear framebuffer.
@@ -154,61 +152,61 @@ static BOOL vga_address_3c0 = TRUE;
* FIXME - verify and define support for VESA modes
* FIXME - add # bit planes, # video memory banks, & memory model
*/
-static WORD VGA_CurrentMode;
-static BOOL CGA_ColorComposite = FALSE; /* behave like composite monitor */
+static VGA_MODE CurrentMode;
+static BOOL CGA_ColorComposite = FALSE; /* composite color burst is on */
const VGA_MODE VGA_modelist[] =
{
- /* Mode, ModeType, TextCols, TextRows, CharWidth, CharHeight, Width, Height, Depth, Colors, ScreenPages, Supported*/
+ /* Mode, ModeType, WindowAddress, TextCols, TextRows, CharWidth, CharHeight, Width, Height, BitDepth, Colors, ScreenPages, Supported*/
/* VGA modes */
- {0x0000, TEXT, 40, 25, 9, 16, 360, 400, 0, 16, 8, TRUE}, /* VGA/CGA text mode 0 */
- {0x0001, TEXT, 40, 25, 9, 16, 360, 400, 0, 16, 8, TRUE}, /* VGA/CGA text mode 1 */
- {0x0002, TEXT, 80, 25, 9, 16, 360, 400, 0, 16, 8, TRUE}, /* VGA/CGA text mode 2 */
- {0x0003, TEXT, 80, 25, 9, 16, 360, 400, 0, 16, 8, TRUE}, /* VGA/CGA text mode 3 */
- {0x0004, GRAPHIC, 40, 25, 8, 8, 320, 200, 2, 4, 1, TRUE}, /* VGA/CGA graphics mode 4 */
- {0x0005, GRAPHIC, 40, 25, 8, 8, 320, 200, 2, 4, 1, TRUE}, /* VGA/CGA graphics mode 5 */
- {0x0006, GRAPHIC, 80, 25, 8, 8, 640, 200, 1, 2, 1, TRUE}, /* VGA/CGA graphics mode 6 */
- {0x0007, TEXT, 80, 25, 9, 16, 720, 400, 0, 0, 8, FALSE}, /* VGA text mode 7 - FIXME bad default address */
- {0x000d, GRAPHIC, 40, 25, 8, 8, 320, 200, 4, 16, 8, FALSE}, /* VGA graphics mode 13 */
- {0x000e, GRAPHIC, 80, 25, 8, 8, 640, 200, 4, 16, 4, FALSE}, /* VGA graphics mode 14 */
- {0x000f, GRAPHIC, 80, 25, 8, 14, 640, 350, 0, 0, 2, FALSE}, /* VGA graphics mode 15 */
- {0x0010, GRAPHIC, 80, 25, 8, 14, 640, 350, 4, 16, 2, FALSE}, /* VGA graphics mode 16 */
- {0x0012, GRAPHIC, 80, 30, 8, 16, 640, 480, 1, 2, 1, FALSE}, /* VGA graphics mode 17 */
- {0x0012, GRAPHIC, 80, 30, 8, 16, 640, 480, 4, 16, 1, FALSE}, /* VGA graphics mode 18 */
- {0x0013, GRAPHIC, 40, 25, 8, 8, 320, 200, 8, 256, 1, TRUE}, /* VGA graphics mode 19 */
+ {0x0000, TEXT, 0xb8000, 40, 25, 9, 16, 360, 400, 0, 16, 8, TRUE}, /* VGA/CGA text mode 0 */
+ {0x0001, TEXT, 0xb8000, 40, 25, 9, 16, 360, 400, 0, 16, 8, TRUE}, /* VGA/CGA text mode 1 */
+ {0x0002, TEXT, 0xb8000, 80, 25, 9, 16, 360, 400, 0, 16, 8, TRUE}, /* VGA/CGA text mode 2 */
+ {0x0003, TEXT, 0xb8000, 80, 25, 9, 16, 360, 400, 0, 16, 8, TRUE}, /* VGA/CGA text mode 3 */
+ {0x0004, CGA, 0xb8000, 40, 25, 8, 8, 320, 200, 2, 4, 1, TRUE}, /* VGA/CGA graphics mode 4 */
+ {0x0005, CGA, 0xb8000, 40, 25, 8, 8, 320, 200, 2, 4, 1, TRUE}, /* VGA/CGA graphics mode 5 */
+ {0x0006, CGA, 0xb8000, 80, 25, 8, 8, 640, 200, 1, 2, 1, TRUE}, /* VGA/CGA graphics mode 6 */
+ {0x0007, TEXT, 0xb0000, 80, 25, 9, 16, 720, 400, 0, 0, 8, TRUE}, /* VGA text mode 7 */
+ {0x000d, PLANAR_4, 0xa0000, 40, 25, 8, 8, 320, 200, 4, 16, 8, FALSE}, /* VGA graphics mode 13 */
+ {0x000e, PLANAR_4, 0xa0000, 80, 25, 8, 8, 640, 200, 4, 16, 4, FALSE}, /* VGA graphics mode 14 */
+ {0x000f, PACKED_PIXEL, 0xa0000, 80, 25, 8, 14, 640, 350, 0, 0, 2, TRUE}, /* VGA graphics mode 15 */
+ {0x0010, PLANAR_4, 0xa0000, 80, 25, 8, 14, 640, 350, 4, 16, 2, FALSE}, /* VGA graphics mode 16 */
+ {0x0012, PACKED_PIXEL, 0xa0000, 80, 30, 8, 16, 640, 480, 1, 2, 1, TRUE}, /* VGA graphics mode 17 */
+ {0x0012, PLANAR_4, 0xa0000, 80, 30, 8, 16, 640, 480, 4, 16, 1, FALSE}, /* VGA graphics mode 18 */
+ {0x0013, PACKED_PIXEL, 0xa0000, 40, 25, 8, 8, 320, 200, 8, 256, 1, TRUE}, /* VGA graphics mode 19 */
/* VESA 7-bit modes */
- {0x006a, GRAPHIC, 0, 0, 0, 0, 800, 600, 4, 16, 1, TRUE}, /* VESA graphics mode, same as 0x102 */
+ {0x006a, PLANAR_4, 0xa0000, 0, 0, 0, 0, 800, 600, 4, 16, 1, FALSE}, /* VESA graphics mode, same as 0x102 */
/* VESA 15-bit modes */
- {0x0100, GRAPHIC, 0, 0, 0, 0, 640, 400, 8, 256, 1, TRUE}, /* VESA graphics mode */
- {0x0101, GRAPHIC, 0, 0, 0, 0, 640, 480, 8, 256, 1, TRUE}, /* VESA graphics mode */
- {0x0102, GRAPHIC, 0, 0, 0, 0, 800, 600, 4, 16, 1, TRUE}, /* VESA graphics mode */
- {0x0103, GRAPHIC, 0, 0, 0, 0, 800, 600, 8, 256, 1, TRUE}, /* VESA graphics mode */
- {0x0104, GRAPHIC, 0, 0, 0, 0, 1024, 768, 4, 16, 1, TRUE}, /* VESA graphics mode */
- {0x0105, GRAPHIC, 0, 0, 0, 0, 1024, 768, 8, 256, 1, TRUE}, /* VESA graphics mode */
- {0x0106, GRAPHIC, 0, 0, 0, 0, 1280, 1024, 4, 16, 1, TRUE}, /* VESA graphics mode */
- {0x0107, GRAPHIC, 0, 0, 0, 0, 1280, 1024, 8, 256, 1, TRUE}, /* VESA graphics mode */
- {0x0108, TEXT, 0, 0, 0, 0, 80, 60, 0, 0, 1, TRUE}, /* VESA text mode */
- {0x0109, TEXT, 0, 0, 0, 0, 132, 25, 0, 0, 1, TRUE}, /* VESA text mode */
- {0x010a, TEXT, 0, 0, 0, 0, 132, 43, 0, 0, 1, TRUE}, /* VESA text mode */
- {0x010b, TEXT, 0, 0, 0, 0, 132, 50, 0, 0, 1, TRUE}, /* VESA text mode */
- {0x010c, TEXT, 0, 0, 0, 0, 132, 60, 0, 0, 1, TRUE}, /* VESA text mode */
+ {0x0100, PACKED_PIXEL, 0xa0000, 0, 0, 0, 0, 640, 400, 8, 256, 1, TRUE}, /* VESA graphics mode */
+ {0x0101, PACKED_PIXEL, 0xa0000, 0, 0, 0, 0, 640, 480, 8, 256, 1, TRUE}, /* VESA graphics mode */
+ {0x0102, PLANAR_4, 0xa0000, 0, 0, 0, 0, 800, 600, 4, 16, 1, FALSE}, /* VESA graphics mode */
+ {0x0103, PACKED_PIXEL, 0xa0000, 0, 0, 0, 0, 800, 600, 8, 256, 1, TRUE}, /* VESA graphics mode */
+ {0x0104, PLANAR_4, 0xa0000, 0, 0, 0, 0, 1024, 768, 4, 16, 1, FALSE}, /* VESA graphics mode */
+ {0x0105, PACKED_PIXEL, 0xa0000, 0, 0, 0, 0, 1024, 768, 8, 256, 1, TRUE}, /* VESA graphics mode */
+ {0x0106, PLANAR_4, 0xa0000, 0, 0, 0, 0, 1280, 1024, 4, 16, 1, FALSE}, /* VESA graphics mode */
+ {0x0107, PACKED_PIXEL, 0xa0000, 0, 0, 0, 0, 1280, 1024, 8, 256, 1, TRUE}, /* VESA graphics mode */
+ {0x0108, TEXT, 0xb8000, 0, 0, 0, 0, 80, 60, 0, 0, 1, TRUE}, /* VESA text mode */
+ {0x0109, TEXT, 0xb8000, 0, 0, 0, 0, 132, 25, 0, 0, 1, TRUE}, /* VESA text mode */
+ {0x010a, TEXT, 0xb8000, 0, 0, 0, 0, 132, 43, 0, 0, 1, TRUE}, /* VESA text mode */
+ {0x010b, TEXT, 0xb8000, 0, 0, 0, 0, 132, 50, 0, 0, 1, TRUE}, /* VESA text mode */
+ {0x010c, TEXT, 0xb8000, 0, 0, 0, 0, 132, 60, 0, 0, 1, TRUE}, /* VESA text mode */
/* VESA 1.2 modes */
- {0x010d, GRAPHIC, 0, 0, 0, 0, 320, 200, 15, 0, 1, TRUE}, /* VESA graphics mode, 32K colors */
- {0x010e, GRAPHIC, 0, 0, 0, 0, 320, 200, 16, 0, 1, TRUE}, /* VESA graphics mode, 64K colors */
- {0x010f, GRAPHIC, 0, 0, 0, 0, 320, 200, 24, 0, 1, TRUE}, /* VESA graphics mode, 16.8 Million colors */
- {0x0110, GRAPHIC, 0, 0, 0, 0, 640, 480, 15, 0, 1, TRUE}, /* VESA graphics mode, 32K colors */
- {0x0111, GRAPHIC, 0, 0, 0, 0, 640, 480, 16, 0, 1, TRUE}, /* VESA graphics mode, 64K colors */
- {0x0112, GRAPHIC, 0, 0, 0, 0, 640, 480, 24, 0, 1, TRUE}, /* VESA graphics mode, 16.8 Million colors */
- {0x0113, GRAPHIC, 0, 0, 0, 0, 800, 600, 15, 0, 1, TRUE}, /* VESA graphics mode, 32K colors */
- {0x0114, GRAPHIC, 0, 0, 0, 0, 800, 600, 16, 0, 1, TRUE}, /* VESA graphics mode, 64K colors */
- {0x0115, GRAPHIC, 0, 0, 0, 0, 800, 600, 24, 0, 1, TRUE}, /* VESA graphics mode, 16.8 Million colors */
- {0x0116, GRAPHIC, 0, 0, 0, 0, 1024, 768, 15, 0, 1, TRUE}, /* VESA graphics mode, 32K colors */
- {0x0117, GRAPHIC, 0, 0, 0, 0, 1024, 768, 16, 0, 1, TRUE}, /* VESA graphics mode, 64K colors */
- {0x0118, GRAPHIC, 0, 0, 0, 0, 1024, 768, 24, 0, 1, TRUE}, /* VESA graphics mode, 16.8 Million colors */
- {0x0119, GRAPHIC, 0, 0, 0, 0, 1280, 1024, 15, 0, 1, TRUE}, /* VESA graphics mode, 32K colors */
- {0x011a, GRAPHIC, 0, 0, 0, 0, 1280, 1024, 16, 0, 1, TRUE}, /* VESA graphics mode, 64K colors */
- {0x011b, GRAPHIC, 0, 0, 0, 0, 1280, 1024, 24, 0, 1, TRUE}, /* VESA graphics mode, 16.8 Million colors */
- {0xffff, TEXT, 0, 0, 0, 0, 0, 0, 0, 0, 1, FALSE}
+ {0x010d, DIRECT_COLOR, 0xa0000, 0, 0, 0, 0, 320, 200, 15, 0, 1, TRUE}, /* VESA graphics mode, 32K colors */
+ {0x010e, DIRECT_COLOR, 0xa0000, 0, 0, 0, 0, 320, 200, 16, 0, 1, TRUE}, /* VESA graphics mode, 64K colors */
+ {0x010f, DIRECT_COLOR, 0xa0000, 0, 0, 0, 0, 320, 200, 24, 0, 1, TRUE}, /* VESA graphics mode, 16.8 Million colors */
+ {0x0110, DIRECT_COLOR, 0xa0000, 0, 0, 0, 0, 640, 480, 15, 0, 1, TRUE}, /* VESA graphics mode, 32K colors */
+ {0x0111, DIRECT_COLOR, 0xa0000, 0, 0, 0, 0, 640, 480, 16, 0, 1, TRUE}, /* VESA graphics mode, 64K colors */
+ {0x0112, DIRECT_COLOR, 0xa0000, 0, 0, 0, 0, 640, 480, 24, 0, 1, TRUE}, /* VESA graphics mode, 16.8 Million colors */
+ {0x0113, DIRECT_COLOR, 0xa0000, 0, 0, 0, 0, 800, 600, 15, 0, 1, TRUE}, /* VESA graphics mode, 32K colors */
+ {0x0114, DIRECT_COLOR, 0xa0000, 0, 0, 0, 0, 800, 600, 16, 0, 1, TRUE}, /* VESA graphics mode, 64K colors */
+ {0x0115, DIRECT_COLOR, 0xa0000, 0, 0, 0, 0, 800, 600, 24, 0, 1, TRUE}, /* VESA graphics mode, 16.8 Million colors */
+ {0x0116, DIRECT_COLOR, 0xa0000, 0, 0, 0, 0, 1024, 768, 15, 0, 1, TRUE}, /* VESA graphics mode, 32K colors */
+ {0x0117, DIRECT_COLOR, 0xa0000, 0, 0, 0, 0, 1024, 768, 16, 0, 1, TRUE}, /* VESA graphics mode, 64K colors */
+ {0x0118, DIRECT_COLOR, 0xa0000, 0, 0, 0, 0, 1024, 768, 24, 0, 1, TRUE}, /* VESA graphics mode, 16.8 Million colors */
+ {0x0119, DIRECT_COLOR, 0xa0000, 0, 0, 0, 0, 1280, 1024, 15, 0, 1, TRUE}, /* VESA graphics mode, 32K colors */
+ {0x011a, DIRECT_COLOR, 0xa0000, 0, 0, 0, 0, 1280, 1024, 16, 0, 1, TRUE}, /* VESA graphics mode, 64K colors */
+ {0x011b, DIRECT_COLOR, 0xa0000, 0, 0, 0, 0, 1280, 1024, 24, 0, 1, TRUE}, /* VESA graphics mode, 16.8 Million colors */
+ {0xffff, TEXT, 0xb8000, 0, 0, 0, 0, 0, 0, 0, 0, 1, FALSE}
};
/*
@@ -731,7 +729,7 @@ static HANDLE VGA_AlphaConsole(void)
static char*VGA_AlphaBuffer(void)
{
- return (char *)0xb8000;
+ return (char *)CurrentMode.WindowAddress;
}
/*** GRAPHICS MODE ***/
@@ -899,13 +897,11 @@ const VGA_MODE *VGA_GetModeInfoList(void)
int VGA_SetMode(WORD mode)
{
- const VGA_MODE *ModeInfo;
/* get info on VGA mode & set appropriately */
- VGA_CurrentMode = mode;
- ModeInfo = VGA_GetModeInfo(VGA_CurrentMode);
+ CurrentMode = * VGA_GetModeInfo(mode);
/* check if mode is supported */
- if (ModeInfo->Supported)
+ if (CurrentMode.Supported)
{
FIXME("Setting VGA mode %i - Supported mode - Improve reporting of missing capabilities for modes & modetypes.\n", mode);
}
@@ -915,9 +911,9 @@ int VGA_SetMode(WORD mode)
}
/* set up graphic or text display */
- if (ModeInfo->ModeType == TEXT)
+ if (CurrentMode.ModeType == TEXT)
{
- VGA_SetAlphaMode(ModeInfo->TextCols, ModeInfo->TextRows);
+ VGA_SetAlphaMode(CurrentMode.TextCols, CurrentMode.TextRows);
}
else
{
@@ -932,22 +928,22 @@ int VGA_SetGraphicMode(WORD mode)
int newSize;
/* get info on VGA mode & set appropriately */
- const VGA_MODE *ModeInfo = VGA_GetModeInfo(VGA_CurrentMode);
+ CurrentMode = * VGA_GetModeInfo(mode);
/* check if we're assuming composite display */
- if ((mode == 6) && (CGA_ColorComposite))
+ if ((CurrentMode.Mode == 6) && (CGA_ColorComposite))
{
- vga_fb_width = (ModeInfo->Width / 4);
- vga_fb_height = ModeInfo->Height;
- vga_fb_depth = (ModeInfo->Depth * 4);
+ vga_fb_width = (CurrentMode.Width / 4);
+ vga_fb_height = CurrentMode.Height;
+ vga_fb_depth = (CurrentMode.Depth * 4);
}
else
{
- vga_fb_width = ModeInfo->Width;
- vga_fb_height = ModeInfo->Height;
- vga_fb_depth = ModeInfo->Depth;
+ vga_fb_width = CurrentMode.Width;
+ vga_fb_height = CurrentMode.Height;
+ vga_fb_depth = CurrentMode.Depth;
}
vga_fb_offset = 0;
- vga_fb_pitch = vga_fb_width * ((vga_fb_depth + 7) / 8);
+ vga_fb_pitch = CurrentMode.Width * ((CurrentMode.Depth + 7) / 8);
newSize = vga_fb_width * vga_fb_height * ((vga_fb_depth + 7) / 8);
if(newSize < 256 * 1024)
@@ -968,17 +964,15 @@ int VGA_SetGraphicMode(WORD mode)
}
/* Setup window */
+ vga_fb_window_data = (char*) CurrentMode.WindowAddress;
+ vga_fb_window_size = VGA_WINDOW_SIZE;
if(vga_fb_depth >= 8)
{
- vga_fb_window_data = VGA_WINDOW_START;
- vga_fb_window_size = VGA_WINDOW_SIZE;
vga_fb_palette = vga_def_palette;
vga_fb_palette_size = 256;
}
else
{
- vga_fb_window_data = CGA_WINDOW_START;
- vga_fb_window_size = CGA_WINDOW_SIZE;
if(vga_fb_depth == 2)
{
/* Select default 2 bit CGA palette */
@@ -1259,23 +1253,30 @@ 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);
+ if (CurrentMode.ModeType == CGA)
+ {
+ /* Calculate CGA byte offset */
+ 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;
+ /* Clear current data */
+ bits = 0x03 << pos;
+ data[off] &= ~bits;
- /* Set new data */
- bits = color << pos;
- data[off] |= bits;
+ /* Set new data */
+ bits = color << pos;
+ data[off] |= bits;
+ }
+ else
+ {
+ FIXME("VGA_WritePixel is missing mode %i support. \n", CurrentMode.Mode);
+ }
}
/*** TEXT MODE ***/
@@ -1423,10 +1424,9 @@ static void VGA_PutCharAt(unsigned x, unsigned y, BYTE ascii, int attr)
char *dat;
int ih;
int iw;
- const VGA_MODE *ModeInfo = VGA_GetModeInfo(VGA_CurrentMode);
- BITMAPINFO bmi = { sizeof( BITMAPINFOHEADER ), ModeInfo->CharWidth, -ModeInfo->CharHeight, 1, 32, BI_RGB, 0, 0, 0, 0, 0 };
+ BITMAPINFO bmi = { sizeof( BITMAPINFOHEADER ), CurrentMode.CharWidth, -CurrentMode.CharHeight, 1, 32, BI_RGB, 0, 0, 0, 0, 0 };
- if ( ModeInfo->ModeType == TEXT )
+ if ( CurrentMode.ModeType == TEXT )
{
dat = VGA_AlphaBuffer() + ((vga_text_width * y + x) * 2);
dat[0] = ascii;
@@ -1454,8 +1454,8 @@ static void VGA_PutCharAt(unsigned x, unsigned y, BYTE ascii, int attr)
IBM_hFont = (HFONT) GetStockObject( OEM_FIXED_FONT );
GetObjectA ( IBM_hFont, sizeof(LOGFONTA), & IBM_lFont );
/* scale character & set attributes - FIXME tweak or make better font for smaller sizes */
- IBM_lFont.lfWidth = ModeInfo->CharWidth;
- IBM_lFont.lfHeight = ModeInfo->CharHeight;
+ IBM_lFont.lfWidth = CurrentMode.CharWidth;
+ IBM_lFont.lfHeight = CurrentMode.CharHeight;
ModIBM_hFont = CreateFontIndirectA ( & IBM_lFont );
if (ModIBM_hFont == NULL)
{
@@ -1470,8 +1470,8 @@ static void VGA_PutCharAt(unsigned x, unsigned y, BYTE ascii, int attr)
SetBkColor(hDC, bgColor<<16); /* set text color 0x00bbggrr */
rect.left = 0;
rect.top = 0;
- rect.bottom = ModeInfo->CharHeight-1;
- rect.right = ModeInfo->CharWidth-1;
+ rect.bottom = CurrentMode.CharHeight-1;
+ rect.right = CurrentMode.CharWidth-1;
DrawTextHeight = DrawTextA(hDC, (char *)&ascii, 1, &rect, DT_LEFT);
if (DrawTextHeight == 0)
{
@@ -1481,15 +1481,15 @@ static void VGA_PutCharAt(unsigned x, unsigned y, BYTE ascii, int attr)
ReleaseDC(NULL, hDC);
return;
}
- x = x * ModeInfo->CharWidth;
- y = y * ModeInfo->CharHeight;
- for (ih = 0; ih < ModeInfo->CharHeight; ih = ih+1)
+ x = x * CurrentMode.CharWidth;
+ y = y * CurrentMode.CharHeight;
+ for (ih = 0; ih < CurrentMode.CharHeight; ih = ih+1)
{
- for (iw = 0; iw < ModeInfo->CharWidth; iw = iw+1)
+ for (iw = 0; iw < CurrentMode.CharWidth; iw = iw+1)
{
- if (VGA_CurrentMode == 19)
+ if (CurrentMode.ModeType == PACKED_PIXEL)
{
- dat[(y+ih)*ModeInfo->Width + (x+iw)] = (*( pSrcData + iw + ih*ModeInfo->CharWidth )) & 0x000000ff;
+ dat[(y+ih)*CurrentMode.Width + (x+iw)] = (*( pSrcData + iw + ih*CurrentMode.CharWidth )) & 0x000000ff;
}
else
{
@@ -1678,7 +1678,8 @@ static void VGA_Poll_Graphics(void)
* - 80 bytes per row
* - Every second line has an offset of 8096
*/
- if(vga_fb_depth == 4 && vga_fb_width == 160 && vga_fb_height == 200){
+ if ((CurrentMode.Mode==6) && (CGA_ColorComposite))
+ {
WORD off = 0;
BYTE bits = 4;
BYTE value;
@@ -1709,7 +1710,8 @@ static void VGA_Poll_Graphics(void)
* - 80 bytes per row
* - Every second line has an offset of 8096
*/
- else if(vga_fb_depth == 2 && vga_fb_width == 320 && vga_fb_height == 200){
+ else if ((CurrentMode.Mode==4) || (CurrentMode.Mode==5))
+ {
WORD off = 0;
BYTE bits = 6;
BYTE value;
@@ -1729,25 +1731,23 @@ static void VGA_Poll_Graphics(void)
}
}
}
-
/*
- * Double VGA framebuffer (320x200 -> 640x400), if needed.
+ * 4 Plane Mode Types
*/
- else if(Height >= 2 * vga_fb_height && Width >= 2 * vga_fb_width && bpp == 1)
- for (Y=0; Y<vga_fb_height; Y++,surf+=Pitch*2,dat+=vga_fb_pitch)
- for (X=0; X<vga_fb_width; X++) {
- BYTE value = dat[X];
- surf[X*2] = value;
- surf[X*2+1] = value;
- surf[X*2+Pitch] = value;
- surf[X*2+Pitch+1] = value;
- }
+ else if (CurrentMode.ModeType==PLANAR_4)
+ {
+ FIXME("Planar modes only render 1st plane - badly");
+ for (Y=0; Y<vga_fb_height; Y++,surf+=Pitch,dat+=vga_fb_pitch)
+ memcpy(surf, dat, vga_fb_width * bpp);
+ }
/*
- * Linear Buffer, including mode 19
+ * DIRECT_COLOR and PACKED_PIXEL Linear Buffer, including mode 19
*/
else
+ {
for (Y=0; Y<vga_fb_height; Y++,surf+=Pitch,dat+=vga_fb_pitch)
memcpy(surf, dat, vga_fb_width * bpp);
+ }
VGA_Unlock();
}
diff --git a/dlls/winedos/vga.h b/dlls/winedos/vga.h
index f3169f8..559aa57 100644
--- a/dlls/winedos/vga.h
+++ b/dlls/winedos/vga.h
@@ -31,11 +31,12 @@
* VGA VESA definitions
*/
/* mode descriptor */
-enum modetype {TEXT=0, GRAPHIC=1};
+enum modetype {TEXT=0, CGA=1, HERCULES=2, PLANAR_4=3, PACKED_PIXEL=4, UNCHAINED_256=5, DIRECT_COLOR=6, YUV_COLOR=7};
/* Wine internal information about video modes */
typedef struct {
WORD Mode;
- BOOL ModeType;
+ enum modetype ModeType;
+ DWORD WindowAddress; /* address for display buffer */
WORD TextCols; /* columns of text in display */
WORD TextRows; /* rows of text in display */
WORD CharWidth;
--
1.5.6.3
More information about the wine-patches
mailing list