63bd5be0 |
1 | /* FCE Ultra - NES/Famicom Emulator\r |
2 | *\r |
3 | * Copyright notice for this file:\r |
4 | * Copyright (C) 2002 Ben Parnell\r |
5 | *\r |
6 | * This program is free software; you can redistribute it and/or modify\r |
7 | * it under the terms of the GNU General Public License as published by\r |
8 | * the Free Software Foundation; either version 2 of the License, or\r |
9 | * (at your option) any later version.\r |
10 | *\r |
11 | * This program is distributed in the hope that it will be useful,\r |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of\r |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r |
14 | * GNU General Public License for more details.\r |
15 | *\r |
16 | * You should have received a copy of the GNU General Public License\r |
17 | * along with this program; if not, write to the Free Software\r |
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r |
19 | */\r |
20 | \r |
21 | #include <dpmi.h>\r |
22 | #include <string.h>\r |
23 | \r |
24 | #include "dos.h"\r |
25 | \r |
26 | int InitMouse(void)\r |
27 | {\r |
28 | __dpmi_regs regs;\r |
29 | \r |
30 | memset(®s,0,sizeof(regs));\r |
31 | regs.x.ax=0;\r |
32 | __dpmi_int(0x33,®s);\r |
33 | if(regs.x.ax!=0xFFFF)\r |
34 | return(0);\r |
35 | \r |
36 | memset(®s,0,sizeof(regs));\r |
37 | regs.x.ax=0x7;\r |
38 | regs.x.cx=0; // Min X\r |
39 | regs.x.dx=260; // Max X\r |
40 | __dpmi_int(0x33,®s);\r |
41 | \r |
42 | memset(®s,0,sizeof(regs));\r |
43 | regs.x.ax=0x8;\r |
44 | regs.x.cx=0; // Min Y\r |
45 | regs.x.dx=260; // Max Y\r |
46 | __dpmi_int(0x33,®s);\r |
47 | \r |
48 | memset(®s,0,sizeof(regs));\r |
49 | regs.x.ax=0xF;\r |
50 | regs.x.cx=8; // Mickey X\r |
51 | regs.x.dx=8; // Mickey Y\r |
52 | __dpmi_int(0x33,®s);\r |
53 | \r |
54 | memset(®s,0,sizeof(regs));\r |
55 | regs.x.ax=0x2;\r |
56 | __dpmi_int(0x33,®s);\r |
57 | \r |
58 | return(1);\r |
59 | }\r |
60 | \r |
61 | uint32 GetMouseData(uint32 *x, uint32 *y)\r |
62 | {\r |
63 | __dpmi_regs regs;\r |
64 | \r |
65 | memset(®s,0,sizeof(regs));\r |
66 | regs.x.ax=0x3;\r |
67 | __dpmi_int(0x33,®s);\r |
68 | \r |
69 | *x=regs.x.cx;\r |
70 | *y=regs.x.dx;\r |
71 | return(regs.x.bx&3);\r |
72 | }\r |
73 | \r |
74 | void KillMouse(void)\r |
75 | {\r |
76 | \r |
77 | }\r |