2 * DOS interrupt 33h handler
12 #include "debugtools.h"
14 DEFAULT_DEBUG_CHANNEL(int);
23 /**********************************************************************
26 * Handler for int 33h (MS MOUSE).
28 void WINAPI INT_Int33Handler( CONTEXT86 *context )
30 switch (LOWORD(context->Eax)) {
32 TRACE("Reset mouse driver and request status\n");
33 AX_reg(context) = 0xFFFF; /* installed */
34 BX_reg(context) = 3; /* # of buttons */
35 memset( &mouse_info, 0, sizeof(mouse_info) );
38 FIXME("Show mouse cursor\n");
41 FIXME("Hide mouse cursor\n");
44 TRACE("Return mouse position and button status\n");
45 BX_reg(context) = mouse_info.but;
46 CX_reg(context) = mouse_info.x;
47 DX_reg(context) = mouse_info.y;
50 FIXME("Position mouse cursor\n");
53 FIXME("Define horizontal mouse cursor range\n");
56 FIXME("Define vertical mouse cursor range\n");
59 FIXME("Define graphics mouse cursor\n");
62 FIXME("Define text mouse cursor\n");
65 TRACE("Define mouse interrupt subroutine\n");
66 mouse_info.callmask = CX_reg(context);
67 mouse_info.callback = (FARPROC16)PTR_SEG_OFF_TO_SEGPTR(context->SegEs, LOWORD(context->Edx));
70 FIXME("Define screen region for update\n");
73 INT_BARF(context,0x33);
79 WORD mask,but,x,y,mx,my;
82 static void MouseRelay(CONTEXT86 *context,void *mdata)
84 MCALLDATA *data = (MCALLDATA *)mdata;
85 CONTEXT86 ctx = *context;
93 ctx.SegCs = SELECTOROF(data->proc);
94 ctx.Eip = OFFSETOF(data->proc);
96 DPMI_CallRMProc(&ctx, NULL, 0, 0);
99 void WINAPI INT_Int33Message(UINT message,WPARAM wParam,LPARAM lParam)
102 unsigned Height, Width, SX=1, SY=1;
104 if (!VGA_GetMode(&Height,&Width,NULL)) {
105 /* may need to do some coordinate scaling */
109 mouse_info.x = LOWORD(lParam) * SX;
110 mouse_info.y = HIWORD(lParam) * SY;
116 case WM_LBUTTONDBLCLK:
117 mouse_info.but |= 0x01;
121 mouse_info.but &= ~0x01;
125 case WM_RBUTTONDBLCLK:
126 mouse_info.but |= 0x02;
130 mouse_info.but &= ~0x02;
134 case WM_MBUTTONDBLCLK:
135 mouse_info.but |= 0x04;
139 mouse_info.but &= ~0x04;
144 if ((mask & mouse_info.callmask) && mouse_info.callback) {
145 MCALLDATA *data = calloc(1,sizeof(MCALLDATA));
146 data->proc = mouse_info.callback;
147 data->mask = mask & mouse_info.callmask;
148 data->but = mouse_info.but;
149 data->x = mouse_info.x;
150 data->y = mouse_info.y;
151 DOSVM_QueueEvent(-1, DOS_PRIORITY_MOUSE, MouseRelay, data);