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