diff --git a/subsystems/ntvdm/bios.c b/subsystems/ntvdm/bios.c index 37e84dff8a7..1af7b8b252c 100644 --- a/subsystems/ntvdm/bios.c +++ b/subsystems/ntvdm/bios.c @@ -255,6 +255,31 @@ static VOID BiosWriteWindow(LPWORD Buffer, SMALL_RECT Rectangle, BYTE Page) } } +static VOID BiosClearScreen(VOID) +{ + INT i; + BYTE PlaneMask; + + /* Save the plane write register */ + VgaWritePort(VGA_SEQ_INDEX, VGA_SEQ_MASK_REG); + PlaneMask = VgaReadPort(VGA_SEQ_DATA); + + /* Write to all planes */ + VgaWritePort(VGA_SEQ_DATA, 0x0F); + + /* Clear the screen */ + for (i = VgaGetVideoBaseAddress(); + i < VgaGetVideoLimitAddress(); + i += sizeof(DWORD)) + { + DWORD Zero = 0; + VgaWriteMemory(i, (LPVOID)&Zero, sizeof(DWORD)); + } + + /* Restore the plane write register */ + VgaWritePort(VGA_SEQ_DATA, PlaneMask); +} + /* PUBLIC FUNCTIONS ***********************************************************/ BYTE BiosGetVideoMode(VOID) @@ -304,7 +329,7 @@ BOOLEAN BiosSetVideoMode(BYTE ModeNumber) /* Update the values in the BDA */ Bda->VideoMode = ModeNumber; Bda->VideoPage = 0; - Bda->VideoPageSize = BIOS_PAGE_SIZE; + Bda->VideoPageSize = BIOS_PAGE_SIZE; Bda->VideoPageOffset = 0; /* Get the character height */ @@ -629,6 +654,8 @@ VOID BiosVideoService(LPWORD Stack) case 0x00: { BiosSetVideoMode(LOBYTE(Eax)); + BiosClearScreen(); + break; }