|
|
1.1.1.2 root 1: /*
1.1 root 2: * UAE - The Un*x Amiga Emulator
1.1.1.2 root 3: *
1.1 root 4: * Joystick emulation for AmigaOS
1.1.1.2 root 5: *
1.1 root 6: * Copyright 1996, 1997 Samuel Devulder
7: */
8:
9: #include "sysconfig.h"
10: #include "sysdeps.h"
11:
12: #include "options.h"
13: #include "memory.h"
14: #include "custom.h"
15: #include "joystick.h"
16:
17: int nr_joysticks;
18:
19: #include <hardware/custom.h>
20: #include <hardware/cia.h>
21:
1.1.1.2 root 22: #define CIAAPRA 0xBFE001
1.1 root 23: #define CUSTOM 0xDFF000
24:
25: static struct Custom *custom= (struct Custom*) CUSTOM;
26: static struct CIA *cia = (struct CIA *) CIAAPRA;
27:
28: void read_joystick(int nr, unsigned int *dir, int *button)
29: {
30: int bot, right, top, left, joy,fire;
1.1.1.2 root 31:
1.1 root 32: *dir = 0;
33: *button = 0;
34: if (nr >= nr_joysticks) return;
35:
36: joy = custom->joy1dat;
37: fire = !( cia->ciapra & 0x0080 ) ? 1 : 0;
38:
39: right = (joy & 0x0002) ? 1 : 0;
40: left = (joy & 0x0200) ? 1 : 0;
41: bot = (joy & 0x0001) ? 1 : 0;
42: top = (joy & 0x0100) ? 1 : 0;
1.1.1.2 root 43:
1.1 root 44: *button = fire;
45: *dir = bot | (right << 1) | (top << 8) | (left << 9);
46: }
47:
48: void init_joystick(void)
49: {
50: nr_joysticks = 1;
51: }
52:
53: void close_joystick(void)
54: {
55: }
56:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.