[NTVDM]
authorHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Fri, 8 Nov 2013 23:15:58 +0000 (23:15 +0000)
committerHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Fri, 8 Nov 2013 23:15:58 +0000 (23:15 +0000)
- BIOS: Implement INT 12h (BiosGetMemorySize)
- BOP/DOS: Add some DPRINTs for INT 25h, 2Fh and for unimplemented functions of INT 21h. It's for helping in testing 4DOS.COM

svn path=/branches/ntvdm/; revision=60889

subsystems/ntvdm/bios.c
subsystems/ntvdm/bios.h
subsystems/ntvdm/bop.c
subsystems/ntvdm/dos.c

index 6a74fe9..ca3f0a7 100644 (file)
@@ -467,6 +467,13 @@ BOOLEAN BiosInitialize(VOID)
     /* Initialize the BDA */
     Bda = (PBIOS_DATA_AREA)SEG_OFF_TO_PTR(BDA_SEGMENT, 0);
     Bda->EquipmentList = BIOS_EQUIPMENT_LIST;
+    /*
+     * Conventional memory size is 640 kB,
+     * see: http://webpages.charter.net/danrollins/techhelp/0184.HTM
+     * and see Ralf Brown: http://www.ctyme.com/intr/rb-0598.htm
+     * for more information.
+     */
+    Bda->MemorySize = 0x0280;
     Bda->KeybdBufferStart = FIELD_OFFSET(BIOS_DATA_AREA, KeybdBuffer);
     Bda->KeybdBufferEnd = Bda->KeybdBufferStart + BIOS_KBD_BUFFER_SIZE * sizeof(WORD);
 
@@ -1296,6 +1303,12 @@ VOID BiosEquipmentService(LPWORD Stack)
     setAX(Bda->EquipmentList);
 }
 
+VOID BiosGetMemorySize(LPWORD Stack)
+{
+    /* Return the conventional memory size in kB, typically 640 kB */
+    setAX(Bda->MemorySize);
+}
+
 VOID BiosHandleIrq(BYTE IrqNumber, LPWORD Stack)
 {
     switch (IrqNumber)
index e661c2e..103dd37 100644 (file)
@@ -26,6 +26,7 @@
 
 #define BIOS_VIDEO_INTERRUPT 0x10
 #define BIOS_EQUIPMENT_INTERRUPT 0x11
+#define BIOS_MEMORY_SIZE 0x12
 #define BIOS_KBD_INTERRUPT 0x16
 #define BIOS_TIME_INTERRUPT 0x1A
 #define BIOS_SYS_TIMER_INTERRUPT 0x1C
@@ -131,6 +132,7 @@ WORD BiosGetCharacter(VOID);
 VOID BiosSetCursorPosition(BYTE Row, BYTE Column, BYTE Page);
 VOID BiosVideoService(LPWORD Stack);
 VOID BiosEquipmentService(LPWORD Stack);
+VOID BiosGetMemorySize(LPWORD Stack);
 VOID BiosKeyboardService(LPWORD Stack);
 VOID BiosTimeService(LPWORD Stack);
 VOID BiosHandleIrq(BYTE IrqNumber, LPWORD Stack);
index a201dc1..ee2b265 100644 (file)
@@ -19,6 +19,7 @@
 //#include "pic.h"
 //#include "ps2.h"
 //#include "timer.h"
+#include "registers.h"
 
 LPCWSTR ExceptionName[] =
 {
@@ -376,6 +377,12 @@ VOID WINAPI IntDispatch(LPWORD Stack)
             BiosEquipmentService(Stack);
             break;
         }
+        case BIOS_MEMORY_SIZE:
+        {
+            /* This is the BIOS "get memory size" command, call the BIOS */
+            BiosGetMemorySize(Stack);
+            break;
+        }
         case BIOS_KBD_INTERRUPT:
         {
             /* This is the keyboard BIOS interrupt, call the BIOS */
@@ -409,6 +416,13 @@ VOID WINAPI IntDispatch(LPWORD Stack)
             DosBreakInterrupt(Stack);
             break;
         }
+        case 0x2F:
+        {
+            DPRINT1("DOS System Function INT 0x2F, AH = %xh, AL = %xh NOT IMPLEMENTED!\n",
+                    getAH(), getAL());
+            Stack[STACK_FLAGS] |= EMULATOR_FLAG_CF;
+            break;
+        }
         default:
         {
             DPRINT1("Unhandled interrupt: 0x%02X\n", IntNum);
index 115cbff..59ec0fb 100644 (file)
@@ -1691,6 +1691,7 @@ VOID DosInt21h(LPWORD Stack)
         case 0x25:
         {
             DWORD FarPointer = MAKELONG(getDX(), getDS());
+            DPRINT1("Setting interrupt 0x%x ...\n", getAL());
 
             /* Write the new far pointer to the IDT */
             ((PDWORD)BaseAddress)[getAL()] = FarPointer;
@@ -2393,7 +2394,8 @@ VOID DosInt21h(LPWORD Stack)
         /* Unsupported */
         default:
         {
-            DPRINT1("DOS Function INT 0x21, AH = 0x%02X NOT IMPLEMENTED!\n", getAH());
+            DPRINT1("DOS Function INT 0x21, AH = %xh, AL = %xh NOT IMPLEMENTED!\n",
+                    getAH(), getAL());
             Stack[STACK_FLAGS] |= EMULATOR_FLAG_CF;
         }
     }