Interrupts / Move simple handlers to winedos

Jukka Heinonen jhei at iki.fi
Thu Nov 7 11:43:31 CST 2002


This rather boring patch moves a bunch of simple interrupt
handlers to winedos.


Changelog:
  Move simple interrupt handlers to winedos.


Index: dlls/winedos/Makefile.in
===================================================================
RCS file: /home/wine/wine/dlls/winedos/Makefile.in,v
retrieving revision 1.16
diff -u -r1.16 Makefile.in
--- dlls/winedos/Makefile.in    30 Oct 2002 23:40:13 -0000      1.16
+++ dlls/winedos/Makefile.in    7 Nov 2002 17:20:51 -0000
@@ -15,16 +15,23 @@
        dma.c \
        dosaspi.c \
        dosvm.c \
+        fpu.c \
        int09.c \
        int10.c \
+        int12.c \
+        int13.c \
        int16.c \
        int17.c \
        int19.c \
+        int1a.c \
        int20.c \
        int21.c \
        int29.c \
+        int2a.c \
        int31.c \
        int33.c \
+        int41.c \
+        int4b.c \
        int67.c \
        interrupts.c \
        ioports.c \



Index: dlls/winedos/interrupts.c
===================================================================
RCS file: /home/wine/wine/dlls/winedos/interrupts.c,v
retrieving revision 1.6
diff -u -r1.6 interrupts.c
--- dlls/winedos/interrupts.c   6 Nov 2002 21:56:52 -0000       1.6
+++ dlls/winedos/interrupts.c   7 Nov 2002 17:22:36 -0000
@@ -26,27 +26,10 @@
 
 /***********************************************************************
  *             DOSVM_Int11Handler (WINEDOS16.117)
- *             DOSVM_Int12Handler (WINEDOS16.118)
- *             DOSVM_Int13Handler (WINEDOS16.119)
  *             DOSVM_Int15Handler (WINEDOS16.121)
- *             DOSVM_Int1aHandler (WINEDOS16.126)
  *             DOSVM_Int25Handler (WINEDOS16.137)
  *             DOSVM_Int26Handler (WINEDOS16.138)
- *             DOSVM_Int2aHandler (WINEDOS16.142)
  *             DOSVM_Int2fHandler (WINEDOS16.147)
- *             DOSVM_Int34Handler (WINEDOS16.152)
- *             DOSVM_Int35Handler (WINEDOS16.153)
- *             DOSVM_Int36Handler (WINEDOS16.154)
- *             DOSVM_Int37Handler (WINEDOS16.155)
- *             DOSVM_Int38Handler (WINEDOS16.156)
- *             DOSVM_Int39Handler (WINEDOS16.157)
- *             DOSVM_Int3aHandler (WINEDOS16.158)
- *             DOSVM_Int3bHandler (WINEDOS16.159)
- *             DOSVM_Int3cHandler (WINEDOS16.160)
- *             DOSVM_Int3dHandler (WINEDOS16.161)
- *             DOSVM_Int3eHandler (WINEDOS16.162)
- *             DOSVM_Int41Handler (WINEDOS16.165)
- *             DOSVM_Int4bHandler (WINEDOS16.175)
  *             DOSVM_Int5cHandler (WINEDOS16.192)
  *
  * FIXME: Interrupt handlers for interrupts implemented in other DLLs.
@@ -54,27 +37,10 @@
  *        been moved to winedos.
  */
 void WINAPI DOSVM_Int11Handler( CONTEXT86 *context ) { INT_Int11Handler(context); }
-void WINAPI DOSVM_Int12Handler( CONTEXT86 *context ) { INT_Int12Handler(context); }
-void WINAPI DOSVM_Int13Handler( CONTEXT86 *context ) { INT_Int13Handler(context); }
 void WINAPI DOSVM_Int15Handler( CONTEXT86 *context ) { INT_Int15Handler(context); }
-void WINAPI DOSVM_Int1aHandler( CONTEXT86 *context ) { INT_Int1aHandler(context); }
 void WINAPI DOSVM_Int25Handler( CONTEXT86 *context ) { INT_Int25Handler(context); }
 void WINAPI DOSVM_Int26Handler( CONTEXT86 *context ) { INT_Int26Handler(context); }
-void WINAPI DOSVM_Int2aHandler( CONTEXT86 *context ) { INT_Int2aHandler(context); }
 void WINAPI DOSVM_Int2fHandler( CONTEXT86 *context ) { INT_Int2fHandler(context); }
-void WINAPI DOSVM_Int34Handler( CONTEXT86 *context ) { INT_Int34Handler(context); }
-void WINAPI DOSVM_Int35Handler( CONTEXT86 *context ) { INT_Int35Handler(context); }
-void WINAPI DOSVM_Int36Handler( CONTEXT86 *context ) { INT_Int36Handler(context); }
-void WINAPI DOSVM_Int37Handler( CONTEXT86 *context ) { INT_Int37Handler(context); }
-void WINAPI DOSVM_Int38Handler( CONTEXT86 *context ) { INT_Int38Handler(context); }
-void WINAPI DOSVM_Int39Handler( CONTEXT86 *context ) { INT_Int39Handler(context); }
-void WINAPI DOSVM_Int3aHandler( CONTEXT86 *context ) { INT_Int3aHandler(context); }
-void WINAPI DOSVM_Int3bHandler( CONTEXT86 *context ) { INT_Int3bHandler(context); }
-void WINAPI DOSVM_Int3cHandler( CONTEXT86 *context ) { INT_Int3cHandler(context); }
-void WINAPI DOSVM_Int3dHandler( CONTEXT86 *context ) { INT_Int3dHandler(context); }
-void WINAPI DOSVM_Int3eHandler( CONTEXT86 *context ) { INT_Int3eHandler(context); }
-void WINAPI DOSVM_Int41Handler( CONTEXT86 *context ) { INT_Int41Handler(context); }
-void WINAPI DOSVM_Int4bHandler( CONTEXT86 *context ) { INT_Int4bHandler(context); }
 void WINAPI DOSVM_Int5cHandler( CONTEXT86 *context ) { NetBIOSCall16(context); }
 
 static FARPROC16     DOSVM_Vectors16[256];



Index: dlls/winedos/dosexe.h
===================================================================
RCS file: /home/wine/wine/dlls/winedos/dosexe.h,v
retrieving revision 1.12
diff -u -r1.12 dosexe.h
--- dlls/winedos/dosexe.h       28 Oct 2002 20:12:40 -0000      1.12
+++ dlls/winedos/dosexe.h       7 Nov 2002 17:23:50 -0000
@@ -83,6 +83,19 @@
 extern void DMA_ioport_out( WORD port, BYTE val );
 extern BYTE DMA_ioport_in( WORD port );
 
+/* fpu.c */
+extern void WINAPI DOSVM_Int34Handler(CONTEXT86*);
+extern void WINAPI DOSVM_Int35Handler(CONTEXT86*);
+extern void WINAPI DOSVM_Int36Handler(CONTEXT86*);
+extern void WINAPI DOSVM_Int37Handler(CONTEXT86*);
+extern void WINAPI DOSVM_Int38Handler(CONTEXT86*);
+extern void WINAPI DOSVM_Int39Handler(CONTEXT86*);
+extern void WINAPI DOSVM_Int3aHandler(CONTEXT86*);
+extern void WINAPI DOSVM_Int3bHandler(CONTEXT86*);
+extern void WINAPI DOSVM_Int3cHandler(CONTEXT86*);
+extern void WINAPI DOSVM_Int3dHandler(CONTEXT86*);
+extern void WINAPI DOSVM_Int3eHandler(CONTEXT86*);
+
 /* int09.c */
 extern void WINAPI DOSVM_Int09Handler(CONTEXT86*);
 extern void WINAPI DOSVM_Int09SendScan(BYTE scan,BYTE ascii);
@@ -92,6 +105,15 @@
 extern void WINAPI DOSVM_Int10Handler(CONTEXT86*);
 extern void WINAPI DOSVM_PutChar(BYTE ascii);
 
+/* int12.c */
+extern void WINAPI DOSVM_Int12Handler(CONTEXT86*);
+
+/* int13.c */
+extern void WINAPI DOSVM_Int13Handler(CONTEXT86*);
+
+/* int1a.c */
+extern void WINAPI DOSVM_Int1aHandler(CONTEXT86*);
+
 /* int16.c */
 extern void WINAPI DOSVM_Int16Handler(CONTEXT86*);
 extern int WINAPI DOSVM_Int16ReadChar(BYTE*ascii,BYTE*scan,BOOL peek);
@@ -112,6 +134,9 @@
 /* int29.c */
 extern void WINAPI DOSVM_Int29Handler(CONTEXT86*);
 
+/* int2a.c */
+extern void WINAPI DOSVM_Int2aHandler(CONTEXT86*);
+
 /* int31.c */
 extern void WINAPI DOSVM_Int31Handler(CONTEXT86*);
 extern BOOL DOSVM_IsDos32(void);
@@ -120,6 +145,12 @@
 extern void WINAPI DOSVM_Int33Handler(CONTEXT86*);
 extern void WINAPI DOSVM_Int33Message(UINT,WPARAM,LPARAM);
 extern void WINAPI DOSVM_Int33Console(MOUSE_EVENT_RECORD*);
+
+/* int41.c */
+extern void WINAPI DOSVM_Int41Handler(CONTEXT86*);
+
+/* int4b.c */
+extern void WINAPI DOSVM_Int4bHandler(CONTEXT86*);
 
 /* int67.c */
 extern void WINAPI DOSVM_Int67Handler(CONTEXT86*);



--- /dev/null   Thu Jan  1 02:00:00 1970
+++ dlls/winedos/fpu.c  Thu Nov  7 18:19:22 2002
@@ -0,0 +1,240 @@
+/*
+ * DOS interrupt 34->3e handlers.  All FPU interrupt code should be
+ * moved into this file.
+ *
+ * Copyright 2002 Robert 'Admiral' Coeyman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <stdlib.h>
+#include "msdos.h"
+#include "miscemu.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(int);
+
+/*
+ *  The actual work is done by a single routine.
+ */
+
+static void FPU_ModifyCode(CONTEXT86 *context, BYTE Opcode);
+
+
+/**********************************************************************
+ *          DOSVM_Int34Handler (WINEDOS16.152)
+ *
+ * Handler for int 34 (FLOATING POINT EMULATION - Opcode 0xd8).
+ *
+ *  The interrupt list isn't specific about what this interrupt
+ *  actually does. [ interrup.m ]
+ */
+void WINAPI DOSVM_Int34Handler(CONTEXT86 *context)
+{
+    TRACE("Int 0x34 called-- FP opcode 0xd8");
+    FPU_ModifyCode(context, 0xd8);
+}
+
+
+/**********************************************************************
+ *          DOSVM_Int35Handler (WINEDOS16.153)
+ *
+ * Handler for int 35 (FLOATING POINT EMULATION - Opcode 0xd9).
+ *
+ *  The interrupt list isn't specific about what this interrupt
+ *  actually does. [ interrup.m ]
+ */
+void WINAPI DOSVM_Int35Handler(CONTEXT86 *context)
+{
+    TRACE("Int 0x35 called-- FP opcode 0xd9");
+    FPU_ModifyCode(context, 0xd9);
+}
+
+
+/**********************************************************************
+ *          DOSVM_Int36Handler (WINEDOS16.154)
+ *
+ * Handler for int 36 (FLOATING POINT EMULATION - Opcode 0xda).
+ *
+ *  The interrupt list isn't specific about what this interrupt
+ *  actually does. [ interrup.m ]
+ */
+void WINAPI DOSVM_Int36Handler(CONTEXT86 *context)
+{
+    TRACE("Int 0x36 called-- FP opcode 0xda");
+    FPU_ModifyCode(context, 0xda);
+}
+
+
+/**********************************************************************
+ *          DOSVM_Int37Handler (WINEDOS16.155)
+ *
+ * Handler for int 37 (FLOATING POINT EMULATION - Opcode 0xdb).
+ *
+ *  The interrupt list isn't specific about what this interrupt
+ *  actually does. [ interrup.m ]
+ */
+void WINAPI DOSVM_Int37Handler(CONTEXT86 *context)
+{
+    TRACE("Int 0x37 called-- FP opcode 0xdb");
+    FPU_ModifyCode(context, 0xdb);
+}
+
+
+/**********************************************************************
+ *          DOSVM_Int38Handler (WINEDOS16.156)
+ *
+ * Handler for int 38 (FLOATING POINT EMULATION - Opcode 0xdc).
+ *
+ *  Between versions 3.0 and 5.01, the original PC-MOS API call that
+ *  was here was moved to int 0xd4.
+ *
+ *  The interrupt list isn't specific about what this interrupt
+ *  actually does. [ interrup.m ]
+ */
+void WINAPI DOSVM_Int38Handler(CONTEXT86 *context)
+{
+    TRACE("Int 0x38 called-- FP opcode 0xdc");
+    FPU_ModifyCode(context, 0xdc);
+}
+
+
+/**********************************************************************
+ *          DOSVM_Int39Handler (WINEDOS16.157)
+ *
+ * Handler for int 39 (FLOATING POINT EMULATION - Opcode 0xdd).
+ *
+ *  The interrupt list isn't specific about what this interrupt
+ *  actually does. [ interrup.m ]
+ */
+void WINAPI DOSVM_Int39Handler(CONTEXT86 *context)
+{
+    TRACE("Int 0x39 called-- FP opcode 0xdd");
+    FPU_ModifyCode(context, 0xdd);
+}
+
+
+/**********************************************************************
+ *          DOSVM_Int3aHandler (WINEDOS16.158)
+ *
+ * Handler for int 3a (FLOATING POINT EMULATION - Opcode 0xde).
+ *
+ *  The interrupt list isn't specific about what this interrupt
+ *  actually does. [ interrup.m ]
+ */
+void WINAPI DOSVM_Int3aHandler(CONTEXT86 *context)
+{
+    TRACE("Int 0x3a called-- FP opcode 0xde");
+    FPU_ModifyCode(context, 0xde);
+}
+
+
+/**********************************************************************
+ *          DOSVM_Int3bHandler (WINEDOS16.159)
+ *
+ * Handler for int 3B (FLOATING POINT EMULATION - Opcode 0xdf).
+ *
+ *  The interrupt list isn't specific about what this interrupt
+ *  actually does. [ interrup.m ]
+ */
+void WINAPI DOSVM_Int3bHandler(CONTEXT86 *context)
+{
+    TRACE("Int 0x3b called-- FP opcode 0xdf");
+    FPU_ModifyCode(context, 0xdf);
+}
+
+
+/**********************************************************************
+ *          DOSVM_Int3cHandler (WINEDOS16.160)
+ *
+ * Handler for int 3C (FLOATING POINT EMULATION - INSTRUCTIONS WITH SEGMENT OVERRIDE).
+ *
+ *  Generated code is CD 3C xy mm ... (CD = int | 3C = this interrupt)
+ *   xy is a modified ESC code and mm is the modR/M byte.
+ *   xy byte seems to be encoded as ss011xxx  or ss000xxx
+ *   ss= segment override.
+ *     00 -> DS
+ *     01 -> SS
+ *     10 -> CS
+ *     11 -> ES
+ *
+ *  11011xxx should be the opcode instruction.
+ */
+void WINAPI DOSVM_Int3cHandler(CONTEXT86 *context)
+{
+    FIXME("Int 3C NOT Implemented");
+    INT_BARF(context, 0x3c);
+}
+
+
+/**********************************************************************
+ *          DOSVM_Int3dHandler (WINEDOS16.161)
+ *
+ * Handler for int 3D (FLOATING POINT EMULATION - Standalone FWAIT).
+ *
+ *  Opcode 0x90 is a NOP.  It just fills space where the 3D was.
+ */
+void WINAPI DOSVM_Int3dHandler(CONTEXT86 *context)
+{
+    TRACE("Int 0x3d called-- Standalone FWAIT");
+    FPU_ModifyCode(context, 0x90);
+}
+
+
+/**********************************************************************
+ *          DOSVM_Int3eHandler (WINEDOS16.162)
+ *
+ * FLOATING POINT EMULATION -- Borland "Shortcut" call.
+ *  The two bytes following the int 3E instruction are
+ *  the subcode and a NOP ( 0x90 ), except for subcodes DC and DE
+ *  where the second byte is the register count.
+ *
+ *  Direct access 4.0 modifies and does not restore this vector.
+ *
+ */
+void WINAPI DOSVM_Int3eHandler(CONTEXT86 *context)
+{
+    FIXME("Int 3E NOT Implemented");
+    INT_BARF(context, 0x3e);
+}
+
+
+/**********************************************************************
+ *          FPU_ModifyCode
+ *
+ *   This is the function that inserts the 0x9b fwait instruction
+ *   and the actual FPU opcode into the program.
+ *           -A.C.
+ *
+ *               Code thanks to Ove Kaaven
+ */
+static void FPU_ModifyCode(CONTEXT86 *context, BYTE Opcode)
+{
+    WORD *stack = CTX_SEG_OFF_TO_LIN(context, context->SegSs, context->Esp);
+    BYTE *code =  CTX_SEG_OFF_TO_LIN(context, stack[1], stack[0]);
+
+    /*
+     * All *NIX systems should have a real or kernel emulated FPU.
+     */
+
+    code[-2] = 0x9b;          /* The fwait instruction */
+    code[-1] = Opcode;        /* Insert the opcode     */
+
+    if ( stack[0] < 2 ) FIXME("Backed up over a segment boundry in FPU code.");
+
+    stack[0] -= 2;             /* back up the return address 2 bytes */
+
+    TRACE("Modified code in FPU int call to 0x9b 0x%x",Opcode);
+}



--- /dev/null   Thu Jan  1 02:00:00 1970
+++ dlls/winedos/int12.c        Thu Nov  7 18:31:10 2002
@@ -0,0 +1,15 @@
+/*
+ * BIOS interrupt 12h handler
+ */
+
+#include "miscemu.h"
+
+/**********************************************************************
+ *         DOSVM_Int12Handler (WINEDOS16.118)
+ *
+ * Handler for int 12h (get memory size).
+ */
+void WINAPI DOSVM_Int12Handler( CONTEXT86 *context )
+{
+    SET_AX( context, 640 );
+}



--- /dev/null   Thu Jan  1 02:00:00 1970
+++ dlls/winedos/int13.c        Thu Nov  7 18:32:26 2002
@@ -0,0 +1,100 @@
+/*
+ * BIOS interrupt 13h handler
+ *
+ * Copyright 1997 Andreas Mohr
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#include "winbase.h"
+#include "winioctl.h"
+#include "miscemu.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(int);
+
+static void DIOCRegs_2_CONTEXT( DIOC_REGISTERS *pIn, CONTEXT86 *pCxt )
+{
+    memset( pCxt, 0, sizeof(*pCxt) );
+    /* Note: segment registers == 0 means that CTX_SEG_OFF_TO_LIN
+             will interpret 32-bit register contents as linear pointers */
+
+    pCxt->ContextFlags=CONTEXT86_INTEGER|CONTEXT86_CONTROL;
+    pCxt->Eax = pIn->reg_EAX;
+    pCxt->Ebx = pIn->reg_EBX;
+    pCxt->Ecx = pIn->reg_ECX;
+    pCxt->Edx = pIn->reg_EDX;
+    pCxt->Esi = pIn->reg_ESI;
+    pCxt->Edi = pIn->reg_EDI;
+
+    /* FIXME: Only partial CONTEXT86_CONTROL */
+    pCxt->EFlags = pIn->reg_Flags;
+}
+
+static void CONTEXT_2_DIOCRegs( CONTEXT86 *pCxt, DIOC_REGISTERS *pOut )
+{
+    memset( pOut, 0, sizeof(DIOC_REGISTERS) );
+
+    pOut->reg_EAX = pCxt->Eax;
+    pOut->reg_EBX = pCxt->Ebx;
+    pOut->reg_ECX = pCxt->Ecx;
+    pOut->reg_EDX = pCxt->Edx;
+    pOut->reg_ESI = pCxt->Esi;
+    pOut->reg_EDI = pCxt->Edi;
+
+    /* FIXME: Only partial CONTEXT86_CONTROL */
+    pOut->reg_Flags = pCxt->EFlags;
+}
+
+/**********************************************************************
+ *         DOSVM_Int13Handler (WINEDOS16.119)
+ *
+ * Handler for int 13h (disk I/O).
+ */
+void WINAPI DOSVM_Int13Handler( CONTEXT86 *context )
+{
+    HANDLE hVWin32;
+    DIOC_REGISTERS regs;
+    DWORD dwRet;
+
+    hVWin32 = CreateFileA("\\\\.\\VWIN32", GENERIC_READ|GENERIC_WRITE,
+               0, NULL, OPEN_EXISTING, FILE_FLAG_DELETE_ON_CLOSE, 0);
+
+    if(hVWin32!=INVALID_HANDLE_VALUE)
+    {
+        CONTEXT_2_DIOCRegs( context, &regs);
+
+        if(!DeviceIoControl(hVWin32, VWIN32_DIOC_DOS_INT13,
+                &regs, sizeof regs, &regs, sizeof regs, &dwRet, NULL))
+            DIOCRegs_2_CONTEXT(&regs, context);
+        else
+            SET_CFLAG(context);
+
+        CloseHandle(hVWin32);
+    }
+    else
+    {
+        ERR("Failed to open device VWIN32\n");
+        SET_CFLAG(context);
+    }
+}



--- /dev/null   Thu Jan  1 02:00:00 1970
+++ dlls/winedos/int1a.c        Thu Nov  7 18:30:31 2002
@@ -0,0 +1,128 @@
+/*
+ * BIOS interrupt 1ah handler
+ *
+ * Copyright 1993 Erik Bos
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "config.h"
+#include "wine/port.h"
+
+#include <time.h>
+#ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif
+#include <stdlib.h>
+#include "miscemu.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(int);
+
+#define        BCD_TO_BIN(x) ((x&15) + (x>>4)*10)
+#define BIN_TO_BCD(x) ((x%10) + ((x/10)<<4))
+
+
+/**********************************************************************
+ *         INT1A_GetTicksSinceMidnight
+ *
+ * Return number of clock ticks since midnight.
+ */
+DWORD INT1A_GetTicksSinceMidnight(void)
+{
+    struct tm *bdtime;
+    struct timeval tvs;
+    time_t seconds;
+
+    /* This should give us the (approximately) correct
+     * 18.206 clock ticks per second since midnight.
+     */
+    gettimeofday( &tvs, NULL );
+    seconds = tvs.tv_sec;
+    bdtime = localtime( &seconds );
+    return (((bdtime->tm_hour * 3600 + bdtime->tm_min * 60 +
+              bdtime->tm_sec) * 18206) / 1000) +
+                  (tvs.tv_usec / 54927);
+}
+
+
+/**********************************************************************
+ *         DOSVM_Int1aHandler (WINEDOS16.126)
+ *
+ * Handler for int 1ah
+ *     0x00 - 0x07 - date and time
+ *     0x?? - 0x?? - Microsoft Real Time Compression Interface
+ */
+void WINAPI DOSVM_Int1aHandler( CONTEXT86 *context )
+{
+    time_t ltime;
+    DWORD ticks;
+    struct tm *bdtime;
+
+    switch(AH_reg(context))
+    {
+       case 0x00:
+            ticks = INT1A_GetTicksSinceMidnight();
+            SET_CX( context, HIWORD(ticks) );
+            SET_DX( context, LOWORD(ticks) );
+            SET_AX( context, 0 );  /* No midnight rollover */
+            TRACE("int1a: AH=00 -- ticks=%ld\n", ticks);
+            break;
+
+       case 0x02:
+               ltime = time(NULL);
+               bdtime = localtime(&ltime);
+
+               SET_CX( context, (BIN_TO_BCD(bdtime->tm_hour)<<8) |
+                                  BIN_TO_BCD(bdtime->tm_min) );
+               SET_DX( context, (BIN_TO_BCD(bdtime->tm_sec)<<8) );
+
+       case 0x04:
+               ltime = time(NULL);
+               bdtime = localtime(&ltime);
+               SET_CX( context, (BIN_TO_BCD(bdtime->tm_year/100)<<8) |
+                                  BIN_TO_BCD((bdtime->tm_year-1900)%100) );
+               SET_DX( context, (BIN_TO_BCD(bdtime->tm_mon)<<8) |
+                                  BIN_TO_BCD(bdtime->tm_mday) );
+               break;
+
+               /* setting the time,date or RTC is not allow -EB */
+       case 0x01:
+               /* set system time */
+       case 0x03:
+               /* set RTC time */
+       case 0x05:
+               /* set RTC date */
+       case 0x06:
+               /* set ALARM */
+       case 0x07:
+               /* cancel ALARM */
+               break;
+
+        case 0xb0: /* Microsoft Real Time Compression */
+                switch AL_reg(context)
+                {
+                    case 0x01:
+                        /* not present */
+                        break;
+                    default:
+                        INT_BARF(context, 0x1a);
+                }
+                break;
+
+       default:
+               INT_BARF( context, 0x1a );
+    }
+}



--- /dev/null   Thu Jan  1 02:00:00 1970
+++ dlls/winedos/int2a.c        Thu Nov  7 18:29:49 2002
@@ -0,0 +1,27 @@
+/*
+ * DOS interrupt 2ah handler
+ */
+
+#include <stdlib.h>
+#include "msdos.h"
+#include "miscemu.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(int);
+
+/**********************************************************************
+ *         DOSVM_Int2aHandler (WINEDOS16.142)
+ *
+ * Handler for int 2ah (network).
+ */
+void WINAPI DOSVM_Int2aHandler( CONTEXT86 *context )
+{
+    switch(AH_reg(context))
+    {
+    case 0x00:                             /* NETWORK INSTALLATION CHECK */
+        break;
+
+    default:
+       INT_BARF( context, 0x2a );
+    }
+}



--- /dev/null   Thu Jan  1 02:00:00 1970
+++ dlls/winedos/int41.c        Thu Nov  7 18:23:05 2002
@@ -0,0 +1,71 @@
+/*
+ * DOS interrupt 41h handler  -- Windows Kernel Debugger
+ *
+ * Check debugsys.inc from the DDK for docu.
+ *
+ * Copyright 1998 Ulrich Weigand
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <stdio.h>
+#include "miscemu.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(int);
+
+/***********************************************************************
+ *           DOSVM_Int41Handler (WINEDOS16.165)
+ *
+ */
+void WINAPI DOSVM_Int41Handler( CONTEXT86 *context )
+{
+    if ( ISV86(context) )
+    {
+        /* Real-mode debugger services */
+        switch ( AX_reg(context) )
+        {
+        default:
+            INT_BARF( context, 0x41 );
+            break;
+        }
+    }
+    else
+    {
+        /* Protected-mode debugger services */
+        switch ( AX_reg(context) )
+        {
+        case 0x4f:
+        case 0x50:
+        case 0x150:
+        case 0x51:
+        case 0x52:
+        case 0x152:
+        case 0x59:
+        case 0x5a:
+        case 0x5b:
+        case 0x5c:
+        case 0x5d:
+            /* Notifies the debugger of a lot of stuff. We simply ignore it
+               for now, but some of the info might actually be useful ... */
+            break;
+
+        default:
+            INT_BARF( context, 0x41 );
+            break;
+        }
+    }
+}
+



--- /dev/null   Thu Jan  1 02:00:00 1970
+++ dlls/winedos/int4b.c        Thu Nov  7 18:27:13 2002
@@ -0,0 +1,29 @@
+/*
+ * DOS interrupt 4bh handler
+ */
+
+#include <stdio.h>
+#include "miscemu.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(int);
+
+/***********************************************************************
+ *           DOSVM_Int4bHandler (WINEDOS16.175)
+ *
+ */
+void WINAPI DOSVM_Int4bHandler( CONTEXT86 *context )
+{
+    switch(AH_reg(context))
+    {
+    case 0x81: /* Virtual DMA Spec (IBM SCSI interface) */
+        if(AL_reg(context) != 0x02) /* if not install check */
+        {
+            SET_CFLAG(context);
+            SET_AL( context, 0x0f ); /* function is not implemented */
+        }
+        break;
+    default:
+        INT_BARF(context, 0x4b);
+    }
+}




-- 
Jukka Heinonen <http://www.iki.fi/jhei/>



More information about the wine-patches mailing list