From 11aa8c9f37f4b509b65d66884bb0d09fa5d83614 Mon Sep 17 00:00:00 2001 From: gir Date: Thu, 9 Jul 2009 20:08:40 +0000 Subject: [PATCH] =?UTF-8?q?Unterst=C3=BCtzung=20f=C3=BCr=20NES=20gamecontr?= =?UTF-8?q?oller?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- borg_hw/borg_hw_pd1165.c | 5 ++- joystick/Makefile | 5 +++ joystick/config.in | 69 +++++++++++++++++++++++++++++++++++++++- joystick/joystick.c | 1 + joystick/joystick.h | 38 +++++++++++++++------- joystick/nes_pad.c | 45 ++++++++++++++++++++++++++ main.c | 1 + 7 files changed, 150 insertions(+), 14 deletions(-) create mode 100644 joystick/nes_pad.c diff --git a/borg_hw/borg_hw_pd1165.c b/borg_hw/borg_hw_pd1165.c index 235db4f..873c21b 100644 --- a/borg_hw/borg_hw_pd1165.c +++ b/borg_hw/borg_hw_pd1165.c @@ -150,6 +150,9 @@ SIGNAL(SIG_OUTPUT_COMPARE0) //Watchdog zurücksetzen wdt_reset(); + //Tasten für joystick einlesen + readButtons(); + for(row=0; row < 8; row++){ pd1165_write(row, pixmap[plane][row][0]); CTRLPORT &= ~((1< +# include +# ifdef NES_PAD_SUPPORT + + extern volatile unsigned char fakeport; + +# define JOYISUP (!! ((1<<4) & fakeport)) +# define JOYISDOWN (!! ((1<<5) & fakeport)) +# define JOYISLEFT (!! ((1<<6) & fakeport)) +# define JOYISRIGHT (!! ((1<<7) & fakeport)) +# define JOYISFIRE (!! ((1<<0) & fakeport)) + + +# else -#define JOYISUP (!(JOYSTICK_PIN_UP & (1< +#include +#include "../makros.h" +#include "../config.h" + +#define NES_PAD_DDR_PL DDR(NES_PAD_PORT_PL) +#define NES_PAD_DDR_CLK DDR(NES_PAD_PORT_CLK) +#define NES_PAD_DDR_DS DDR(NES_PAD_PIN_DS) +volatile unsigned char fakeport; +unsigned char waitForFire; + + +void joy_init(){ + + NES_PAD_DDR_PL |= 1<>= 1; + _delay_us(1); + if(NES_PAD_PIN_DS & (1 << NES_PAD_BIT_DS)) + port |=0x80; + + NES_PAD_PORT_CLK |= 1<