{
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)
{
BYTE ScanCode, VirtualKey;
WORD Character;
-
+
/* Loop while there is a scancode available */
- while (KeyboardReadStatus() & 1)
+ do
{
/* Get the scan code and virtual key code */
ScanCode = KeyboardReadData();
}
/* Push it onto the BIOS keyboard queue */
- BiosKbdBufferPush((ScanCode << 8) | (Character & 0xFF));
-
+ BiosKbdBufferPush(MAKEWORD(Character, ScanCode));
}
else
{
BiosKeyboardMap[VirtualKey] &= ~(1 << 7);
}
}
+ while (KeyboardReadStatus() & 1);
/* Clear the keyboard flags */
Bda->KeybdShiftFlags = 0;