Simplify BiosPeekCharacter.
Implement DOS direct console I/O functions.


svn path=/branches/ntvdm/; revision=60772
This commit is contained in:
Aleksandar Andrejevic 2013-10-27 16:34:27 +00:00
parent 161fc791e4
commit 37430c188b
2 changed files with 33 additions and 8 deletions

View file

@ -596,13 +596,9 @@ WORD BiosPeekCharacter(VOID)
{
WORD CharacterData;
/* Check if there is a key available */
if (Bda->KeybdBufferHead == Bda->KeybdBufferTail) return 0xFFFF;
/* Get the key from the queue, but don't remove it */
BiosKbdBufferTop(&CharacterData);
return CharacterData;
if (BiosKbdBufferTop(&CharacterData)) return CharacterData;
else return 0xFFFF;
}
WORD BiosGetCharacter(VOID)
@ -1169,8 +1165,7 @@ VOID BiosHandleIrq(BYTE IrqNumber, LPWORD Stack)
}
/* Push it onto the BIOS keyboard queue */
BiosKbdBufferPush((ScanCode << 8) | (Character & 0xFF));
BiosKbdBufferPush(MAKEWORD(Character, ScanCode));
}
else
{

View file

@ -1411,6 +1411,36 @@ VOID DosInt21h(LPWORD Stack)
break;
}
/* Direct Console I/O */
case 0x06:
{
BYTE Character = LOBYTE(Edx);
if (Character != 0xFF)
{
/* Output */
DosPrintCharacter(Character);
}
else
{
/* Input */
Eax &= 0xFFFFFF00;
if (DosCheckInput())
{
Eax |= DosReadCharacter();
Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_ZF;
}
else
{
/* No character available */
Stack[STACK_FLAGS] |= EMULATOR_FLAG_ZF;
}
}
break;
}
/* Read Character Without Echo */
case 0x07:
case 0x08: