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