#include "lolevel.h" #include "platform.h" #include "keyboard.h" #include "kbd_common.h" long kbd_new_state[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }; long kbd_prev_state[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }; long kbd_mod_state[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }; extern void _platformsub_kbd_fetch_data(long*); int get_usb_bit() { long usb_physw[3]; usb_physw[USB_IDX] = 0; _kbd_read_keys_r2(usb_physw); return(( usb_physw[USB_IDX] & USB_MASK)==USB_MASK) ; } #define NEW_SS (0x2000) static char kbd_stack[NEW_SS]; KeyMap keymap[] = { /* tiny bug: key order matters. see kbd_get_pressed_key() * for example */ { 0, KEY_DISPLAY , 0x00020000 }, // playback key { 2, KEY_SHOOT_FULL , 0x00000030 }, { 2, KEY_SHOOT_FULL_ONLY, 0x00000020 }, { 2, KEY_SHOOT_HALF , 0x00000010 }, { 2, KEY_UP , 0x00000001 }, { 2, KEY_DOWN , 0x00000002 }, { 2, KEY_LEFT , 0x00000008 }, { 2, KEY_RIGHT , 0x00000004 }, { 2, KEY_SET , 0x00000100 }, { 2, KEY_ZOOM_IN , 0x00000080 }, { 2, KEY_ZOOM_OUT , 0x00000040 }, { 2, KEY_MENU , 0x00000400 }, { 2, KEY_PRINT , 0x00000800 }, // mode key { 0, 0, 0 } }; long __attribute__((naked)) wrap_kbd_p1_f() ; static void __attribute__((noinline)) mykbd_task_proceed() { while (physw_run){ _SleepTask(10); if (wrap_kbd_p1_f() == 1){ // autorepeat ? _kbd_p2_f(); } } } void __attribute__((naked,noinline)) mykbd_task() { /* WARNING * Stack pointer manipulation performed here! * This means (but not limited to): * function arguments destroyed; * function CAN NOT return properly; * MUST NOT call or use stack variables before stack * is setup properly; * */ register int i; register long *newstack; newstack = (void*)kbd_stack; for (i=0;i