From 7373ced54473899b75c6b9d813482d8500dba4f6 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 30 May 2007 13:12:09 +0200 Subject: [PATCH] winedos: Merge a number of tiny source files into interrupts.c. --- dlls/winedos/Makefile.in | 11 -- dlls/winedos/dosexe.h | 33 ---- dlls/winedos/int11.c | 114 ------------ dlls/winedos/int12.c | 15 -- dlls/winedos/int17.c | 55 ------ dlls/winedos/int19.c | 39 ---- dlls/winedos/int1a.c | 127 ------------- dlls/winedos/int20.c | 39 ---- dlls/winedos/int29.c | 39 ---- dlls/winedos/int2a.c | 26 --- dlls/winedos/int41.c | 70 ------- dlls/winedos/int4b.c | 29 --- dlls/winedos/int5c.c | 39 ---- dlls/winedos/interrupts.c | 371 ++++++++++++++++++++++++++++++++++++++ 14 files changed, 371 insertions(+), 636 deletions(-) delete mode 100644 dlls/winedos/int11.c delete mode 100644 dlls/winedos/int12.c delete mode 100644 dlls/winedos/int17.c delete mode 100644 dlls/winedos/int19.c delete mode 100644 dlls/winedos/int1a.c delete mode 100644 dlls/winedos/int20.c delete mode 100644 dlls/winedos/int29.c delete mode 100644 dlls/winedos/int2a.c delete mode 100644 dlls/winedos/int41.c delete mode 100644 dlls/winedos/int4b.c delete mode 100644 dlls/winedos/int5c.c diff --git a/dlls/winedos/Makefile.in b/dlls/winedos/Makefile.in index 0af19303099..b602b309079 100644 --- a/dlls/winedos/Makefile.in +++ b/dlls/winedos/Makefile.in @@ -19,26 +19,15 @@ C_SRCS = \ himem.c \ int09.c \ int10.c \ - int11.c \ - int12.c \ int13.c \ int15.c \ int16.c \ - int17.c \ - int19.c \ - int1a.c \ - int20.c \ int21.c \ int25.c \ int26.c \ - int29.c \ - int2a.c \ int2f.c \ int31.c \ int33.c \ - int41.c \ - int4b.c \ - int5c.c \ int67.c \ interrupts.c \ ioports.c \ diff --git a/dlls/winedos/dosexe.h b/dlls/winedos/dosexe.h index 00b39051d79..7b77470558e 100644 --- a/dlls/winedos/dosexe.h +++ b/dlls/winedos/dosexe.h @@ -427,35 +427,17 @@ extern BYTE WINAPI DOSVM_Int09ReadScan(BYTE*ascii); 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*); - /* int16.c */ extern void WINAPI DOSVM_Int16Handler(CONTEXT86*); extern BOOL WINAPI DOSVM_Int16ReadChar( BYTE *, BYTE *, CONTEXT86 * ); extern int WINAPI DOSVM_Int16AddChar(BYTE ascii,BYTE scan); -/* int17.c */ -extern void WINAPI DOSVM_Int17Handler(CONTEXT86*); - -/* int19.c */ -extern void WINAPI DOSVM_Int19Handler(CONTEXT86*); - -/* int20.c */ -extern void WINAPI DOSVM_Int20Handler(CONTEXT86*); - /* int21.c */ extern void WINAPI DOSVM_Int21Handler(CONTEXT86*); @@ -467,12 +449,6 @@ void WINAPI DOSVM_Int25Handler( CONTEXT86 * ); BOOL DOSVM_RawWrite( BYTE, DWORD, DWORD, BYTE *, BOOL ); void WINAPI DOSVM_Int26Handler( CONTEXT86 * ); -/* int29.c */ -extern void WINAPI DOSVM_Int29Handler(CONTEXT86*); - -/* int2a.c */ -extern void WINAPI DOSVM_Int2aHandler(CONTEXT86*); - /* int2f.c */ extern void WINAPI DOSVM_Int2fHandler(CONTEXT86*); extern void MSCDEX_InstallCDROM(void); @@ -491,15 +467,6 @@ 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*); - -/* int5c.c */ -extern void WINAPI DOSVM_Int5cHandler(CONTEXT86*); - /* int67.c */ extern void WINAPI DOSVM_Int67Handler(CONTEXT86*); extern void WINAPI EMS_Ioctl_Handler(CONTEXT86*); diff --git a/dlls/winedos/int11.c b/dlls/winedos/int11.c deleted file mode 100644 index f0bea99d967..00000000000 --- a/dlls/winedos/int11.c +++ /dev/null @@ -1,114 +0,0 @@ -/* - * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include "config.h" -#include "wine/port.h" - -#include -#include -#include -#include - -#include "windef.h" -#include "winbase.h" -#include "dosexe.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@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++) - { - HANDLE handle; - char file[10]; - - /* serial port name */ - sprintf( file, "\\\\.\\COM%d", x+1 ); - handle = CreateFileA( file, 0, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0 ); - if (handle != INVALID_HANDLE_VALUE) - { - CloseHandle( handle ); - serialports++; - } - - sprintf( file, "\\\\.\\LPT%d", x+1 ); - handle = CreateFileA( file, 0, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0 ); - if (handle != INVALID_HANDLE_VALUE) - { - CloseHandle( handle ); - 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 ); -} diff --git a/dlls/winedos/int12.c b/dlls/winedos/int12.c deleted file mode 100644 index 76e98fdede8..00000000000 --- a/dlls/winedos/int12.c +++ /dev/null @@ -1,15 +0,0 @@ -/* - * BIOS interrupt 12h handler - */ - -#include "dosexe.h" - -/********************************************************************** - * DOSVM_Int12Handler (WINEDOS16.118) - * - * Handler for int 12h (get memory size). - */ -void WINAPI DOSVM_Int12Handler( CONTEXT86 *context ) -{ - SET_AX( context, 640 ); -} diff --git a/dlls/winedos/int17.c b/dlls/winedos/int17.c deleted file mode 100644 index 9bd0ea8d92e..00000000000 --- a/dlls/winedos/int17.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * BIOS interrupt 17h handler - * - * Copyright 1998 Carl van Schaik - * - * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include -#include - -#include "windef.h" -#include "winbase.h" -#include "dosexe.h" -#include "wine/debug.h" - -WINE_DEFAULT_DEBUG_CHANNEL(int); - -/********************************************************************** - * DOSVM_Int17Handler (WINEDOS16.123) - * - * Handler for int 17h (printer - output character). - */ -void WINAPI DOSVM_Int17Handler( CONTEXT86 *context ) -{ - switch( AH_reg(context) ) - { - case 0x00:/* Send character*/ - FIXME("Send character not supported yet\n"); - SET_AH( context, 0x00 );/*Timeout*/ - break; - case 0x01: /* PRINTER - INITIALIZE */ - FIXME("Initialize Printer - Not Supported\n"); - SET_AH( context, 0x30 ); /* selected | out of paper */ - break; - case 0x02: /* PRINTER - GET STATUS */ - FIXME("Get Printer Status - Not Supported\n"); - break; - default: - SET_AH( context, 0 ); /* time out */ - INT_BARF( context, 0x17 ); - } -} diff --git a/dlls/winedos/int19.c b/dlls/winedos/int19.c deleted file mode 100644 index 0ec0db229ba..00000000000 --- a/dlls/winedos/int19.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * BIOS interrupt 19h handler - * - * Copyright 1998 Carl van Schaik - * - * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include -#include -#include "windef.h" -#include "winbase.h" -#include "wine/debug.h" - -WINE_DEFAULT_DEBUG_CHANNEL(int); - - -/********************************************************************** - * DOSVM_Int19Handler - * - * Handler for int 19h (Reboot). - */ -void WINAPI DOSVM_Int19Handler( CONTEXT86 *context ) -{ - TRACE( "Attempted Reboot\n" ); - ExitProcess(0); -} diff --git a/dlls/winedos/int1a.c b/dlls/winedos/int1a.c deleted file mode 100644 index c0d0795ee24..00000000000 --- a/dlls/winedos/int1a.c +++ /dev/null @@ -1,127 +0,0 @@ -/* - * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include "config.h" -#include "wine/debug.h" -#include "dosexe.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)) - - -/********************************************************************** - * DOSVM_Int1aHandler - * - * Handler for int 1ah. - */ -void WINAPI DOSVM_Int1aHandler( CONTEXT86 *context ) -{ - switch(AH_reg(context)) - { - case 0x00: /* GET SYSTEM TIME */ - { - BIOSDATA *data = DOSVM_BiosData(); - SET_CX( context, HIWORD(data->Ticks) ); - SET_DX( context, LOWORD(data->Ticks) ); - SET_AL( context, 0 ); /* FIXME: midnight flag is unsupported */ - TRACE( "GET SYSTEM TIME - ticks=%d\n", data->Ticks ); - } - break; - - case 0x01: /* SET SYSTEM TIME */ - FIXME( "SET SYSTEM TIME - not allowed\n" ); - break; - - case 0x02: /* GET REAL-TIME CLOCK TIME */ - TRACE( "GET REAL-TIME CLOCK TIME\n" ); - { - SYSTEMTIME systime; - GetLocalTime( &systime ); - SET_CH( context, BIN_TO_BCD(systime.wHour) ); - SET_CL( context, BIN_TO_BCD(systime.wMinute) ); - SET_DH( context, BIN_TO_BCD(systime.wSecond) ); - SET_DL( context, 0 ); /* FIXME: assume no daylight saving */ - RESET_CFLAG(context); - } - break; - - case 0x03: /* SET REAL-TIME CLOCK TIME */ - FIXME( "SET REAL-TIME CLOCK TIME - not allowed\n" ); - break; - - case 0x04: /* GET REAL-TIME CLOCK DATE */ - TRACE( "GET REAL-TIME CLOCK DATE\n" ); - { - SYSTEMTIME systime; - GetLocalTime( &systime ); - SET_CH( context, BIN_TO_BCD(systime.wYear / 100) ); - SET_CL( context, BIN_TO_BCD(systime.wYear % 100) ); - SET_DH( context, BIN_TO_BCD(systime.wMonth) ); - SET_DL( context, BIN_TO_BCD(systime.wDay) ); - RESET_CFLAG(context); - } - break; - - case 0x05: /* SET REAL-TIME CLOCK DATE */ - FIXME( "SET REAL-TIME CLOCK DATE - not allowed\n" ); - break; - - case 0x06: /* SET ALARM */ - FIXME( "SET ALARM - unimplemented\n" ); - break; - - case 0x07: /* CANCEL ALARM */ - FIXME( "CANCEL ALARM - unimplemented\n" ); - break; - - case 0x08: /* SET RTC ACTIVATED POWER ON MODE */ - case 0x09: /* READ RTC ALARM TIME AND STATUS */ - case 0x0a: /* READ SYSTEM-TIMER DAY COUNTER */ - case 0x0b: /* SET SYSTEM-TIMER DAY COUNTER */ - case 0x0c: /* SET RTC DATE/TIME ACTIVATED POWER-ON MODE */ - case 0x0d: /* RESET RTC DATE/TIME ACTIVATED POWER-ON MODE */ - case 0x0e: /* GET RTC DATE/TIME ALARM AND STATUS */ - case 0x0f: /* INITIALIZE REAL-TIME CLOCK */ - INT_BARF( context, 0x1a ); - break; - - case 0xb0: - if (CX_reg(context) == 0x4d52 && - DX_reg(context) == 0x4349 && - AL_reg(context) == 0x01) - { - /* - * Microsoft Real-Time Compression Interface (MRCI). - * Ignoring this call indicates MRCI is not supported. - */ - TRACE( "Microsoft Real-Time Compression Interface - not supported\n" ); - } - else - { - INT_BARF(context, 0x1a); - } - break; - - default: - INT_BARF( context, 0x1a ); - } -} diff --git a/dlls/winedos/int20.c b/dlls/winedos/int20.c deleted file mode 100644 index d7518109cc7..00000000000 --- a/dlls/winedos/int20.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * DOS interrupt 20h handler (TERMINATE PROGRAM) - * - * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include "dosexe.h" -#include "wine/debug.h" - -WINE_DEFAULT_DEBUG_CHANNEL(int); - -/********************************************************************** - * DOSVM_Int20Handler (WINEDOS16.132) - * - * Handler for int 20h. - */ -void WINAPI DOSVM_Int20Handler( CONTEXT86 *context ) -{ - if (DOSVM_IsWin16()) - ExitThread( 0 ); - else if(ISV86(context)) - MZ_Exit( context, TRUE, 0 ); - else - ERR( "Called from DOS protected mode\n" ); -} diff --git a/dlls/winedos/int29.c b/dlls/winedos/int29.c deleted file mode 100644 index f2fb3a2975b..00000000000 --- a/dlls/winedos/int29.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * DOS interrupt 29h handler - * - * Copyright 1998 Joseph Pranevich - * - * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include "config.h" - -#include - -#include "windef.h" -#include "winbase.h" - -#include "dosexe.h" - -/********************************************************************** - * DOSVM_Int29Handler (WINEDOS16.141) - * - * Handler for int 29h (fast console output) - */ -void WINAPI DOSVM_Int29Handler( CONTEXT86 *context ) -{ - /* Yes, it seems that this is really all this interrupt does. */ - DOSVM_PutChar(AL_reg(context)); -} diff --git a/dlls/winedos/int2a.c b/dlls/winedos/int2a.c deleted file mode 100644 index dd6f9607910..00000000000 --- a/dlls/winedos/int2a.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * DOS interrupt 2ah handler - */ - -#include -#include "dosexe.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 ); - } -} diff --git a/dlls/winedos/int41.c b/dlls/winedos/int41.c deleted file mode 100644 index 1f957221b8e..00000000000 --- a/dlls/winedos/int41.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include -#include "dosexe.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; - } - } -} diff --git a/dlls/winedos/int4b.c b/dlls/winedos/int4b.c deleted file mode 100644 index 02f71c0d664..00000000000 --- a/dlls/winedos/int4b.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * DOS interrupt 4bh handler - */ - -#include -#include "dosexe.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); - } -} diff --git a/dlls/winedos/int5c.c b/dlls/winedos/int5c.c deleted file mode 100644 index 96362b1d2ff..00000000000 --- a/dlls/winedos/int5c.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include "dosexe.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 ); -} diff --git a/dlls/winedos/interrupts.c b/dlls/winedos/interrupts.c index 3b5d09c9598..37d7a4ba805 100644 --- a/dlls/winedos/interrupts.c +++ b/dlls/winedos/interrupts.c @@ -20,6 +20,8 @@ #include "config.h" +#include + #include "dosexe.h" #include "wine/debug.h" #include "wine/winbase16.h" @@ -29,6 +31,20 @@ WINE_DEFAULT_DEBUG_CHANNEL(int); WINE_DECLARE_DEBUG_CHANNEL(relay); +#define BCD_TO_BIN(x) ((x&15) + (x>>4)*10) +#define BIN_TO_BCD(x) ((x%10) + ((x/10)<<4)) + +static void WINAPI DOSVM_Int11Handler(CONTEXT86*); +static void WINAPI DOSVM_Int12Handler(CONTEXT86*); +static void WINAPI DOSVM_Int17Handler(CONTEXT86*); +static void WINAPI DOSVM_Int19Handler(CONTEXT86*); +static void WINAPI DOSVM_Int1aHandler(CONTEXT86*); +static void WINAPI DOSVM_Int20Handler(CONTEXT86*); +static void WINAPI DOSVM_Int29Handler(CONTEXT86*); +static void WINAPI DOSVM_Int2aHandler(CONTEXT86*); +static void WINAPI DOSVM_Int41Handler(CONTEXT86*); +static void WINAPI DOSVM_Int4bHandler(CONTEXT86*); +static void WINAPI DOSVM_Int5cHandler(CONTEXT86*); static FARPROC16 DOSVM_Vectors16[256]; static FARPROC48 DOSVM_Vectors48[256]; @@ -686,3 +702,358 @@ void WINAPI DOSVM_CallBuiltinHandler( CONTEXT86 *context, BYTE intnum ) INTPROC proc = DOSVM_GetBuiltinHandler( intnum ); proc( context ); } + + +/********************************************************************** + * DOSVM_Int11Handler + * + * 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@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. + */ +static 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++) + { + HANDLE handle; + char file[10]; + + /* serial port name */ + sprintf( file, "\\\\.\\COM%d", x+1 ); + handle = CreateFileA( file, 0, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0 ); + if (handle != INVALID_HANDLE_VALUE) + { + CloseHandle( handle ); + serialports++; + } + + sprintf( file, "\\\\.\\LPT%d", x+1 ); + handle = CreateFileA( file, 0, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0 ); + if (handle != INVALID_HANDLE_VALUE) + { + CloseHandle( handle ); + 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 ); +} + + +/********************************************************************** + * DOSVM_Int12Handler + * + * Handler for int 12h (get memory size). + */ +static void WINAPI DOSVM_Int12Handler( CONTEXT86 *context ) +{ + SET_AX( context, 640 ); +} + + +/********************************************************************** + * DOSVM_Int17Handler + * + * Handler for int 17h (printer - output character). + */ +static void WINAPI DOSVM_Int17Handler( CONTEXT86 *context ) +{ + switch( AH_reg(context) ) + { + case 0x00:/* Send character*/ + FIXME("Send character not supported yet\n"); + SET_AH( context, 0x00 );/*Timeout*/ + break; + case 0x01: /* PRINTER - INITIALIZE */ + FIXME("Initialize Printer - Not Supported\n"); + SET_AH( context, 0x30 ); /* selected | out of paper */ + break; + case 0x02: /* PRINTER - GET STATUS */ + FIXME("Get Printer Status - Not Supported\n"); + break; + default: + SET_AH( context, 0 ); /* time out */ + INT_BARF( context, 0x17 ); + } +} + + +/********************************************************************** + * DOSVM_Int19Handler + * + * Handler for int 19h (Reboot). + */ +static void WINAPI DOSVM_Int19Handler( CONTEXT86 *context ) +{ + TRACE( "Attempted Reboot\n" ); + ExitProcess(0); +} + + +/********************************************************************** + * DOSVM_Int1aHandler + * + * Handler for int 1ah. + */ +static void WINAPI DOSVM_Int1aHandler( CONTEXT86 *context ) +{ + switch(AH_reg(context)) + { + case 0x00: /* GET SYSTEM TIME */ + { + BIOSDATA *data = DOSVM_BiosData(); + SET_CX( context, HIWORD(data->Ticks) ); + SET_DX( context, LOWORD(data->Ticks) ); + SET_AL( context, 0 ); /* FIXME: midnight flag is unsupported */ + TRACE( "GET SYSTEM TIME - ticks=%d\n", data->Ticks ); + } + break; + + case 0x01: /* SET SYSTEM TIME */ + FIXME( "SET SYSTEM TIME - not allowed\n" ); + break; + + case 0x02: /* GET REAL-TIME CLOCK TIME */ + TRACE( "GET REAL-TIME CLOCK TIME\n" ); + { + SYSTEMTIME systime; + GetLocalTime( &systime ); + SET_CH( context, BIN_TO_BCD(systime.wHour) ); + SET_CL( context, BIN_TO_BCD(systime.wMinute) ); + SET_DH( context, BIN_TO_BCD(systime.wSecond) ); + SET_DL( context, 0 ); /* FIXME: assume no daylight saving */ + RESET_CFLAG(context); + } + break; + + case 0x03: /* SET REAL-TIME CLOCK TIME */ + FIXME( "SET REAL-TIME CLOCK TIME - not allowed\n" ); + break; + + case 0x04: /* GET REAL-TIME CLOCK DATE */ + TRACE( "GET REAL-TIME CLOCK DATE\n" ); + { + SYSTEMTIME systime; + GetLocalTime( &systime ); + SET_CH( context, BIN_TO_BCD(systime.wYear / 100) ); + SET_CL( context, BIN_TO_BCD(systime.wYear % 100) ); + SET_DH( context, BIN_TO_BCD(systime.wMonth) ); + SET_DL( context, BIN_TO_BCD(systime.wDay) ); + RESET_CFLAG(context); + } + break; + + case 0x05: /* SET REAL-TIME CLOCK DATE */ + FIXME( "SET REAL-TIME CLOCK DATE - not allowed\n" ); + break; + + case 0x06: /* SET ALARM */ + FIXME( "SET ALARM - unimplemented\n" ); + break; + + case 0x07: /* CANCEL ALARM */ + FIXME( "CANCEL ALARM - unimplemented\n" ); + break; + + case 0x08: /* SET RTC ACTIVATED POWER ON MODE */ + case 0x09: /* READ RTC ALARM TIME AND STATUS */ + case 0x0a: /* READ SYSTEM-TIMER DAY COUNTER */ + case 0x0b: /* SET SYSTEM-TIMER DAY COUNTER */ + case 0x0c: /* SET RTC DATE/TIME ACTIVATED POWER-ON MODE */ + case 0x0d: /* RESET RTC DATE/TIME ACTIVATED POWER-ON MODE */ + case 0x0e: /* GET RTC DATE/TIME ALARM AND STATUS */ + case 0x0f: /* INITIALIZE REAL-TIME CLOCK */ + INT_BARF( context, 0x1a ); + break; + + case 0xb0: + if (CX_reg(context) == 0x4d52 && + DX_reg(context) == 0x4349 && + AL_reg(context) == 0x01) + { + /* + * Microsoft Real-Time Compression Interface (MRCI). + * Ignoring this call indicates MRCI is not supported. + */ + TRACE( "Microsoft Real-Time Compression Interface - not supported\n" ); + } + else + { + INT_BARF(context, 0x1a); + } + break; + + default: + INT_BARF( context, 0x1a ); + } +} + + +/********************************************************************** + * DOSVM_Int20Handler + * + * Handler for int 20h. + */ +static void WINAPI DOSVM_Int20Handler( CONTEXT86 *context ) +{ + if (DOSVM_IsWin16()) + ExitThread( 0 ); + else if(ISV86(context)) + MZ_Exit( context, TRUE, 0 ); + else + ERR( "Called from DOS protected mode\n" ); +} + + +/********************************************************************** + * DOSVM_Int29Handler + * + * Handler for int 29h (fast console output) + */ +static void WINAPI DOSVM_Int29Handler( CONTEXT86 *context ) +{ + /* Yes, it seems that this is really all this interrupt does. */ + DOSVM_PutChar(AL_reg(context)); +} + + +/********************************************************************** + * DOSVM_Int2aHandler + * + * Handler for int 2ah (network). + */ +static void WINAPI DOSVM_Int2aHandler( CONTEXT86 *context ) +{ + switch(AH_reg(context)) + { + case 0x00: /* NETWORK INSTALLATION CHECK */ + break; + + default: + INT_BARF( context, 0x2a ); + } +} + + +/*********************************************************************** + * DOSVM_Int41Handler + */ +static 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; + } + } +} + + +/*********************************************************************** + * DOSVM_Int4bHandler + * + */ +static 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); + } +} + + +/*********************************************************************** + * DOSVM_Int5cHandler + * + * Called from NetBIOSCall16. + */ +static 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 ); +}