dos3d
view src/mouse.c @ 4:c3e0bccd673e
added texture mapping
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Mon, 21 Nov 2011 11:51:23 +0200 |
parents | |
children | 00d84ab1ef26 |
line source
1 #include "mouse.h"
3 #define INTR 0x33
5 #define QUERY 0
6 #define SHOW 1
7 #define HIDE 2
8 #define READ 3
9 #define WRITE 4
11 #define XLIM 7
12 #define YLIM 8
14 int have_mouse(void)
15 {
16 int res;
17 asm {
18 mov ax, QUERY
19 int INTR
20 mov res, ax
21 }
22 return res;
23 }
25 void show_mouse(int show)
26 {
27 int cmd = show ? SHOW : HIDE;
28 asm {
29 mov ax, cmd
30 int INTR
31 }
32 }
34 int read_mouse(int *xp, int *yp)
35 {
36 int x, y, bn;
38 asm {
39 mov ax, READ
40 int INTR
41 mov bn, bx
42 mov x, cx
43 mov y, dx
44 /* XXX some sort of div by 8 in the original code ? */
45 }
47 if(xp) *xp = x;
48 if(yp) *yp = y;
49 return bn;
50 }
52 void set_mouse(int x, int y)
53 {
54 asm {
55 mov ax, WRITE
56 mov cx, x
57 mov dx, y
58 int INTR
59 }
60 }
62 void set_mouse_limits(int xmin, int ymin, int xmax, int ymax)
63 {
64 asm {
65 mov ax, XLIM
66 mov cx, xmin
67 mov dx, xmax
68 int INTR
69 mov ax, YLIM
70 mov cx, ymin
71 mov dx, ymax
72 int INTR
73 }
74 }