2 * DOS interrupt 33h handler
11 DEFAULT_DEBUG_CHANNEL(int)
19 /**********************************************************************
22 * Handler for int 33h (MS MOUSE).
24 void WINAPI
INT_Int33Handler( CONTEXT
*context
)
26 MOUSESYSTEM
*sys
= (MOUSESYSTEM
*)DOSVM_GetSystemData(0x33);
28 switch (AX_reg(context
)) {
30 TRACE(int,"Reset mouse driver and request status\n");
31 AX_reg(context
) = 0xFFFF; /* installed */
32 BX_reg(context
) = 3; /* # of buttons */
33 sys
= calloc(1,sizeof(MOUSESYSTEM
));
34 DOSVM_SetSystemData(0x33, sys
);
37 TRACE(int,"Return mouse position and button status\n");
38 BX_reg(context
) = sys
->but
;
39 CX_reg(context
) = sys
->x
;
40 DX_reg(context
) = sys
->y
;
42 case 0x0C: /* Define interrupt subroutine */
43 TRACE(int,"Define mouse interrupt subroutine\n");
44 sys
->callmask
= CX_reg(context
);
45 sys
->callback
= (FARPROC16
)PTR_SEG_OFF_TO_SEGPTR(ES_reg(context
), DX_reg(context
));
48 INT_BARF(context
,0x33);
54 WORD mask
,but
,x
,y
,mx
,my
;
57 static void MouseRelay(LPDOSTASK lpDosTask
,PCONTEXT context
,void *mdata
)
59 MCALLDATA
*data
= (MCALLDATA
*)mdata
;
60 CONTEXT ctx
= *context
;
62 AX_reg(&ctx
) = data
->mask
;
63 BX_reg(&ctx
) = data
->but
;
64 CX_reg(&ctx
) = data
->x
;
65 DX_reg(&ctx
) = data
->y
;
66 SI_reg(&ctx
) = data
->mx
;
67 DI_reg(&ctx
) = data
->my
;
68 CS_reg(&ctx
) = SELECTOROF(data
->proc
);
69 IP_reg(&ctx
) = OFFSETOF(data
->proc
);
71 DPMI_CallRMProc(&ctx
, NULL
, 0, 0);
74 void WINAPI
INT_Int33Message(UINT message
,WPARAM wParam
,LPARAM lParam
)
76 MOUSESYSTEM
*sys
= (MOUSESYSTEM
*)DOSVM_GetSystemData(0x33);
80 sys
->x
= LOWORD(lParam
);
81 sys
->y
= HIWORD(lParam
);
87 case WM_LBUTTONDBLCLK
:
96 case WM_RBUTTONDBLCLK
:
105 case WM_MBUTTONDBLCLK
:
115 if ((mask
& sys
->callmask
) && sys
->callback
) {
116 MCALLDATA
*data
= calloc(1,sizeof(MCALLDATA
));
117 data
->proc
= sys
->callback
;
118 data
->mask
= mask
& sys
->callmask
;
119 data
->but
= sys
->but
;
122 DOSVM_QueueEvent(-1, DOS_PRIORITY_MOUSE
, MouseRelay
, data
);