Optimize screen clearing by implementing it as a helper function in vga.c.


svn path=/branches/ntvdm/; revision=59690
This commit is contained in:
Aleksandar Andrejevic 2013-08-10 19:30:14 +00:00
parent acf127fe24
commit b34e5646dd
3 changed files with 7 additions and 26 deletions

View file

@ -255,31 +255,6 @@ 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)
@ -654,7 +629,7 @@ VOID BiosVideoService(LPWORD Stack)
case 0x00:
{
BiosSetVideoMode(LOBYTE(Eax));
BiosClearScreen();
VgaClearMemory();
break;
}

View file

@ -1021,6 +1021,11 @@ VOID VgaWritePort(WORD Port, BYTE Data)
}
}
VOID VgaClearMemory(VOID)
{
ZeroMemory(VgaMemory, sizeof(VgaMemory));
}
VOID VgaInitialize(HANDLE TextHandle)
{
INT i, j;

View file

@ -193,6 +193,7 @@ VOID VgaReadMemory(DWORD Address, LPBYTE Buffer, DWORD Size);
VOID VgaWriteMemory(DWORD Address, LPBYTE Buffer, DWORD Size);
BYTE VgaReadPort(WORD Port);
VOID VgaWritePort(WORD Port, BYTE Data);
VOID VgaClearMemory(VOID);
VOID VgaInitialize(HANDLE TextHandle);
#endif // _VGA_H_