/* ______ ___ ___ * /\ _ \ /\_ \ /\_ \ * \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___ * \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\ * \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \ * \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/ * \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/ * /\____/ * \_/__/ * * Joystick driver for the SNES controller. * * By Kerry High, based on sample code by Earle F. Philhower, III. * * Mucked about with until it works better by Paul Hampson. * * Lower CPU usage by Paul Hampson, based on the Linux implementation * by Vojtech Pavlik. * * See readme.txt for copyright information. */ #include "allegro.h" #ifndef ALLEGRO_DOS #error something is wrong with the makefile #endif #define LPT1_BASE 0x378 #define LPT2_BASE 0x278 #define LPT3_BASE 0x3bc #define SNES_POWER 248 #define SNES_CLOCK 1 #define SNES_LATCH 2 #define SNES_BUTTONS 12 /* actually 16, but the last 4 aren't * connected in a real SNESpad */ /* driver functions */ static int sp_init(void); static void sp_exit(void); static int sp_poll(int); static int sp1_poll(void); static int sp2_poll(void); static int sp3_poll(void); JOYSTICK_DRIVER joystick_sp1 = { JOY_TYPE_SNESPAD_LPT1, empty_string, empty_string, "SNESpad-LPT1", sp_init, sp_exit, sp1_poll, NULL, NULL, NULL, NULL }; JOYSTICK_DRIVER joystick_sp2 = { JOY_TYPE_SNESPAD_LPT2, empty_string, empty_string, "SNESpad-LPT2", sp_init, sp_exit, sp2_poll, NULL, NULL, NULL, NULL }; JOYSTICK_DRIVER joystick_sp3 = { JOY_TYPE_SNESPAD_LPT3, empty_string, empty_string, "SNESpad-LPT3", sp_init, sp_exit, sp3_poll, NULL, NULL, NULL, NULL }; /* sp_init: * Initialises the driver. */ static int sp_init(void) { int i; /* can't autodetect this... */ num_joysticks = 5; for (i=0; i