Remove the useless wrappers BiosPeekCharacter and BiosGetCharacter. They're also
a source of bugs since 0xFFFF could legitimately appear in the buffer.


svn path=/trunk/; revision=67459
This commit is contained in:
Aleksandar Andrejevic 2015-04-27 14:14:14 +00:00
parent 619aaae278
commit a2b6d6c3e5

View file

@ -80,26 +80,6 @@ static BOOLEAN BiosKbdBufferPop(VOID)
return TRUE; return TRUE;
} }
static WORD BiosPeekCharacter(VOID)
{
WORD CharacterData = 0;
/* Get the key from the queue, but don't remove it */
if (BiosKbdBufferTop(&CharacterData)) return CharacterData;
else return 0xFFFF;
}
static WORD BiosGetCharacter(VOID)
{
WORD CharacterData = 0;
/* Check if there is a key available, and if so, remove it from the queue */
if (BiosKbdBufferTop(&CharacterData)) BiosKbdBufferPop();
else CharacterData = 0xFFFF;
return CharacterData;
}
static VOID WINAPI BiosKeyboardService(LPWORD Stack) static VOID WINAPI BiosKeyboardService(LPWORD Stack)
{ {
switch (getAH()) switch (getAH())
@ -109,16 +89,17 @@ static VOID WINAPI BiosKeyboardService(LPWORD Stack)
/* Wait for extended keystroke and read */ /* Wait for extended keystroke and read */
case 0x10: // FIXME: Temporarily do the same as INT 16h, 00h case 0x10: // FIXME: Temporarily do the same as INT 16h, 00h
{ {
/* Read the character (and wait if necessary) */ WORD Character;
WORD Character = BiosGetCharacter();
if (Character == 0xFFFF) /* Read the character (and wait if necessary) */
if (!BiosKbdBufferTop(&Character))
{ {
/* No key available. Set the handler CF to repeat the BOP */ /* No key available. Set the handler CF to repeat the BOP */
setCF(1); setCF(1);
break; break;
} }
BiosKbdBufferPop();
setAX(Character); setAX(Character);
break; break;
@ -129,9 +110,9 @@ static VOID WINAPI BiosKeyboardService(LPWORD Stack)
/* Get extended keystroke status */ /* Get extended keystroke status */
case 0x11: // FIXME: Temporarily do the same as INT 16h, 01h case 0x11: // FIXME: Temporarily do the same as INT 16h, 01h
{ {
WORD Character = BiosPeekCharacter(); WORD Character;
if (Character != 0xFFFF) if (BiosKbdBufferTop(&Character))
{ {
/* There is a character, clear ZF and return it */ /* There is a character, clear ZF and return it */
Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_ZF; Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_ZF;