<malloc.h> is not ISO C, <stdlib.h> is.
[wine.git] / msdos / int11.c
blob3aabe291fcf5043c950ea019c8e209c00d228ec6
1 /*
2 * BIOS interrupt 11h handler
3 */
5 #include <stdio.h>
6 #include <stdlib.h>
8 #include "config.h"
9 #include "windef.h"
10 #include "miscemu.h"
11 #include "msdos.h"
12 #include "debugtools.h"
13 #include "options.h"
15 /**********************************************************************
16 * INT_Int11Handler
18 * Handler for int 11h (get equipment list).
20 void WINAPI INT_Int11Handler( CONTEXT86 *context )
22 int diskdrives = 0;
23 int parallelports = 0;
24 int serialports = 0;
25 int x;
27 /* borrowed from Ralph Brown's interrupt lists
29 bits 15-14: number of parallel devices
30 bit 13: [Conv] Internal modem
31 bit 12: reserved
32 bits 11- 9: number of serial devices
33 bit 8: reserved
34 bits 7- 6: number of diskette drives minus one
35 bits 5- 4: Initial video mode:
36 00b = EGA,VGA,PGA
37 01b = 40 x 25 color
38 10b = 80 x 25 color
39 11b = 80 x 25 mono
40 bit 3: reserved
41 bit 2: [PS] =1 if pointing device
42 [non-PS] reserved
43 bit 1: =1 if math co-processor
44 bit 0: =1 if diskette available for boot
46 /* Currently the only of these bits correctly set are:
47 bits 15-14 } Added by William Owen Smith,
48 bits 11-9 } wos@dcs.warwick.ac.uk
49 bits 7-6
50 bit 2 (always set)
53 if (GetDriveTypeA("A:\\") == DRIVE_REMOVABLE) diskdrives++;
54 if (GetDriveTypeA("B:\\") == DRIVE_REMOVABLE) diskdrives++;
55 if (diskdrives) diskdrives--;
57 for (x=0; x < 9; x++)
59 char temp[16],name[16];
61 sprintf(name,"COM%d",x+1);
62 PROFILE_GetWineIniString("serialports",name,"*",temp,sizeof temp);
63 if(strcmp(temp,"*"))
64 serialports++;
66 sprintf(name,"LPT%d",x+1);
67 PROFILE_GetWineIniString("parallelports",name,"*",temp,sizeof temp);
68 if(strcmp(temp,"*"))
69 parallelports++;
71 if (serialports > 7) /* 3 bits -- maximum value = 7 */
72 serialports=7;
73 if (parallelports > 3) /* 2 bits -- maximum value = 3 */
74 parallelports=3;
76 AX_reg(context) = (diskdrives << 6) | (serialports << 9) |
77 (parallelports << 14) | 0x02;