Implement all the missing INT 16h functions but 03h. Also, for simplification purposes (should be fixed later on) act exactly the same for INT 00h and 10h, and for INT 01h and 11h.
Finally, one has to implement setting the BIOS KeybdShiftFlags flag.

svn path=/branches/ntvdm/; revision=60770
This commit is contained in:
Hermès Bélusca-Maïto 2013-10-27 14:17:34 +00:00
parent 4d28af9bb5
commit d9c072aba2
4 changed files with 60 additions and 9 deletions

View file

@ -17,6 +17,8 @@
#include "ps2.h"
#include "timer.h"
#include "registers.h"
/* PRIVATE VARIABLES **********************************************************/
PBIOS_DATA_AREA Bda;
@ -982,15 +984,20 @@ VOID BiosKeyboardService(LPWORD Stack)
switch (HIBYTE(Eax))
{
/* Wait for keystroke and read */
case 0x00:
/* Wait for extended keystroke and read */
case 0x10: // FIXME: Temporarily do the same as INT 16h, 00h
{
/* Read the character (and wait if necessary) */
EmulatorSetRegister(EMULATOR_REG_AX, BiosGetCharacter());
break;
}
/* Get keystroke status */
case 0x01:
/* Get extended keystroke status */
case 0x11: // FIXME: Temporarily do the same as INT 16h, 01h
{
WORD Data = BiosPeekCharacter();
@ -1008,7 +1015,45 @@ VOID BiosKeyboardService(LPWORD Stack)
break;
}
/* Get shift status */
case 0x02:
{
/* Return the lower byte of the keyboard shift status word */
setAL(LOBYTE(Bda->KeybdShiftFlags));
break;
}
/* Reserved */
case 0x04:
{
DPRINT1("BIOS Function INT 16h, AH = 0x04 is RESERVED\n");
break;
}
/* Push keystroke */
case 0x05:
{
/* Return 0 if success, 1 if failure */
setAL(BiosKbdBufferPush(getCX()) == FALSE);
break;
}
/* Get extended shift status */
case 0x12:
{
/*
* Be careful! The returned word is similar to Bda->KeybdShiftFlags
* but the high byte is organized differently:
* the bytes 2 and 3 of the high byte are not the same...
*/
WORD KeybdShiftFlags = (Bda->KeybdShiftFlags & 0xF3FF);
/* Return the extended keyboard shift status word */
setAX(KeybdShiftFlags);
break;
}
default:
{
DPRINT1("BIOS Function INT 16h, AH = 0x%02X NOT IMPLEMENTED\n",
@ -1115,6 +1160,7 @@ VOID BiosHandleIrq(BYTE IrqNumber, LPWORD Stack)
BiosKeyboardMap[VirtualKey] |= (1 << 7);
/* Find out which character this is */
Character = 0;
if (ToAscii(VirtualKey, ScanCode, BiosKeyboardMap, &Character, 0) == 0)
{
/* Not ASCII */

View file

@ -21,11 +21,13 @@
#define BIOS_PIC_MASTER_INT 0x08
#define BIOS_PIC_SLAVE_INT 0x70
#define BIOS_SEGMENT 0xF000
#define BIOS_VIDEO_INTERRUPT 0x10
#define BIOS_EQUIPMENT_INTERRUPT 0x11
#define BIOS_KBD_INTERRUPT 0x16
#define BIOS_TIME_INTERRUPT 0x1A
#define BIOS_SYS_TIMER_INTERRUPT 0x1C
#define CONSOLE_FONT_HEIGHT 8
#define BIOS_KBD_BUFFER_SIZE 16
#define BIOS_EQUIPMENT_LIST 0x2C // HACK: Disable FPU for now
@ -51,12 +53,12 @@ typedef struct
{
WORD SerialPorts[4];
WORD ParallelPorts[3];
WORD EbdaSegment;
WORD EbdaSegment; // Sometimes, ParallelPort
WORD EquipmentList;
BYTE Reserved0;
BYTE Reserved0; // Errors in PCjr infrared keyboard link
WORD MemorySize;
WORD Reserved1;
WORD KeyboardFlags;
WORD Reserved1; // Scratch pad for manufacturing error tests
WORD KeybdShiftFlags;
BYTE AlternateKeypad;
WORD KeybdBufferHead;
WORD KeybdBufferTail;

View file

@ -11,12 +11,13 @@
/* INCLUDES *******************************************************************/
#include <windows.h>
#include <stdio.h>
#include <conio.h>
#include <stdarg.h>
#include <conio.h>
#include <windows.h>
#include <debug.h>
#include <limits.h>
/* DEFINES ********************************************************************/

View file

@ -300,6 +300,8 @@ DWORD WINAPI InputThreadProc(LPVOID Parameter)
KeyboardQueuePush(ScanCode);
}
/* TODO: Update the keyboard shift status flags */
/* Keyboard IRQ */
PicInterruptRequest(1);