X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fgba%2Finput.c;h=79438e3dbf0c7cbbed37065148a4173d56df55fd;hb=fb23aa4804a46173f817eb83b4823b7263ef0ed9;hp=6a66dd1c77d81c023a77975a565aa31ae8666a2b;hpb=097d03fa2406fca819b27b698ffb1cfc8ac445c2;p=gbajam22 diff --git a/src/gba/input.c b/src/gba/input.c index 6a66dd1..79438e3 100644 --- a/src/gba/input.c +++ b/src/gba/input.c @@ -1,39 +1,52 @@ #include "input.h" #include "gbaregs.h" -#include "intr.h" +#include "util.h" -static void keyintr(void); +/* +#define NUM_KEYS 10 -static uint16_t bnstate; +static int rep_start, rep_rep; +static unsigned long first_press[16], last_press[16]; +static uint16_t repmask; -void select_input(uint16_t bmask) +void key_repeat(int start, int rep, uint16_t mask) { - bnstate = 0; - - mask(INTR_KEY); - if(bmask) { - REG_KEYCNT = bmask | KEYCNT_IE; - interrupt(INTR_KEY, keyintr); - unmask(INTR_KEY); - } else { - REG_KEYCNT = 0; - interrupt(INTR_KEY, 0); - } + rep_start = start; + rep_rep = rep; + repmask = mask; } +*/ -uint16_t get_input(void) +void update_keyb(void) { - uint16_t s; - - mask(INTR_KEY); - s = bnstate; - bnstate = 0; - unmask(INTR_KEY); - - return s; + static uint16_t prevstate; + /* + int i; + unsigned long msec = timer_msec; + */ + + //keystate = (~REG_KEYINPUT & 0x3ff); + keydelta = keystate ^ prevstate; + prevstate = keystate; + + /* + for(i=0; i= rep_start && msec - last_press[i] >= rep_rep) { + keydelta |= bit; + last_press[i] = msec; + } + } + } + } + */ } -static void keyintr(void) -{ - bnstate |= ~REG_KEYINPUT; -}