rayzor

diff src/mouse.c @ 1:a826bf0fb169

fixed line endings
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 05 Apr 2014 09:05:26 +0300
parents 2a5340a6eee4
children 75bc89c2abc4
line diff
     1.1 --- a/src/mouse.c	Sat Apr 05 08:46:27 2014 +0300
     1.2 +++ b/src/mouse.c	Sat Apr 05 09:05:26 2014 +0300
     1.3 @@ -1,72 +1,72 @@
     1.4 -/* TODO: try NOT using the v8086 interrupts to avoid the overhead */
     1.5 -#include "mouse.h"
     1.6 -#include "inttypes.h"
     1.7 -#include "dpmi.h"
     1.8 -
     1.9 -#define INTR	0x33
    1.10 -
    1.11 -#define QUERY	0
    1.12 -#define SHOW	1
    1.13 -#define HIDE	2
    1.14 -#define READ	3
    1.15 -#define WRITE	4
    1.16 -
    1.17 -#define XLIM	7
    1.18 -#define YLIM	8
    1.19 -
    1.20 -int have_mouse(void)
    1.21 -{
    1.22 -	struct dpmi_real_regs regs;
    1.23 -	memset(&regs, 0, sizeof regs);
    1.24 -	regs.eax = QUERY;
    1.25 -	dpmi_real_int(INTR, &regs);
    1.26 -	return regs.eax & 0xffff;
    1.27 -}
    1.28 -
    1.29 -void show_mouse(int show)
    1.30 -{
    1.31 -	struct dpmi_real_regs regs;
    1.32 -	memset(&regs, 0, sizeof regs);
    1.33 -	regs.eax = show ? SHOW : HIDE;
    1.34 -	dpmi_real_int(INTR, &regs);
    1.35 -}
    1.36 -
    1.37 -int read_mouse(int *xp, int *yp)
    1.38 -{
    1.39 -	struct dpmi_real_regs regs;
    1.40 -	memset(&regs, 0, sizeof regs);
    1.41 -
    1.42 -	regs.eax = READ;
    1.43 -	dpmi_real_int(INTR, &regs);
    1.44 -
    1.45 -	if(xp) *xp = regs.ecx & 0xffff;
    1.46 -	if(yp) *yp = regs.edx & 0xffff;
    1.47 -	return regs.ebx & 0xffff;
    1.48 -}
    1.49 -
    1.50 -void set_mouse(int x, int y)
    1.51 -{
    1.52 -	struct dpmi_real_regs regs;
    1.53 -	memset(&regs, 0, sizeof regs);
    1.54 -
    1.55 -	regs.eax = WRITE;
    1.56 -	regs.ecx = x;
    1.57 -	regs.edx = y;
    1.58 -	dpmi_real_int(INTR, &regs);
    1.59 -}
    1.60 -
    1.61 -void set_mouse_limits(int xmin, int ymin, int xmax, int ymax)
    1.62 -{
    1.63 -	struct dpmi_real_regs regs;
    1.64 -	memset(&regs, 0, sizeof regs);
    1.65 -	regs.eax = XLIM;
    1.66 -	regs.ecx = xmin;
    1.67 -	regs.edx = xmax;
    1.68 -	dpmi_real_int(INTR, &regs);
    1.69 -
    1.70 -	memset(&regs, 0, sizeof regs);
    1.71 -	regs.eax = YLIM;
    1.72 -	regs.ecx = ymin;
    1.73 -	regs.edx = ymax;
    1.74 -	dpmi_real_int(INTR, &regs);
    1.75 -}
    1.76 +/* TODO: try NOT using the v8086 interrupts to avoid the overhead */
    1.77 +#include "mouse.h"
    1.78 +#include "inttypes.h"
    1.79 +#include "dpmi.h"
    1.80 +
    1.81 +#define INTR	0x33
    1.82 +
    1.83 +#define QUERY	0
    1.84 +#define SHOW	1
    1.85 +#define HIDE	2
    1.86 +#define READ	3
    1.87 +#define WRITE	4
    1.88 +
    1.89 +#define XLIM	7
    1.90 +#define YLIM	8
    1.91 +
    1.92 +int have_mouse(void)
    1.93 +{
    1.94 +	struct dpmi_real_regs regs;
    1.95 +	memset(&regs, 0, sizeof regs);
    1.96 +	regs.eax = QUERY;
    1.97 +	dpmi_real_int(INTR, &regs);
    1.98 +	return regs.eax & 0xffff;
    1.99 +}
   1.100 +
   1.101 +void show_mouse(int show)
   1.102 +{
   1.103 +	struct dpmi_real_regs regs;
   1.104 +	memset(&regs, 0, sizeof regs);
   1.105 +	regs.eax = show ? SHOW : HIDE;
   1.106 +	dpmi_real_int(INTR, &regs);
   1.107 +}
   1.108 +
   1.109 +int read_mouse(int *xp, int *yp)
   1.110 +{
   1.111 +	struct dpmi_real_regs regs;
   1.112 +	memset(&regs, 0, sizeof regs);
   1.113 +
   1.114 +	regs.eax = READ;
   1.115 +	dpmi_real_int(INTR, &regs);
   1.116 +
   1.117 +	if(xp) *xp = regs.ecx & 0xffff;
   1.118 +	if(yp) *yp = regs.edx & 0xffff;
   1.119 +	return regs.ebx & 0xffff;
   1.120 +}
   1.121 +
   1.122 +void set_mouse(int x, int y)
   1.123 +{
   1.124 +	struct dpmi_real_regs regs;
   1.125 +	memset(&regs, 0, sizeof regs);
   1.126 +
   1.127 +	regs.eax = WRITE;
   1.128 +	regs.ecx = x;
   1.129 +	regs.edx = y;
   1.130 +	dpmi_real_int(INTR, &regs);
   1.131 +}
   1.132 +
   1.133 +void set_mouse_limits(int xmin, int ymin, int xmax, int ymax)
   1.134 +{
   1.135 +	struct dpmi_real_regs regs;
   1.136 +	memset(&regs, 0, sizeof regs);
   1.137 +	regs.eax = XLIM;
   1.138 +	regs.ecx = xmin;
   1.139 +	regs.edx = xmax;
   1.140 +	dpmi_real_int(INTR, &regs);
   1.141 +
   1.142 +	memset(&regs, 0, sizeof regs);
   1.143 +	regs.eax = YLIM;
   1.144 +	regs.ecx = ymin;
   1.145 +	regs.edx = ymax;
   1.146 +	dpmi_real_int(INTR, &regs);
   1.147 +}