Framework for the doppler effect.
[wine] / dlls / winedos / 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 #include "wine/winbase16.h"
25
26 WINE_DEFAULT_DEBUG_CHANNEL(int);
27
28
29 /**********************************************************************
30  *          DOSVM_Int15Handler (WINEDOS16.121)
31  *
32  * Handler for int 15h
33  */
34 void WINAPI DOSVM_Int15Handler( CONTEXT86 *context )
35 {
36     switch(AH_reg(context))
37     {
38     case 0x84: /* read joystick information */
39         FIXME("Read joystick information not implemented\n");
40
41         /* FIXME: report status as if no game port exists */
42         switch(DX_reg(context))
43         {
44         case 0x0: /* read joystick switches */
45             SET_AL( context, 0x0 ); /* all switches open */
46             break;
47         case 0x1: /* read joystick position */
48             SET_AX( context, 0x0 );
49             SET_BX( context, 0x0 );
50             SET_CX( context, 0x0 );
51             SET_DX( context, 0x0 );
52             break;
53         default:
54             INT_BARF( context, 0x15 );
55             break;
56         }
57
58         RESET_CFLAG(context);
59         break;
60
61     case 0x88: /* get size of memory above 1 M */
62         SET_AX( context, 64 );  /* FIXME: are 64K ok? */
63         RESET_CFLAG(context);
64         break;
65
66     case 0xc0: /* GET CONFIGURATION */
67         if (ISV86(context))
68         {
69             /* real mode segment */
70             context->SegEs = 0xf000;
71         }
72         else
73         {
74             /* KERNEL.194: __F000H - protected mode selector */
75             FARPROC16 proc = GetProcAddress16( GetModuleHandle16("KERNEL"),
76                                                (LPCSTR)(ULONG_PTR)194 );
77             context->SegEs = LOWORD(proc);
78         }
79         SET_BX( context, 0xe6f5 );
80         SET_AH( context, 0x0 );
81         RESET_CFLAG(context);
82         break;
83
84     case 0xc2:
85         switch(AL_reg(context))
86         {
87         case 0x00: /* Enable-Disable Pointing Device (mouse) */
88             /* BH = newstate, 00h = disabled 01h = enabled */
89             switch(BH_reg(context))
90             {
91                 case 0x00:
92                     FIXME("Disable Pointing Device - not implemented\n");
93                     break;
94                 case 0x01:
95                     FIXME("Enable Pointing Device - not implemented\n");
96                     break;
97                 default:
98                     INT_BARF( context, 0x15 );
99                     break;
100             }
101             SET_AH( context, 0x00 ); /* successful */
102             break;
103         case 0x02: /* Set Sampling Rate */
104             /* BH = sampling rate */
105             FIXME("Set Sampling Rate - not implemented\n");
106             SET_AH( context, 0x00 ); /* successful */
107             break;
108         case 0x04: /* Get Pointing Device Type */
109             FIXME("Get Pointing Device Type - not implemented\n");
110             /* FIXME: BH = Device id, What is it supposed to be? */
111             SET_BH( context, 0x01 );
112             break;
113         default:
114             INT_BARF( context, 0x15 );
115         }
116         break;
117
118     default:
119         INT_BARF( context, 0x15 );
120     }
121 }