Om de waardes van een Gameport in de te lezen heb dit geschreven:
Alleen ik krijg alleen maar NULL waardes op alle bits op dat adres, terwijl 0x201 toch echt het Gameport adres is.
Iemand een idee?
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
| /* Servowire 2002 */
/* Fucking GNU Licence shit */
#include <asm/io.h>
#include <stdio.h>
#include <unistd.h>
#define JPORT 0x201
#define CMAX 999999
void joystick(int v[4], char b[4])
{
int i, j;
int mask = 15;
for (i=1; mask && i<CMAX; i++) {
j = inb(JPORT) ^ mask;
if (j & 1) { v[0] = i; mask ^= 1; }
if (j & 2) { v[1] = i; mask ^= 2; }
if (j & 4) { v[2] = i; mask ^= 4; }
if (j & 8) { v[3] = i; mask ^= 8; }
}
j = inb(JPORT);
b[0] = !(j & 0x10);
b[1] = !(j & 0x20);
b[2] = !(j & 0x40);
b[3] = !(j & 0x80);
}
main(int argc, char **argv)
{
int v[4];
char b[4];
memset(v, 0, sizeof(v));
if (ioperm(JPORT, 3, 1))
{
perror("ioperm() error");
exit(1);
}
outb (0xff, JPORT);
while (1) {
joystick(v, b);
printf("%3d %3d %3d %3d %d %d %d %d\n",
v[0], v[1], v[2], v[3], b[0], b[1], b[2], b[3]);
}
} |
Alleen ik krijg alleen maar NULL waardes op alle bits op dat adres, terwijl 0x201 toch echt het Gameport adres is.
Iemand een idee?
met papier mache kun je alles maken!!