Interrupts / Move int11, int15 and int5c to winedos

Jukka Heinonen jhei at iki.fi
Sat Nov 23 10:00:57 CST 2002


This patch moves three simple interrupt handlers to winedos.
Handler migration starts to get really boring but fortunately
only int25, int26 and int21 handlers are left (int13 probably
needs to be migrated, too).



Changelog:
  Moved handlers for int11, int15 and int5c to winedos.


After this patch, files msdos/int11.c, msdos/int15.c and 
msdos/int5c.c can be deleted.




Index: msdos/dpmi.c
===================================================================
RCS file: /home/wine/wine/msdos/dpmi.c,v
retrieving revision 1.71
diff -u -r1.71 dpmi.c
--- msdos/dpmi.c	18 Nov 2002 22:53:38 -0000	1.71
+++ msdos/dpmi.c	23 Nov 2002 15:38:34 -0000
@@ -55,3 +55,14 @@
 #undef GET_ADDR
     return TRUE;
 }
+
+
+/***********************************************************************
+ *           NetBIOSCall      (KERNEL.103)
+ *
+ */
+void WINAPI NetBIOSCall16( CONTEXT86 *context )
+{
+    if (Dosvm.CallBuiltinHandler || DPMI_LoadDosSystem())
+        Dosvm.CallBuiltinHandler( context, 0x5c );
+}




Index: dlls/winedos/interrupts.c
===================================================================
RCS file: /home/wine/wine/dlls/winedos/interrupts.c,v
retrieving revision 1.9
diff -u -r1.9 interrupts.c
--- dlls/winedos/interrupts.c	23 Nov 2002 02:23:55 -0000	1.9
+++ dlls/winedos/interrupts.c	23 Nov 2002 15:39:02 -0000
@@ -25,21 +25,15 @@
 WINE_DEFAULT_DEBUG_CHANNEL(int);
 
 /***********************************************************************
- *		DOSVM_Int11Handler (WINEDOS16.117)
- *		DOSVM_Int15Handler (WINEDOS16.121)
  *		DOSVM_Int25Handler (WINEDOS16.137)
  *		DOSVM_Int26Handler (WINEDOS16.138)
- *		DOSVM_Int5cHandler (WINEDOS16.192)
  *
  * FIXME: Interrupt handlers for interrupts implemented in other DLLs.
  *        These functions should be removed when the interrupt handlers have
  *        been moved to winedos.
  */
-void WINAPI DOSVM_Int11Handler( CONTEXT86 *context ) { INT_Int11Handler(context); }
-void WINAPI DOSVM_Int15Handler( CONTEXT86 *context ) { INT_Int15Handler(context); }
 void WINAPI DOSVM_Int25Handler( CONTEXT86 *context ) { INT_Int25Handler(context); }
 void WINAPI DOSVM_Int26Handler( CONTEXT86 *context ) { INT_Int26Handler(context); }
-void WINAPI DOSVM_Int5cHandler( CONTEXT86 *context ) { NetBIOSCall16(context); }
 
 static FARPROC16     DOSVM_Vectors16[256];
 static FARPROC48     DOSVM_Vectors48[256];




Index: dlls/winedos/dosexe.h
===================================================================
RCS file: /home/wine/wine/dlls/winedos/dosexe.h,v
retrieving revision 1.16
diff -u -r1.16 dosexe.h
--- dlls/winedos/dosexe.h	23 Nov 2002 02:23:55 -0000	1.16
+++ dlls/winedos/dosexe.h	23 Nov 2002 15:39:14 -0000
@@ -116,12 +116,18 @@
 extern void WINAPI DOSVM_Int10Handler(CONTEXT86*);
 extern void WINAPI DOSVM_PutChar(BYTE ascii);
 
+/* int11.c */
+extern void WINAPI DOSVM_Int11Handler(CONTEXT86*);
+
 /* int12.c */
 extern void WINAPI DOSVM_Int12Handler(CONTEXT86*);
 
 /* int13.c */
 extern void WINAPI DOSVM_Int13Handler(CONTEXT86*);
 
+/* int15.c */
+extern void WINAPI DOSVM_Int15Handler(CONTEXT86*);
+
 /* int1a.c */
 extern void WINAPI DOSVM_Int1aHandler(CONTEXT86*);
 
@@ -168,6 +174,9 @@
 
 /* int4b.c */
 extern void WINAPI DOSVM_Int4bHandler(CONTEXT86*);
+
+/* int5c.c */
+extern void WINAPI DOSVM_Int5cHandler(CONTEXT86*);
 
 /* int67.c */
 extern void WINAPI DOSVM_Int67Handler(CONTEXT86*);




Index: dlls/winedos/Makefile.in
===================================================================
RCS file: /home/wine/wine/dlls/winedos/Makefile.in,v
retrieving revision 1.18
diff -u -r1.18 Makefile.in
--- dlls/winedos/Makefile.in	23 Nov 2002 02:23:55 -0000	1.18
+++ dlls/winedos/Makefile.in	23 Nov 2002 15:39:23 -0000
@@ -3,7 +3,7 @@
 SRCDIR    = @srcdir@
 VPATH     = @srcdir@
 MODULE    = winedos.dll
-IMPORTS   = user32 kernel32 ntdll
+IMPORTS   = user32 advapi32 kernel32 ntdll
 ALTNAMES  = winedos16.dll
 EXTRALIBS = $(LIBUNICODE)
 
@@ -18,8 +18,10 @@
 	fpu.c \
 	int09.c \
 	int10.c \
+	int11.c \
 	int12.c \
 	int13.c \
+	int15.c \
 	int16.c \
 	int17.c \
 	int19.c \
@@ -33,6 +35,7 @@
 	int33.c \
 	int41.c \
 	int4b.c \
+	int5c.c \
 	int67.c \
 	interrupts.c \
 	ioports.c \




Index: dlls/ntdll/Makefile.in
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/Makefile.in,v
retrieving revision 1.46
diff -u -r1.46 Makefile.in
--- dlls/ntdll/Makefile.in	23 Nov 2002 02:23:55 -0000	1.46
+++ dlls/ntdll/Makefile.in	23 Nov 2002 15:39:32 -0000
@@ -50,12 +50,9 @@
 	$(TOPOBJDIR)/msdos/dosconf.c \
 	$(TOPOBJDIR)/msdos/dosmem.c \
 	$(TOPOBJDIR)/msdos/dpmi.c \
-	$(TOPOBJDIR)/msdos/int11.c \
-	$(TOPOBJDIR)/msdos/int15.c \
 	$(TOPOBJDIR)/msdos/int21.c \
 	$(TOPOBJDIR)/msdos/int25.c \
 	$(TOPOBJDIR)/msdos/int26.c \
-	$(TOPOBJDIR)/msdos/int5c.c \
 	$(TOPOBJDIR)/msdos/ioports.c \
 	$(TOPOBJDIR)/msdos/ppdev.c \
 	$(TOPOBJDIR)/msdos/vxd.c \




Index: dlls/kernel/kernel32.spec
===================================================================
RCS file: /home/wine/wine/dlls/kernel/kernel32.spec,v
retrieving revision 1.75
diff -u -r1.75 kernel32.spec
--- dlls/kernel/kernel32.spec	23 Nov 2002 02:23:55 -0000	1.75
+++ dlls/kernel/kernel32.spec	23 Nov 2002 15:39:41 -0000
@@ -1051,11 +1051,8 @@
 @ cdecl DOSMEM_GetBlock(long ptr) DOSMEM_GetBlock
 @ cdecl DOSMEM_GetDPMISegments() DOSMEM_GetDPMISegments
 @ cdecl DOSMEM_Init(long) DOSMEM_Init
-@ stdcall INT_Int11Handler(ptr) INT_Int11Handler
-@ stdcall INT_Int15Handler(ptr) INT_Int15Handler
 @ stdcall INT_Int25Handler(ptr) INT_Int25Handler
 @ stdcall INT_Int26Handler(ptr) INT_Int26Handler  
-@ stdcall NetBIOSCall16(ptr) NetBIOSCall16
 @ cdecl LOCAL_Alloc(long long long) LOCAL_Alloc
 @ cdecl LOCAL_Compact(long long long) LOCAL_Compact
 @ cdecl LOCAL_CountFree(long) LOCAL_CountFree




Index: include/miscemu.h
===================================================================
RCS file: /home/wine/wine/include/miscemu.h,v
retrieving revision 1.59
diff -u -r1.59 miscemu.h
--- include/miscemu.h	23 Nov 2002 02:23:54 -0000	1.59
+++ include/miscemu.h	23 Nov 2002 15:39:49 -0000
@@ -196,20 +196,11 @@
 extern DWORD IO_inport( int port, int count );
 extern void IO_outport( int port, int count, DWORD value );
 
-/* msdos/int11.c */
-extern void WINAPI INT_Int11Handler(CONTEXT86*);
-
-/* msdos/int15.c */
-extern void WINAPI INT_Int15Handler(CONTEXT86*);
-
 /* msdos/int25.c */
 extern void WINAPI INT_Int25Handler(CONTEXT86*);
 
 /* msdos/int26.c */
 extern void WINAPI INT_Int26Handler(CONTEXT86*);
-
-/* msdos/int5c.c */
-extern void WINAPI NetBIOSCall16(CONTEXT86*);
 
 /* msdos/dpmi.c */
 extern BOOL DPMI_LoadDosSystem(void);




--- /dev/null	Thu Jan  1 02:00:00 1970
+++ dlls/winedos/int11.c	Sat Nov 23 17:23:24 2002
@@ -0,0 +1,141 @@
+/*
+ * BIOS interrupt 11h handler
+ *
+ * Copyright 1996 Alexandre Julliard
+ *
+ * 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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "windef.h"
+#include "winreg.h"
+#include "miscemu.h"
+#include "msdos.h"
+#include "file.h"
+#include "wine/unicode.h"
+#include "wine/debug.h"
+
+
+/**********************************************************************
+ *	    DOSVM_Int11Handler (WINEDOS16.117)
+ *
+ * Handler for int 11h (get equipment list).
+ *
+ *
+ * Borrowed from Ralph Brown's interrupt lists:
+ *
+ *   bits 15-14: number of parallel devices
+ *   bit     13: [Conv] Internal modem
+ *   bit     12: reserved
+ *   bits 11- 9: number of serial devices
+ *   bit      8: reserved
+ *   bits  7- 6: number of diskette drives minus one
+ *   bits  5- 4: Initial video mode:
+ *                 00b = EGA,VGA,PGA
+ *                 01b = 40 x 25 color
+ *                 10b = 80 x 25 color
+ *                 11b = 80 x 25 mono
+ *   bit      3: reserved
+ *   bit      2: [PS] =1 if pointing device
+ *               [non-PS] reserved
+ *   bit      1: =1 if math co-processor
+ *   bit      0: =1 if diskette available for boot
+ *
+ *
+ * Currently the only of these bits correctly set are:
+ *
+ *   bits 15-14   } Added by William Owen Smith,
+ *   bits 11-9    } wos at dcs.warwick.ac.uk
+ *   bits 7-6
+ *   bit  2       (always set)  ( bit 2 = 4 )
+ *   bit  1       } Robert 'Admiral' Coeyman
+ *                  All *nix systems either have a math processor or
+ *		     emulate one.
+ */
+void WINAPI DOSVM_Int11Handler( CONTEXT86 *context )
+{
+    int diskdrives = 0;
+    int parallelports = 0;
+    int serialports = 0;
+    int x;
+
+    if (GetDriveTypeA("A:\\") == DRIVE_REMOVABLE) diskdrives++;
+    if (GetDriveTypeA("B:\\") == DRIVE_REMOVABLE) diskdrives++;
+    if (diskdrives) diskdrives--;
+
+    for (x=0; x < 9; x++)
+    {        
+        HKEY hkey;
+        char option[10];
+        char temp[256];
+
+        /* serial port name */
+        strcpy( option, "COMx" );
+        option[3] = '1' + x;
+        option[4] = '\0';
+
+        /* default value */
+        strcpy( temp, "*" );
+
+        if (!RegOpenKeyA(HKEY_LOCAL_MACHINE, 
+                         "Software\\Wine\\Wine\\Config\\serialports", 
+                         &hkey))
+        {
+            DWORD type;
+            DWORD count = sizeof(temp);
+            RegQueryValueExA( hkey, option, 0, &type, temp, &count );
+            RegCloseKey( hkey );
+        }
+
+        if (strcmp(temp, "*") && *temp != '\0')
+            serialports++;
+
+        /* parallel port name */
+        strcpy( option, "LPTx" );
+        option[3] = '1' + x;
+        option[4] = '\0';
+
+        /* default value */
+        strcpy( temp, "*" );
+
+        if (!RegOpenKeyA(HKEY_LOCAL_MACHINE,
+                         "Software\\Wine\\Wine\\Config\\parallelports", 
+                         &hkey))
+        {
+            DWORD type;
+            DWORD count = sizeof(temp);
+            RegQueryValueExA( hkey, option, 0, &type, temp, &count );
+            RegCloseKey( hkey );
+        }
+
+        if (strcmp(temp, "*") && *temp != '\0')
+            parallelports++;
+    }
+
+    if (serialports > 7) /* 3 bits -- maximum value = 7 */
+        serialports = 7;
+
+    if (parallelports > 3) /* 2 bits -- maximum value = 3 */
+        parallelports = 3;
+
+    SET_AX( context, 
+            (diskdrives << 6) | (serialports << 9) | (parallelports << 14) | 0x06 );
+}




--- /dev/null	Thu Jan  1 02:00:00 1970
+++ dlls/winedos/int15.c	Sat Nov 23 17:24:23 2002
@@ -0,0 +1,121 @@
+/*
+ * BIOS interrupt 15h handler
+ *
+ * Copyright 1997 Jan Willamowius
+ *
+ * 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 "miscemu.h"
+#include "wine/debug.h"
+#include "wine/winbase16.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(int);
+
+
+/**********************************************************************
+ *	    DOSVM_Int15Handler (WINEDOS16.121)
+ *
+ * Handler for int 15h
+ */
+void WINAPI DOSVM_Int15Handler( CONTEXT86 *context )
+{
+    switch(AH_reg(context))
+    {
+    case 0x84: /* read joystick information */
+        FIXME("Read joystick information not implemented\n");
+
+        /* FIXME: report status as if no game port exists */
+        switch(DX_reg(context))
+        {
+        case 0x0: /* read joystick switches */
+            SET_AL( context, 0x0 ); /* all switches open */
+            break;
+        case 0x1: /* read joystick position */
+            SET_AX( context, 0x0 );
+            SET_BX( context, 0x0 );
+            SET_CX( context, 0x0 );
+            SET_DX( context, 0x0 );
+            break;
+	default:
+            INT_BARF( context, 0x15 );
+            break;
+        }
+
+        RESET_CFLAG(context);
+        break;
+
+    case 0x88: /* get size of memory above 1 M */
+        SET_AX( context, 64 );  /* FIXME: are 64K ok? */
+        RESET_CFLAG(context);
+        break;
+
+    case 0xc0: /* GET CONFIGURATION */
+        if (ISV86(context))
+        {
+            /* real mode segment */
+            context->SegEs = 0xf000;
+        }
+        else
+        {
+            /* KERNEL.194: __F000H - protected mode selector */
+            FARPROC16 proc = GetProcAddress16( GetModuleHandle16("KERNEL"),
+                                               (LPCSTR)(ULONG_PTR)194 );
+            context->SegEs = LOWORD(proc);
+        }
+        SET_BX( context, 0xe6f5 );
+        SET_AH( context, 0x0 );
+        RESET_CFLAG(context);
+        break;
+
+    case 0xc2:
+	switch(AL_reg(context))
+	{
+	case 0x00: /* Enable-Disable Pointing Device (mouse) */
+	    /* BH = newstate, 00h = disabled 01h = enabled */
+	    switch(BH_reg(context))
+	    {
+	        case 0x00:
+	    	    FIXME("Disable Pointing Device - not implemented\n");
+		    break;
+	    	case 0x01:
+	    	    FIXME("Enable Pointing Device - not implemented\n");
+		    break;
+	    	default:
+		    INT_BARF( context, 0x15 );
+		    break;
+	    }
+	    SET_AH( context, 0x00 ); /* successful */
+	    break;
+	case 0x02: /* Set Sampling Rate */
+	    /* BH = sampling rate */
+	    FIXME("Set Sampling Rate - not implemented\n");
+	    SET_AH( context, 0x00 ); /* successful */
+	    break;
+	case 0x04: /* Get Pointing Device Type */
+	    FIXME("Get Pointing Device Type - not implemented\n");
+            /* FIXME: BH = Device id, What is it supposed to be? */
+	    SET_BH( context, 0x01 );
+	    break;
+	default:
+	    INT_BARF( context, 0x15 );
+	}
+        break;
+
+    default:
+        INT_BARF( context, 0x15 );
+    }
+}




--- /dev/null	Thu Jan  1 02:00:00 1970
+++ dlls/winedos/int5c.c	Sat Nov 23 16:56:05 2002
@@ -0,0 +1,39 @@
+/*
+ * NetBIOS interrupt handling
+ *
+ * Copyright 1995 Alexandre Julliard, Alex Korobka
+ *
+ * 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 "miscemu.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(int);
+
+
+/***********************************************************************
+ *           DOSVM_Int5cHandler (WINEDOS16.192)
+ *
+ * Called from NetBIOSCall16.
+ */
+void WINAPI DOSVM_Int5cHandler( CONTEXT86 *context )
+{
+    BYTE* ptr;
+    ptr = MapSL( MAKESEGPTR(context->SegEs,BX_reg(context)) );
+    FIXME("(%p): command code %02x (ignored)\n",context, *ptr);
+    *(ptr+0x01) = 0xFB; /* NetBIOS emulator not found */
+    SET_AL( context, 0xFB );
+}



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



More information about the wine-patches mailing list