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