Author: hbelusca
Date: Sun Oct 27 14:17:34 2013
New Revision: 60770
URL:
http://svn.reactos.org/svn/reactos?rev=60770&view=rev
Log:
[NTVDM]
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.
Modified:
branches/ntvdm/subsystems/ntvdm/bios.c
branches/ntvdm/subsystems/ntvdm/bios.h
branches/ntvdm/subsystems/ntvdm/ntvdm.h
branches/ntvdm/subsystems/ntvdm/ps2.c
Modified: branches/ntvdm/subsystems/ntvdm/bios.c
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/bios.c?r…
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/bios.c [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/ntvdm/bios.c [iso-8859-1] Sun Oct 27 14:17:34 2013
@@ -16,6 +16,8 @@
#include "pic.h"
#include "ps2.h"
#include "timer.h"
+
+#include "registers.h"
/* PRIVATE VARIABLES **********************************************************/
@@ -982,15 +984,20 @@
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;
- }
-
+ 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 @@
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 @@
BiosKeyboardMap[VirtualKey] |= (1 << 7);
/* Find out which character this is */
+ Character = 0;
if (ToAscii(VirtualKey, ScanCode, BiosKeyboardMap, &Character, 0)
== 0)
{
/* Not ASCII */
Modified: branches/ntvdm/subsystems/ntvdm/bios.h
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/bios.h?r…
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/bios.h [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/ntvdm/bios.h [iso-8859-1] Sun Oct 27 14:17:34 2013
@@ -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 @@
{
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;
Modified: branches/ntvdm/subsystems/ntvdm/ntvdm.h
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/ntvdm.h?…
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/ntvdm.h [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/ntvdm/ntvdm.h [iso-8859-1] Sun Oct 27 14:17:34 2013
@@ -11,12 +11,13 @@
/* INCLUDES *******************************************************************/
+#include <stdio.h>
+#include <stdarg.h>
+#include <conio.h>
+
#include <windows.h>
-#include <stdio.h>
-#include <conio.h>
-#include <stdarg.h>
+
#include <debug.h>
-#include <limits.h>
/* DEFINES ********************************************************************/
Modified: branches/ntvdm/subsystems/ntvdm/ps2.c
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/ps2.c?re…
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/ps2.c [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/ntvdm/ps2.c [iso-8859-1] Sun Oct 27 14:17:34 2013
@@ -300,6 +300,8 @@
KeyboardQueuePush(ScanCode);
}
+ /* TODO: Update the keyboard shift status flags */
+
/* Keyboard IRQ */
PicInterruptRequest(1);