Release 960623
[wine] / miscemu / vxd.c
1 /*
2  * VxD emulation
3  *
4  * Copyright 1995 Anand Kumria
5  */
6
7 #include <stdio.h>
8 #include "windows.h"
9 #include "msdos.h"
10 #include "miscemu.h"
11 #include "wine.h"
12 #include "stddebug.h"
13 /* #define DEBUG_VXD */
14 #include "debug.h"
15
16
17 /***********************************************************************
18  *           VXD_PageFile
19  */
20 void VXD_PageFile( struct sigcontext_struct context )
21 {
22     /* taken from Ralf Brown's Interrupt List */
23
24     dprintf_vxd(stddeb,"VxD PageFile called ...\n");
25
26     switch(AX_reg(&context)) 
27     {
28     case 0x00: /* get version, is this windows version? */
29         dprintf_vxd(stddeb,"VxD PageFile: returning version\n");
30         AX_reg(&context) = (WINVERSION >> 8) | ((WINVERSION << 8) & 0xff00);
31         RESET_CFLAG(&context);
32         break;
33
34     case 0x01: /* get swap file info */
35         dprintf_vxd(stddeb,"VxD PageFile: returning swap file info\n");
36         AX_reg(&context) = 0x00; /* paging disabled */
37         ECX_reg(&context) = 0;   /* maximum size of paging file */      
38         /* FIXME: do I touch DS:SI or DS:DI? */
39         RESET_CFLAG(&context);
40         break;
41
42     case 0x02: /* delete permanent swap on exit */
43         dprintf_vxd(stddeb,"VxD PageFile: supposed to delete swap\n");
44         RESET_CFLAG(&context);
45         break;
46
47     case 0x03: /* current temporary swap file size */
48         dprintf_vxd(stddeb,"VxD PageFile: what is current temp. swap size\n");
49         RESET_CFLAG(&context);
50         break;
51
52     case 0x04: /* read or write?? INTERRUP.D */
53     case 0x05: /* cancel?? INTERRUP.D */
54     case 0x06: /* test I/O valid INTERRUP.D */
55     default:
56         INT_BARF( &context, 0x2f);
57         break;
58     }
59 }
60
61
62 /***********************************************************************
63  *           VXD_Shell
64  */
65 void VXD_Shell( struct sigcontext_struct context )
66 {
67     dprintf_vxd(stddeb,"VxD Shell called ...\n");
68
69     switch (DX_reg(&context)) /* Ralf Brown says EDX, but I use DX instead */
70     {
71     case 0x0000:
72         dprintf_vxd(stddeb,"VxD Shell: returning version\n");
73         AX_reg(&context) = (WINVERSION >> 8) | ((WINVERSION << 8) & 0xff00);
74         EBX_reg(&context) = 1; /* system VM Handle */
75         break;
76
77     case 0x0001:
78     case 0x0002:
79     case 0x0003:
80     case 0x0004:
81     case 0x0005:
82         dprintf_vxd(stddeb,"VxD Shell: EDX = %08lx\n",EDX_reg(&context));
83         INT_BARF( &context, 0x2f);
84         break;
85
86     case 0x0006: /* SHELL_Get_VM_State */
87         dprintf_vxd(stddeb,"VxD Shell: returning VM state\n");
88         /* Actually we don't, not yet. We have to return a structure
89          * and I am not to sure how to set it up and return it yet,
90          * so for now let's do nothing. I can (hopefully) get this
91          * by the next release
92          */
93         /* RESET_CFLAG(&context); */
94         break;
95
96     case 0x0007:
97     case 0x0008:
98     case 0x0009:
99     case 0x000A:
100     case 0x000B:
101     case 0x000C:
102     case 0x000D:
103     case 0x000E:
104     case 0x000F:
105     case 0x0010:
106     case 0x0011:
107     case 0x0012:
108     case 0x0013:
109     case 0x0014:
110     case 0x0015:
111     case 0x0016:
112     default:
113         dprintf_vxd(stddeb,"VxD Shell: EDX = %08lx\n",EDX_reg(&context)); 
114         INT_BARF( &context, 0x2f);
115         break;
116     }
117 }
118
119
120 /***********************************************************************
121  *           VXD_Comm
122  */
123 void VXD_Comm( struct sigcontext_struct context )
124 {
125     dprintf_vxd(stddeb,"VxD Comm called ...\n");
126
127     switch (AX_reg(&context))
128     {
129     case 0x0000: /* get version */
130         dprintf_vxd(stddeb,"VxD Comm: returning version\n");
131         AX_reg(&context) = (WINVERSION >> 8) | ((WINVERSION << 8) & 0xff00);
132         RESET_CFLAG(&context);
133         break;
134
135     case 0x0001: /* set port global */
136     case 0x0002: /* get focus */
137     case 0x0003: /* virtualise port */
138     default:
139         INT_BARF( &context, 0x2f);
140     }
141 }