Added support for FPU emulation interrupts.
[wine] / msdos / int15.c
1 /*
2  * BIOS interrupt 15h handler
3  *
4  * Copyright 1997 Jan Willamowius
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20
21 #include <stdlib.h>
22 #include "miscemu.h"
23 #include "wine/debug.h"
24
25 WINE_DEFAULT_DEBUG_CHANNEL(int);
26
27
28 /**********************************************************************
29  *          INT_Int15Handler (WPROCS.121)
30  *
31  * Handler for int 15h
32  */
33 void WINAPI INT_Int15Handler( CONTEXT86 *context )
34 {
35     switch(AH_reg(context))
36     {
37     case 0x84: /* read joystick information */
38         FIXME("Read joystick information not implemented\n");
39
40         /* FIXME: report status as if no game port exists */
41         switch(DX_reg(context))
42         {
43         case 0x0: /* read joystick switches */
44             AL_reg(context) = 0x0; /* all switches open */
45             break;
46         case 0x1: /* read joystick position */
47             AX_reg(context) = 0x0;
48             BX_reg(context) = 0x0;
49             CX_reg(context) = 0x0;
50             DX_reg(context) = 0x0;
51             break;
52         default:
53             INT_BARF( context, 0x15 );
54             break;
55         }
56
57         RESET_CFLAG(context);
58
59         break;
60
61     case 0x88: /* get size of memory above 1 M */
62         AX_reg(context) = 64;  /* FIXME: are 64K ok? */
63         RESET_CFLAG(context);
64         break;
65
66     case 0xc0: /* GET CONFIGURATION */
67         if (ISV86(context)) /* real */
68             context->SegEs = 0xf000;
69         else
70             context->SegEs = DOSMEM_BiosSysSeg;
71         BX_reg(context) = 0xe6f5;
72         AH_reg(context) = 0x0;
73         RESET_CFLAG(context);
74         break;
75     case 0xc2:
76         switch(AL_reg(context))
77         {
78         case 0x00: /* Enable-Disable Pointing Device (mouse) */
79             /* BH = newstate, 00h = disabled 01h = enabled */
80             switch(BH_reg(context))
81             {
82                 case 0x00:
83                     FIXME("Disable Pointing Device - not implemented\n");
84                     break;
85                 case 0x01:
86                     FIXME("Enable Pointing Device - not implemented\n");
87                     break;
88                 default:
89                     INT_BARF( context, 0x15 );
90                     break;
91             }
92             AH_reg(context) = 0x00; /* successful */
93             break;
94         case 0x02: /* Set Sampling Rate */
95             /* BH = sampling rate */
96             FIXME("Set Sampling Rate - not implemented\n");
97             AH_reg(context) = 0x00; /* successful */
98             break;
99         case 0x04: /* Get Pointing Device Type */
100             FIXME("Get Pointing Device Type - not implemented\n");
101             BH_reg(context) = 0x01;/*Device id FIXME what is it supposed to be?*/
102             break;
103         default:
104             INT_BARF( context, 0x15 );
105         }
106         break;
107
108     default:
109         INT_BARF( context, 0x15 );
110     }
111 }