[NTVDM]: We can call now directly the interrupts instead of the internal functions BiosPeekCharacter and VidBiosPrintCharacter (so that if some program hooks them, we behave correctly).

svn path=/branches/ntvdm/; revision=62311
This commit is contained in:
Hermès Bélusca-Maïto 2014-02-23 19:43:31 +00:00
parent b33a34bec1
commit 6f5166457c
6 changed files with 35 additions and 10 deletions

View file

@ -81,7 +81,7 @@ static BOOLEAN BiosKbdBufferPop(VOID)
return TRUE;
}
WORD BiosPeekCharacter(VOID)
static WORD BiosPeekCharacter(VOID)
{
WORD CharacterData = 0;

View file

@ -38,7 +38,6 @@
/* FUNCTIONS ******************************************************************/
WORD BiosPeekCharacter(VOID);
WORD BiosGetCharacter(VOID);
BOOLEAN KbdBios32Initialize(HANDLE ConsoleInput);

View file

@ -1045,7 +1045,7 @@ static BOOLEAN VidBiosSetVideoPage(BYTE PageNumber)
return TRUE;
}
VOID VidBiosPrintCharacter(CHAR Character, BYTE Attribute, BYTE Page)
static VOID VidBiosPrintCharacter(CHAR Character, BYTE Attribute, BYTE Page)
{
WORD CharData = MAKEWORD(Character, Attribute);
BYTE Row, Column;

View file

@ -36,8 +36,6 @@ enum
/* FUNCTIONS ******************************************************************/
VOID VidBiosPrintCharacter(CHAR Character, BYTE Attribute, BYTE Page);
BOOLEAN VidBios32Initialize(HANDLE BiosConsoleOutput);
VOID VidBios32Cleanup(VOID);

View file

@ -93,8 +93,18 @@ BOOLEAN DosCheckInput(VOID)
if (IsConsoleHandle(Handle))
{
/* Save AX */
USHORT AX = getAX();
/* Call the BIOS */
return (BiosPeekCharacter() != 0xFFFF);
setAH(0x01); // or 0x11 for enhanced, but what to choose?
Int32Call(&DosContext, BIOS_KBD_INTERRUPT);
/* Restore AX */
setAX(AX);
/* Return keyboard status */
return (getZF() == 0);
}
else
{

View file

@ -809,8 +809,23 @@ WORD DosWriteFile(WORD FileHandle, LPVOID Buffer, WORD Count, LPWORD BytesWritte
{
for (i = 0; i < Count; i++)
{
/* Call the BIOS to print the character */
VidBiosPrintCharacter(((LPBYTE)Buffer)[i], DOS_CHAR_ATTRIBUTE, Bda->VideoPage);
/* Save AX and BX */
USHORT AX = getAX();
USHORT BX = getBX();
/* Set the parameters */
setAL(((PCHAR)Buffer)[i]);
setBL(DOS_CHAR_ATTRIBUTE);
setBH(Bda->VideoPage);
/* Call the BIOS INT 10h, AH=0Eh "Teletype Output" */
setAH(0x0E);
Int32Call(&DosContext, BIOS_VIDEO_INTERRUPT);
/* Restore AX and BX */
setBX(BX);
setAX(AX);
BytesWritten32++;
}
}
@ -2513,14 +2528,17 @@ VOID WINAPI DosFastConOut(LPWORD Stack)
USHORT AX = getAX();
USHORT BX = getBX();
/* Set the parameters (AL = character, already set) */
setBL(DOS_CHAR_ATTRIBUTE);
setBH(Bda->VideoPage);
/* Call the BIOS INT 10h, AH=0Eh "Teletype Output" */
setAH(0x0E);
Int32Call(&DosContext, 0x10);
Int32Call(&DosContext, BIOS_VIDEO_INTERRUPT);
/* Restore AX and BX */
setAX(AX);
setBX(BX);
setAX(AX);
#endif
}