Commit 7373ced5 authored by Alexandre Julliard's avatar Alexandre Julliard

winedos: Merge a number of tiny source files into interrupts.c.

parent 7718d2bd
......@@ -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 \
......
......@@ -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*);
......
/*
* 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 <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#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 );
}
/*
* 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 );
}
/*
* 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 <stdarg.h>
#include <stdlib.h>
#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 );
}
}
/*
* 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 <stdlib.h>
#include <stdarg.h>
#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);
}
/*
* 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 );
}
}
/*
* 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" );
}
/*
* 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 <stdarg.h>
#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));
}
/*
* DOS interrupt 2ah handler
*/
#include <stdlib.h>
#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 );
}
}
/*
* 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 <stdio.h>
#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;
}
}
}
/*
* DOS interrupt 4bh handler
*/
#include <stdio.h>
#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);
}
}
/*
* 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 );
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment