Bunch of minor VGA text mode fixes. Text mode start screen of original Doom works now perfectly. Unfortunately, chain-4 is not emulated... Changelog: 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. Index: dlls/winedos/vga.c =================================================================== RCS file: /home/wine/wine/dlls/winedos/vga.c,v retrieving revision 1.30 diff -u -r1.30 vga.c --- dlls/winedos/vga.c 11 Feb 2003 22:19:27 -0000 1.30 +++ dlls/winedos/vga.c 12 Feb 2003 20:31:30 -0000 @@ -608,7 +608,7 @@ * 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 @@ 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 @@ 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); } Index: dlls/winedos/int10.c =================================================================== RCS file: /home/wine/wine/dlls/winedos/int10.c,v retrieving revision 1.26 diff -u -r1.26 int10.c --- dlls/winedos/int10.c 11 Feb 2003 22:18:11 -0000 1.26 +++ dlls/winedos/int10.c 12 Feb 2003 20:31:32 -0000 @@ -90,6 +90,8 @@ {0xffff, 0, 0, 0} }; +static void INT10_SetCursorPos(BIOSDATA*, unsigned, unsigned, unsigned); + /********************************************************************** * INT10_FindMode @@ -389,6 +391,7 @@ static BOOL INT10_SetVideoMode( BIOSDATA *data, WORD mode ) { const INT10_MODE *ptr = INT10_FindMode( mode ); + BOOL clearScreen = TRUE; if (!ptr) return FALSE; @@ -400,6 +403,12 @@ 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. * * FIXME: Store VESA mode somewhere. @@ -412,21 +421,34 @@ 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; } -- Jukka Heinonen <http://www.iki.fi/jhei/>