-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmouse.c
More file actions
45 lines (37 loc) · 796 Bytes
/
mouse.c
File metadata and controls
45 lines (37 loc) · 796 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <dos.h>
#include "mouse.h"
#define MOUSE_INT 0x33
#define INIT_MOUSE 0x00
#define SHOW_MOUSE 0x01
#define HIDE_MOUSE 0x02
#define GET_MOUSE_STATUS 0x03
int init_mouse()
{
union REGS regs;
regs.x.ax = INIT_MOUSE;
int86( MOUSE_INT, ®s, ®s );
return 0xFFFF == regs.x.ax;
}
void show_mouse()
{
union REGS regs;
regs.x.ax = SHOW_MOUSE;
int86( MOUSE_INT, ®s, ®s );
}
void hide_mouse()
{
union REGS regs;
regs.x.ax = HIDE_MOUSE;
int86( MOUSE_INT, ®s, ®s );
}
void get_mouse( int *x, int *y, int *left, int *right )
{
union REGS regs;
regs.x.ax = GET_MOUSE_STATUS;
int86( MOUSE_INT, ®s, ®s );
*x = regs.x.cx / 2;
*y = regs.x.dx;
*left = regs.x.bx & 0x1;
*right = regs.x.bx & 0x2;
}