deepstone

annotate src/mouse.c @ 5:c8ffdbc6139e

added cleandep removed verbosity from texture loader
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 21 Nov 2011 12:00:13 +0200
parents
children 00d84ab1ef26
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@0 16 int res;
nuclear@0 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@0 27 int cmd = show ? SHOW : HIDE;
nuclear@0 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@0 36 int x, y, bn;
nuclear@0 37
nuclear@0 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@0 54 asm {
nuclear@0 55 mov ax, WRITE
nuclear@0 56 mov cx, x
nuclear@0 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@0 64 asm {
nuclear@0 65 mov ax, XLIM
nuclear@0 66 mov cx, xmin
nuclear@0 67 mov dx, xmax
nuclear@0 68 int INTR
nuclear@0 69 mov ax, YLIM
nuclear@0 70 mov cx, ymin
nuclear@0 71 mov dx, ymax
nuclear@0 72 int INTR
nuclear@0 73 }
nuclear@0 74 }