Fixed header dependencies to be fully compatible with the Windows
[wine/multimedia.git] / dlls / winedos / ioports.c
blob98be490a412173db78c2cb8ba3a817393eeccf19
1 /*
2 * Emulation of processor ioports.
4 * Copyright 1995 Morten Welinder
5 * Copyright 1998 Andreas Mohr, Ove Kaaven
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "config.h"
24 #include <stdarg.h>
26 #include "windef.h"
27 #include "winbase.h"
28 #include "dosexe.h"
29 #include "vga.h"
30 #include "wine/debug.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(int);
34 /**********************************************************************
35 * DOSVM_inport
37 BOOL WINAPI DOSVM_inport( int port, int size, DWORD *res )
39 switch (port)
41 case 0x60:
42 *res = DOSVM_Int09ReadScan(NULL);
43 break;
44 case 0x22a:
45 case 0x22c:
46 case 0x22e:
47 *res = (DWORD)SB_ioport_in( port );
48 break;
49 case 0x3ba:
50 case 0x3c0:
51 case 0x3c1:
52 case 0x3c2:
53 case 0x3c3:
54 case 0x3c4:
55 case 0x3c5:
56 case 0x3c6:
57 case 0x3c7:
58 case 0x3c8:
59 case 0x3c9:
60 case 0x3ca:
61 case 0x3cb:
62 case 0x3cc:
63 case 0x3cd:
64 case 0x3ce:
65 case 0x3cf:
66 case 0x3d0:
67 case 0x3d1:
68 case 0x3d2:
69 case 0x3d3:
70 case 0x3d4:
71 case 0x3d5:
72 case 0x3d6:
73 case 0x3d7:
74 case 0x3d8:
75 case 0x3d9:
76 case 0x3da:
77 case 0x3db:
78 case 0x3dc:
79 case 0x3dd:
80 case 0x3de:
81 case 0x3df:
82 if(size > 1)
83 FIXME("Trying to read more than one byte from VGA!\n");
84 *res = (DWORD)VGA_ioport_in( port );
85 break;
86 case 0x00:
87 case 0x01:
88 case 0x02:
89 case 0x03:
90 case 0x04:
91 case 0x05:
92 case 0x06:
93 case 0x07:
94 case 0xC0:
95 case 0xC2:
96 case 0xC4:
97 case 0xC6:
98 case 0xC8:
99 case 0xCA:
100 case 0xCC:
101 case 0xCE:
102 case 0x87:
103 case 0x83:
104 case 0x81:
105 case 0x82:
106 case 0x8B:
107 case 0x89:
108 case 0x8A:
109 case 0x487:
110 case 0x483:
111 case 0x481:
112 case 0x482:
113 case 0x48B:
114 case 0x489:
115 case 0x48A:
116 case 0x08:
117 case 0xD0:
118 case 0x0D:
119 case 0xDA:
120 *res = (DWORD)DMA_ioport_in( port );
121 break;
122 default:
123 return FALSE; /* not handled */
125 return TRUE; /* handled */
129 /**********************************************************************
130 * DOSVM_outport
132 BOOL WINAPI DOSVM_outport( int port, int size, DWORD value )
134 switch (port)
136 case 0x20:
137 DOSVM_PIC_ioport_out( port, (BYTE)value );
138 break;
139 case 0x226:
140 case 0x22c:
141 SB_ioport_out( port, (BYTE)value );
142 break;
143 case 0x3c0:
144 case 0x3c1:
145 case 0x3c2:
146 case 0x3c3:
147 case 0x3c4:
148 case 0x3c5:
149 case 0x3c6:
150 case 0x3c7:
151 case 0x3c8:
152 case 0x3c9:
153 case 0x3ca:
154 case 0x3cb:
155 case 0x3cc:
156 case 0x3cd:
157 case 0x3ce:
158 case 0x3cf:
159 case 0x3d0:
160 case 0x3d1:
161 case 0x3d2:
162 case 0x3d3:
163 case 0x3d4:
164 case 0x3d5:
165 case 0x3d6:
166 case 0x3d7:
167 case 0x3d8:
168 case 0x3d9:
169 case 0x3da:
170 case 0x3db:
171 case 0x3dc:
172 case 0x3dd:
173 case 0x3de:
174 case 0x3df:
175 VGA_ioport_out( port, LOBYTE(value) );
176 if(size > 1) {
177 VGA_ioport_out( port+1, HIBYTE(value) );
178 if(size > 2) {
179 VGA_ioport_out( port+2, LOBYTE(HIWORD(value)) );
180 VGA_ioport_out( port+3, HIBYTE(HIWORD(value)) );
183 break;
184 case 0x00:
185 case 0x01:
186 case 0x02:
187 case 0x03:
188 case 0x04:
189 case 0x05:
190 case 0x06:
191 case 0x07:
192 case 0xC0:
193 case 0xC2:
194 case 0xC4:
195 case 0xC6:
196 case 0xC8:
197 case 0xCA:
198 case 0xCC:
199 case 0xCE:
200 case 0x87:
201 case 0x83:
202 case 0x81:
203 case 0x82:
204 case 0x8B:
205 case 0x89:
206 case 0x8A:
207 case 0x487:
208 case 0x483:
209 case 0x481:
210 case 0x482:
211 case 0x48B:
212 case 0x489:
213 case 0x48A:
214 case 0x08:
215 case 0xD0:
216 case 0x0B:
217 case 0xD6:
218 case 0x0A:
219 case 0xD4:
220 case 0x0F:
221 case 0xDE:
222 case 0x09:
223 case 0xD2:
224 case 0x0C:
225 case 0xD8:
226 case 0x0D:
227 case 0xDA:
228 case 0x0E:
229 case 0xDC:
230 DMA_ioport_out( port, (BYTE)value );
231 break;
232 default:
233 return FALSE; /* not handled */
235 return TRUE; /* handled */