dos3d

annotate src/mouse.c @ 24:698c4d07702d

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