mirror of
https://github.com/reactos/reactos.git
synced 2024-08-02 17:40:58 +00:00
[NTVDM]: Add a common helper to sync the BIOS cursor for the active display page, with VGA.
svn path=/branches/ntvdm/; revision=62409
This commit is contained in:
parent
667b254535
commit
7a52bcd33a
|
@ -880,24 +880,6 @@ static VOID VgaChangePalette(BYTE ModeNumber)
|
|||
VgaSetPalette(Palette, Size);
|
||||
}
|
||||
|
||||
static VOID VgaGetCursorPosition(PBYTE Row, PBYTE Column)
|
||||
{
|
||||
SHORT ScreenColumns = VgaGetDisplayResolution().X;
|
||||
BYTE OffsetLow, OffsetHigh;
|
||||
WORD Offset;
|
||||
|
||||
/* Get the cursor location */
|
||||
IOWriteB(VGA_CRTC_INDEX, VGA_CRTC_CURSOR_LOC_LOW_REG);
|
||||
OffsetLow = IOReadB(VGA_CRTC_DATA);
|
||||
IOWriteB(VGA_CRTC_INDEX, VGA_CRTC_CURSOR_LOC_HIGH_REG);
|
||||
OffsetHigh = IOReadB(VGA_CRTC_DATA);
|
||||
|
||||
Offset = MAKEWORD(OffsetLow, OffsetHigh);
|
||||
|
||||
*Row = (BYTE)(Offset / ScreenColumns);
|
||||
*Column = (BYTE)(Offset % ScreenColumns);
|
||||
}
|
||||
|
||||
static VOID VidBiosGetCursorPosition(PBYTE Row, PBYTE Column, BYTE Page)
|
||||
{
|
||||
/* Make sure the selected video page is valid */
|
||||
|
@ -929,6 +911,28 @@ static VOID VidBiosSetCursorPosition(BYTE Row, BYTE Column, BYTE Page)
|
|||
}
|
||||
}
|
||||
|
||||
VOID VidBiosSyncCursorPosition(VOID)
|
||||
{
|
||||
BYTE Row, Column;
|
||||
BYTE Low, High;
|
||||
SHORT ScreenColumns = VgaGetDisplayResolution().X;
|
||||
WORD Offset;
|
||||
|
||||
/* Get the cursor location */
|
||||
IOWriteB(VGA_CRTC_INDEX, VGA_CRTC_CURSOR_LOC_LOW_REG);
|
||||
Low = IOReadB(VGA_CRTC_DATA);
|
||||
IOWriteB(VGA_CRTC_INDEX, VGA_CRTC_CURSOR_LOC_HIGH_REG);
|
||||
High = IOReadB(VGA_CRTC_DATA);
|
||||
|
||||
Offset = MAKEWORD(Low, High);
|
||||
|
||||
Row = (BYTE)(Offset / ScreenColumns);
|
||||
Column = (BYTE)(Offset % ScreenColumns);
|
||||
|
||||
/* Synchronize our cursor position with VGA */
|
||||
VidBiosSetCursorPosition(Row, Column, Bda->VideoPage);
|
||||
}
|
||||
|
||||
BYTE VidBiosGetVideoMode(VOID)
|
||||
{
|
||||
return Bda->VideoMode;
|
||||
|
@ -1530,8 +1534,6 @@ VOID WINAPI VidBiosVideoService(LPWORD Stack)
|
|||
|
||||
BOOLEAN VidBiosInitialize(VOID)
|
||||
{
|
||||
BYTE Row, Column;
|
||||
|
||||
/* Some interrupts are in fact addresses to tables */
|
||||
((PULONG)BaseAddress)[0x1D] = (ULONG)NULL;
|
||||
((PULONG)BaseAddress)[0x1F] = (ULONG)NULL;
|
||||
|
@ -1542,9 +1544,8 @@ BOOLEAN VidBiosInitialize(VOID)
|
|||
/* Set the default video mode */
|
||||
VidBiosSetVideoMode(BIOS_DEFAULT_VIDEO_MODE);
|
||||
|
||||
/* Update cursor position */
|
||||
VgaGetCursorPosition(&Row, &Column);
|
||||
VidBiosSetCursorPosition(Row, Column, Bda->VideoPage);
|
||||
/* Synchronize our cursor position with VGA */
|
||||
VidBiosSyncCursorPosition();
|
||||
|
||||
/* Register the BIOS support BOPs */
|
||||
RegisterBop(BOP_VIDEO_INT, VidBiosVideoService);
|
||||
|
|
|
@ -39,6 +39,8 @@ enum
|
|||
|
||||
VOID WINAPI VidBiosVideoService(LPWORD Stack);
|
||||
|
||||
VOID VidBiosSyncCursorPosition(VOID);
|
||||
|
||||
BOOLEAN VidBiosInitialize(VOID);
|
||||
VOID VidBiosCleanup(VOID);
|
||||
|
||||
|
|
Loading…
Reference in a new issue