Commit 5d3b7e64 authored by Jukka Heinonen's avatar Jukka Heinonen Committed by Alexandre Julliard

VGA text mode no longer flickers and it is much faster.

VGA text mode is now initialized earlier. VGA text mode is now emulated even without console.
parent 6c5e2b67
...@@ -48,6 +48,41 @@ static void BIOS_SetCursorPos(BIOSDATA*data,unsigned page,unsigned X,unsigned Y) ...@@ -48,6 +48,41 @@ static void BIOS_SetCursorPos(BIOSDATA*data,unsigned page,unsigned X,unsigned Y)
data->VideoCursorPos[page*2+1] = Y; data->VideoCursorPos[page*2+1] = Y;
} }
/**********************************************************************
* DOSVM_InitializeVideoMode
*
* The first time this function is called VGA emulation is set to the
* default text mode.
*/
static void DOSVM_InitializeVideoMode( BIOSDATA *data )
{
static BOOL already_initialized = FALSE;
unsigned width;
unsigned height;
if(already_initialized)
return;
already_initialized = TRUE;
VGA_InitAlphaMode(&width, &height);
/*
* FIXME: Add more mappings between initial size and
* text modes.
*/
if (width >= 80 && height >= 25) {
VGA_SetAlphaMode(80, 25);
data->VideoColumns = 80;
data->VideoMode = 0x02;
} else {
VGA_SetAlphaMode(40, 25);
data->VideoColumns = 40;
data->VideoMode = 0x01;
}
}
/********************************************************************** /**********************************************************************
* DOSVM_Int10Handler (WPROCS.116) * DOSVM_Int10Handler (WPROCS.116)
* DOSVM_Int10Handler (WINEDOS16.116) * DOSVM_Int10Handler (WINEDOS16.116)
...@@ -340,6 +375,8 @@ void WINAPI DOSVM_Int10Handler( CONTEXT86 *context ) ...@@ -340,6 +375,8 @@ void WINAPI DOSVM_Int10Handler( CONTEXT86 *context )
{ {
BIOSDATA *data = BIOS_DATA; BIOSDATA *data = BIOS_DATA;
DOSVM_InitializeVideoMode( data );
switch(AH_reg(context)) { switch(AH_reg(context)) {
case 0x00: /* SET VIDEO MODE */ case 0x00: /* SET VIDEO MODE */
...@@ -365,7 +402,6 @@ void WINAPI DOSVM_Int10Handler( CONTEXT86 *context ) ...@@ -365,7 +402,6 @@ void WINAPI DOSVM_Int10Handler( CONTEXT86 *context )
switch (AL_reg(context)) { switch (AL_reg(context)) {
case 0x00: /* 40x25 */ case 0x00: /* 40x25 */
case 0x01: case 0x01:
VGA_Exit();
TRACE("Set Video Mode - Set to Text - 0x0%x\n", TRACE("Set Video Mode - Set to Text - 0x0%x\n",
AL_reg(context)); AL_reg(context));
VGA_SetAlphaMode(40, 25); VGA_SetAlphaMode(40, 25);
...@@ -374,7 +410,6 @@ void WINAPI DOSVM_Int10Handler( CONTEXT86 *context ) ...@@ -374,7 +410,6 @@ void WINAPI DOSVM_Int10Handler( CONTEXT86 *context )
case 0x02: case 0x02:
case 0x03: case 0x03:
case 0x07: case 0x07:
VGA_Exit();
TRACE("Set Video Mode - Set to Text - 0x0%x\n", TRACE("Set Video Mode - Set to Text - 0x0%x\n",
AL_reg(context)); AL_reg(context));
VGA_SetAlphaMode(80, 25); VGA_SetAlphaMode(80, 25);
...@@ -492,10 +527,7 @@ void WINAPI DOSVM_Int10Handler( CONTEXT86 *context ) ...@@ -492,10 +527,7 @@ void WINAPI DOSVM_Int10Handler( CONTEXT86 *context )
{ {
BYTE ascii, attr; BYTE ascii, attr;
TRACE("Read Character and Attribute at Cursor Position\n"); TRACE("Read Character and Attribute at Cursor Position\n");
if(!VGA_GetCharacterAtCursor(&ascii, &attr)) { VGA_GetCharacterAtCursor(&ascii, &attr);
ascii = 0;
attr = 0;
}
SET_AL( context, ascii ); SET_AL( context, ascii );
SET_AH( context, attr ); SET_AH( context, attr );
} }
...@@ -824,8 +856,7 @@ static void scroll_window(int direction, char lines, char row1, ...@@ -824,8 +856,7 @@ static void scroll_window(int direction, char lines, char row1,
{ {
if (!lines) /* Actually, clear the window */ if (!lines) /* Actually, clear the window */
{ {
if(!VGA_ClearText(row1, col1, row2, col2, attribute)) VGA_ClearText(row1, col1, row2, col2, attribute);
ERR("VGA_ClearText failed!\n");
} }
else if (direction == SCROLL_UP) else if (direction == SCROLL_UP)
{ {
...@@ -837,20 +868,22 @@ static void scroll_window(int direction, char lines, char row1, ...@@ -837,20 +868,22 @@ static void scroll_window(int direction, char lines, char row1,
} }
} }
/********************************************************************** /**********************************************************************
* DOSVM_PutChar * DOSVM_PutChar
* *
* Write single character to VGA console at the current
* cursor position and updates the BIOS cursor position.
*/ */
void WINAPI DOSVM_PutChar( BYTE ascii )
void WINAPI DOSVM_PutChar(BYTE ascii)
{ {
BIOSDATA *data = BIOS_DATA; BIOSDATA *data = BIOS_DATA;
unsigned xpos, ypos; unsigned xpos, ypos;
TRACE("char: 0x%02x(%c)\n", ascii, ascii); TRACE("char: 0x%02x(%c)\n", ascii, ascii);
VGA_PutChar(ascii); DOSVM_InitializeVideoMode( data );
if(VGA_GetCursorPos(&xpos, &ypos))
BIOS_SetCursorPos(data, 0, xpos, ypos); VGA_PutChar( ascii );
VGA_GetCursorPos( &xpos, &ypos );
BIOS_SetCursorPos( data, 0, xpos, ypos );
} }
...@@ -270,10 +270,9 @@ void WINAPI DOSVM_Int33Console(MOUSE_EVENT_RECORD *record) ...@@ -270,10 +270,9 @@ void WINAPI DOSVM_Int33Console(MOUSE_EVENT_RECORD *record)
mask |= 0x20; mask |= 0x20;
else if(!newMiddleButton && oldMiddleButton) else if(!newMiddleButton && oldMiddleButton)
mask |= 0x40; mask |= 0x40;
VGA_GetAlphaMode(&Width, &Height); if (VGA_GetAlphaMode(&Width, &Height))
QueueMouseRelay( 640 / Width * record->dwMousePosition.X,
QueueMouseRelay(640 / Width * record->dwMousePosition.X, 200 / Height * record->dwMousePosition.Y,
200 / Height * record->dwMousePosition.Y, mask );
mask);
} }
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
/* graphics mode */ /* graphics mode */
int VGA_SetMode(unsigned Xres,unsigned Yres,unsigned Depth); int VGA_SetMode(unsigned Xres,unsigned Yres,unsigned Depth);
int VGA_GetMode(unsigned*Height,unsigned*Width,unsigned*Depth); int VGA_GetMode(unsigned*Height,unsigned*Width,unsigned*Depth);
void VGA_Exit(void);
void VGA_SetPalette(PALETTEENTRY*pal,int start,int len); void VGA_SetPalette(PALETTEENTRY*pal,int start,int len);
void VGA_SetColor16(int reg,int color); void VGA_SetColor16(int reg,int color);
char VGA_GetColor16(int reg); char VGA_GetColor16(int reg);
...@@ -40,15 +39,16 @@ void VGA_SetWindowStart(int start); ...@@ -40,15 +39,16 @@ void VGA_SetWindowStart(int start);
int VGA_GetWindowStart(); int VGA_GetWindowStart();
/* text mode */ /* text mode */
int VGA_SetAlphaMode(unsigned Xres,unsigned Yres); void VGA_InitAlphaMode(unsigned*Xres,unsigned*Yres);
void VGA_SetAlphaMode(unsigned Xres,unsigned Yres);
BOOL VGA_GetAlphaMode(unsigned*Xres,unsigned*Yres); BOOL VGA_GetAlphaMode(unsigned*Xres,unsigned*Yres);
void VGA_SetCursorShape(unsigned char start_options,unsigned char end); void VGA_SetCursorShape(unsigned char start_options,unsigned char end);
void VGA_SetCursorPos(unsigned X,unsigned Y); void VGA_SetCursorPos(unsigned X,unsigned Y);
BOOL VGA_GetCursorPos(unsigned*X,unsigned*Y); void VGA_GetCursorPos(unsigned*X,unsigned*Y);
void VGA_WriteChars(unsigned X,unsigned Y,unsigned ch,int attr,int count); void VGA_WriteChars(unsigned X,unsigned Y,unsigned ch,int attr,int count);
void VGA_PutChar(BYTE ascii); void VGA_PutChar(BYTE ascii);
void VGA_SetTextAttribute(BYTE attr); void VGA_SetTextAttribute(BYTE attr);
BOOL VGA_ClearText(unsigned row1, unsigned col1, void VGA_ClearText(unsigned row1, unsigned col1,
unsigned row2, unsigned col2, unsigned row2, unsigned col2,
BYTE attr); BYTE attr);
void VGA_ScrollUpText(unsigned row1, unsigned col1, void VGA_ScrollUpText(unsigned row1, unsigned col1,
...@@ -57,7 +57,7 @@ void VGA_ScrollUpText(unsigned row1, unsigned col1, ...@@ -57,7 +57,7 @@ void VGA_ScrollUpText(unsigned row1, unsigned col1,
void VGA_ScrollDownText(unsigned row1, unsigned col1, void VGA_ScrollDownText(unsigned row1, unsigned col1,
unsigned row2, unsigned col2, unsigned row2, unsigned col2,
unsigned lines, BYTE attr); unsigned lines, BYTE attr);
BOOL VGA_GetCharacterAtCursor(BYTE *ascii, BYTE *attr); void VGA_GetCharacterAtCursor(BYTE *ascii, BYTE *attr);
/* control */ /* control */
void VGA_ioport_out(WORD port, BYTE val); void VGA_ioport_out(WORD port, BYTE val);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment