advpack: Fix buffer sizes for possibly quoted strings.
[wine.git] / dlls / winedos / int15.c
blob24c9121ae03e4a4a8d432da7921696533132d536
1 /*
2 * BIOS interrupt 15h handler
4 * Copyright 1997 Jan Willamowius
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.
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.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include <stdlib.h>
22 #include "dosexe.h"
23 #include "wine/debug.h"
24 #include "wine/winbase16.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(int);
29 /**********************************************************************
30 * DOSVM_Int15Handler (WINEDOS16.121)
32 * Handler for int 15h
34 void WINAPI DOSVM_Int15Handler( CONTEXT86 *context )
36 switch(AH_reg(context))
38 case 0x4f: /*catch keyboard*/
39 FIXME("INT15: intercept keyboard not handled yet\n");
40 break;
41 case 0x83: /* start timer*/
42 switch(AL_reg(context))
44 case 0x00: /* Start Timer*/
45 FIXME("INT15: Start Timer not handled yet\n");
46 break;
47 case 0x01: /* stop timer*/
48 FIXME("INT15: Stop Timer not handled yet\n");
49 break;
51 break;
52 case 0x84: /* read joystick information */
53 FIXME("Read joystick information not implemented\n");
55 /* FIXME: report status as if no game port exists */
56 switch(DX_reg(context))
58 case 0x0: /* read joystick switches */
59 SET_AL( context, 0x0 ); /* all switches open */
60 break;
61 case 0x1: /* read joystick position */
62 SET_AX( context, 0x0 );
63 SET_BX( context, 0x0 );
64 SET_CX( context, 0x0 );
65 SET_DX( context, 0x0 );
66 break;
67 default:
68 INT_BARF( context, 0x15 );
69 break;
72 RESET_CFLAG(context);
73 break;
74 case 0x85: /* sysreq - key used*/
75 FIXME("INT15: SysReq - Key not handled yet\n");
76 break;
77 case 0x86: /* wait*/
78 FIXME("INT15: Wait not correctly handled yet\n");
79 if ( AL_reg( context ) != 0x00 ) ERR("Invalid Input to Int15 function 0x86h AL != 0x00\n");
80 break;
81 case 0x87: /* move memory regions*/
82 FIXME("INT15: Move memory regions not implemented\n");
83 break;
85 case 0x88: /* get size of memory above 1 M */
86 SET_AX( context, 64 ); /* FIXME: are 64K ok? */
87 RESET_CFLAG(context);
88 break;
89 case 0x89: /* Switch to protected mode*/
90 FIXME("INT15: switching to protected mode not supported\n");
91 break;
92 case 0x90:/* OS hook - Device busy*/
93 FIXME("INT15: OS hook - device busy\n");
94 break;
95 case 0x91: /* OS hook - Device post*/
96 FIXME("INT15: OS hook - device post\n");
97 break;
99 case 0xc0: /* GET CONFIGURATION */
100 if (ISV86(context))
102 /* real mode segment */
103 context->SegEs = 0xf000;
105 else
107 /* KERNEL.194: __F000H - protected mode selector */
108 FARPROC16 proc = GetProcAddress16( GetModuleHandle16("KERNEL"),
109 (LPCSTR)(ULONG_PTR)194 );
110 context->SegEs = LOWORD(proc);
112 SET_BX( context, 0xe6f5 );
113 SET_AH( context, 0x0 );
114 RESET_CFLAG(context);
115 break;
117 case 0xc2:
118 switch(AL_reg(context))
120 case 0x00: /* Enable-Disable Pointing Device (mouse) */
121 /* BH = newstate, 00h = disabled 01h = enabled */
122 switch(BH_reg(context))
124 case 0x00:
125 FIXME("Disable Pointing Device - not implemented\n");
126 break;
127 case 0x01:
128 FIXME("Enable Pointing Device - not implemented\n");
129 break;
130 default:
131 INT_BARF( context, 0x15 );
132 break;
134 SET_AH( context, 0x00 ); /* successful */
135 break;
136 case 0x02: /* Set Sampling Rate */
137 /* BH = sampling rate */
138 FIXME("Set Sampling Rate - not implemented\n");
139 SET_AH( context, 0x00 ); /* successful */
140 break;
141 case 0x04: /* Get Pointing Device Type */
142 FIXME("Get Pointing Device Type - not implemented\n");
143 /* FIXME: BH = Device id, What is it supposed to be? */
144 SET_BH( context, 0x01 );
145 break;
146 default:
147 INT_BARF( context, 0x15 );
149 break;
150 case 0xc3: /* set carry flag, so BorlandRTM doesn't assume a Vectra/PS2*/
151 FIXME("INT15: 0xc3\n");
152 SET_AH( context , 0x86 );
153 break;
154 case 0xc4: /* BIOS POS Program option select */
155 FIXME("INT15: option 0xc4 not handled!\n");
156 break;
158 default:
159 INT_BARF( context, 0x15 );