From 5812f52976c36b4bf6872683becdc708244951ff Mon Sep 17 00:00:00 2001 From: Jukka Heinonen Date: Fri, 14 Feb 2003 19:23:16 +0000 Subject: [PATCH] Outputting backspaces should only move the cursor. Text buffer copy is now always initialized correctly. Preserve video memory flag is parsed and text screen is now really cleared when flag is clear. --- dlls/winedos/int10.c | 30 ++++++++++++++++++++++++++---- dlls/winedos/vga.c | 20 ++++++++++---------- 2 files changed, 36 insertions(+), 14 deletions(-) diff --git a/dlls/winedos/int10.c b/dlls/winedos/int10.c index 88a99442080..c5c64e7852c 100644 --- a/dlls/winedos/int10.c +++ b/dlls/winedos/int10.c @@ -90,6 +90,8 @@ static const INT10_MODE INT10_modelist[] = {0xffff, 0, 0, 0} }; +static void INT10_SetCursorPos(BIOSDATA*, unsigned, unsigned, unsigned); + /********************************************************************** * INT10_FindMode @@ -389,6 +391,7 @@ static void INT10_FillStateInformation( BYTE *buffer, BIOSDATA *data ) static BOOL INT10_SetVideoMode( BIOSDATA *data, WORD mode ) { const INT10_MODE *ptr = INT10_FindMode( mode ); + BOOL clearScreen = TRUE; if (!ptr) return FALSE; @@ -399,6 +402,12 @@ static BOOL INT10_SetVideoMode( BIOSDATA *data, WORD mode ) if (mode & 0x4000) return FALSE; + /* + * Check for VGA and VESA preserve video memory flag. + */ + if ((mode & 0x0080) || (mode & 0x8000)) + clearScreen = FALSE; + /* * Note that we do not mask out flags here on purpose. * @@ -412,21 +421,34 @@ static BOOL INT10_SetVideoMode( BIOSDATA *data, WORD mode ) if (ptr->Depth == 0) { /* Text mode. */ - TRACE( "Setting %s %dx%d text mode\n", + TRACE( "Setting %s %dx%d text mode (screen %s)\n", mode <= 0xff ? "VGA" : "VESA", - ptr->Width, ptr->Height ); + ptr->Width, ptr->Height, + clearScreen ? "cleared" : "preserved" ); + /* * FIXME: We should check here if alpha mode could be set. */ VGA_SetAlphaMode( ptr->Width, ptr->Height ); + data->VideoColumns = ptr->Width; + data->RowsOnScreenMinus1 = ptr->Height - 1; + + if (clearScreen) + { + VGA_ClearText( 0, 0, ptr->Height-1, ptr->Width-1, 0x07 ); + INT10_SetCursorPos( data, 0, 0, 0 ); + VGA_SetCursorPos( 0, 0 ); + } } else { /* Graphics mode. */ - TRACE( "Setting %s %dx%dx%d graphics mode\n", + TRACE( "Setting %s %dx%dx%d graphics mode (screen %s)\n", mode <= 0xff ? "VGA" : "VESA", - ptr->Width, ptr->Height, ptr->Depth ); + ptr->Width, ptr->Height, ptr->Depth, + clearScreen ? "cleared" : "preserved" ); + if (VGA_SetMode( ptr->Width, ptr->Height, ptr->Depth )) return FALSE; } diff --git a/dlls/winedos/vga.c b/dlls/winedos/vga.c index 89e4232975e..add2038154b 100644 --- a/dlls/winedos/vga.c +++ b/dlls/winedos/vga.c @@ -608,7 +608,7 @@ void VGA_PrepareVideoMemCopy(unsigned Xres, unsigned Yres) * actual text mode memory area to make sure the screen * does get updated fully initially */ for (i=0; i < Xres*Yres*2; i++) - *p2++ ^= *p++; /* XOR it */ + *p2++ = *p++ ^ 0xff; /* XOR it */ } /********************************************************************** @@ -736,18 +736,18 @@ void VGA_PutChar(BYTE ascii) switch(ascii) { case '\b': - VGA_PutCharAt(vga_text_x, vga_text_y, ' ', vga_text_attr); - vga_text_x--; - break; + if (vga_text_x) + vga_text_x--; + break; case '\t': - vga_text_x += ((vga_text_x + 8) & ~7) - vga_text_x; - break; + vga_text_x += ((vga_text_x + 8) & ~7) - vga_text_x; + break; case '\n': - vga_text_y++; - vga_text_x = 0; - break; + vga_text_y++; + vga_text_x = 0; + break; case '\a': break; @@ -789,7 +789,7 @@ void VGA_ClearText(unsigned row1, unsigned col1, for(y=row1; y<=row2; y++) for(x=col1; x<=col2; x++) - VGA_PutCharAt(x, y, ' ', attr); + VGA_PutCharAt(x, y, 0x20, attr); LeaveCriticalSection(&vga_lock); }