2 * DOS interrupt 33h handler
11 #include "debugtools.h"
13 DEFAULT_DEBUG_CHANNEL(int)
21 /**********************************************************************
24 * Handler for int 33h (MS MOUSE).
26 void WINAPI INT_Int33Handler( CONTEXT86 *context )
28 MOUSESYSTEM *sys = (MOUSESYSTEM *)DOSVM_GetSystemData(0x33);
30 switch (AX_reg(context)) {
32 TRACE("Reset mouse driver and request status\n");
33 AX_reg(context) = 0xFFFF; /* installed */
34 BX_reg(context) = 3; /* # of buttons */
35 sys = calloc(1,sizeof(MOUSESYSTEM));
36 DOSVM_SetSystemData(0x33, sys);
39 TRACE("Return mouse position and button status\n");
40 BX_reg(context) = sys->but;
41 CX_reg(context) = sys->x;
42 DX_reg(context) = sys->y;
44 case 0x0C: /* Define interrupt subroutine */
45 TRACE("Define mouse interrupt subroutine\n");
46 sys->callmask = CX_reg(context);
47 sys->callback = (FARPROC16)PTR_SEG_OFF_TO_SEGPTR(ES_reg(context), DX_reg(context));
50 INT_BARF(context,0x33);
56 WORD mask,but,x,y,mx,my;
59 static void MouseRelay(LPDOSTASK lpDosTask,CONTEXT86 *context,void *mdata)
61 MCALLDATA *data = (MCALLDATA *)mdata;
62 CONTEXT86 ctx = *context;
64 EAX_reg(&ctx) = data->mask;
65 EBX_reg(&ctx) = data->but;
66 ECX_reg(&ctx) = data->x;
67 EDX_reg(&ctx) = data->y;
68 ESI_reg(&ctx) = data->mx;
69 EDI_reg(&ctx) = data->my;
70 CS_reg(&ctx) = SELECTOROF(data->proc);
71 EIP_reg(&ctx) = OFFSETOF(data->proc);
73 DPMI_CallRMProc(&ctx, NULL, 0, 0);
76 void WINAPI INT_Int33Message(UINT message,WPARAM wParam,LPARAM lParam)
78 MOUSESYSTEM *sys = (MOUSESYSTEM *)DOSVM_GetSystemData(0x33);
82 sys->x = LOWORD(lParam);
83 sys->y = HIWORD(lParam);
89 case WM_LBUTTONDBLCLK:
98 case WM_RBUTTONDBLCLK:
107 case WM_MBUTTONDBLCLK:
117 if ((mask & sys->callmask) && sys->callback) {
118 MCALLDATA *data = calloc(1,sizeof(MCALLDATA));
119 data->proc = sys->callback;
120 data->mask = mask & sys->callmask;
121 data->but = sys->but;
124 DOSVM_QueueEvent(-1, DOS_PRIORITY_MOUSE, MouseRelay, data);