|
|
| version 1.6, 2004/03/28 10:50:16 | version 1.8, 2004/03/30 07:12:02 |
|---|---|
| Line 8 | Line 8 |
| typedef struct { | typedef struct { |
| UINT8 ref[NKEY_SYSTEM]; | UINT8 ref[0x80]; |
| UINT8 extkey; | UINT8 extkey; |
| UINT8 mouselast; | UINT8 mouselast; |
| UINT8 padding; | UINT8 padding; |
| Line 20 typedef struct { | Line 20 typedef struct { |
| NKEYTBL nkeytbl; | NKEYTBL nkeytbl; |
| KEYCTRL keyctrl; | |
| static KEYSTAT keystat; | static KEYSTAT keystat; |
| Line 156 kstbl_err: | Line 157 kstbl_err: |
| // ---- | // ---- |
| void keystat_ctrl(REG8 dat) { | |
| if (!keyctrl.reqparam) { | |
| keyctrl.mode = dat; | |
| switch(dat) { | |
| #if defined(SUPPORT_PC9801_119) | |
| case 0x95: | |
| #endif | |
| case 0x9c: | |
| case 0x9d: | |
| keyctrl.reqparam = 1; | |
| keyboard_ctrl(0xfa); | |
| break; | |
| #if defined(SUPPORT_PC9801_119) | |
| case 0x96: | |
| keyboard_ctrl(0xfa); | |
| keyboard_ctrl(0xa0); | |
| keyboard_ctrl(0x83); | |
| break; | |
| #endif | |
| case 0x9f: | |
| keyboard_ctrl(0xfa); | |
| keyboard_ctrl(0xa0); | |
| keyboard_ctrl(0x80); | |
| break; | |
| default: | |
| keyboard_ctrl(0xfc); | |
| break; | |
| } | |
| } | |
| else { | |
| switch(keyctrl.mode) { | |
| #if defined(SUPPORT_PC9801_119) | |
| case 0x95: | |
| keyctrl.kbdtype = dat; | |
| break; | |
| #endif | |
| case 0x9d: | |
| break; | |
| case 0x9e: | |
| break; | |
| } | |
| keyctrl.reqparam = 0; | |
| } | |
| } | |
| // ---- | |
| void keystat_down(const UINT8 *key, REG8 keys, REG8 ref) { | void keystat_down(const UINT8 *key, REG8 keys, REG8 ref) { |
| UINT8 keydata; | UINT8 keydata; |
| Line 173 void keystat_down(const UINT8 *key, REG8 | Line 227 void keystat_down(const UINT8 *key, REG8 |
| keystat.ref[keycode] = ref; | keystat.ref[keycode] = ref; |
| } | } |
| else { | else { |
| #if defined(SUPPORT_PC9801_119) | |
| if ((keyctrl.kbdtype != 0x03) && (keycode >= 0x75)) { | |
| continue; | |
| } | |
| #else | |
| if (keycode >= 0x75) { | |
| continue; | |
| } | |
| #endif | |
| if ((np2cfg.XSHIFT) && | if ((np2cfg.XSHIFT) && |
| (((keycode == 0x70) && (np2cfg.XSHIFT & 1)) || | (((keycode == 0x70) && (np2cfg.XSHIFT & 1)) || |
| ((keycode == 0x74) && (np2cfg.XSHIFT & 2)) || | ((keycode == 0x74) && (np2cfg.XSHIFT & 2)) || |
| Line 180 void keystat_down(const UINT8 *key, REG8 | Line 243 void keystat_down(const UINT8 *key, REG8 |
| keydata |= 0x80; | keydata |= 0x80; |
| } | } |
| if (!(keydata & 0x80)) { // シフト | if (!(keydata & 0x80)) { // シフト |
| if ((keystat.ref[keycode + 0x00] == NKEYREF_NC) && | if (keystat.ref[keycode] == NKEYREF_NC) { |
| (keystat.ref[keycode + 0x10] == NKEYREF_NC)) { | |
| keyboard_send(keycode); | |
| } | |
| if (keystat.ref[keycode] > ref) { | |
| keystat.ref[keycode] = ref; | keystat.ref[keycode] = ref; |
| keyboard_send(keycode); | |
| } | } |
| } | } |
| else { // シフトメカニカル処理 | else { // シフトメカニカル処理 |
| if (keystat.ref[keycode + 0x10] == NKEYREF_NC) { | if (keystat.ref[keycode] == NKEYREF_NC) { |
| keystat.ref[keycode + 0x10] = ref; | keystat.ref[keycode] = ref; |
| data = keycode; | data = keycode; |
| } | } |
| else { | else { |
| keystat.ref[keycode + 0x10] = NKEYREF_NC; | keystat.ref[keycode] = NKEYREF_NC; |
| data = (REG8)(keycode + 0x80); | data = (REG8)(keycode + 0x80); |
| } | } |
| if (keystat.ref[keycode] == NKEYREF_NC) { | keyboard_send(data); |
| keyboard_send(data); | |
| } | |
| } | } |
| } | } |
| } | } |
| Line 220 void keystat_up(const UINT8 *key, REG8 k | Line 278 void keystat_up(const UINT8 *key, REG8 k |
| } | } |
| } | } |
| else { | else { |
| #if defined(SUPPORT_PC9801_119) | |
| if ((keyctrl.kbdtype != 0x03) && (keycode >= 0x75)) { | |
| continue; | |
| } | |
| #else | |
| if (keycode >= 0x75) { | |
| continue; | |
| } | |
| #endif | |
| if ((np2cfg.XSHIFT) && | if ((np2cfg.XSHIFT) && |
| (((keycode == 0x70) && (np2cfg.XSHIFT & 1)) || | (((keycode == 0x70) && (np2cfg.XSHIFT & 1)) || |
| ((keycode == 0x74) && (np2cfg.XSHIFT & 2)) || | ((keycode == 0x74) && (np2cfg.XSHIFT & 2)) || |
| Line 227 void keystat_up(const UINT8 *key, REG8 k | Line 294 void keystat_up(const UINT8 *key, REG8 k |
| keydata |= 0x80; | keydata |= 0x80; |
| } | } |
| if (!(keydata & 0x80)) { // シフト | if (!(keydata & 0x80)) { // シフト |
| if (keystat.ref[keycode] == ref) { | if (keystat.ref[keycode] != NKEYREF_NC) { |
| keystat.ref[keycode] = NKEYREF_NC; | keystat.ref[keycode] = NKEYREF_NC; |
| if (keystat.ref[keycode + 0x10] == NKEYREF_NC) { | keyboard_send((REG8)(keycode + 0x80)); |
| keyboard_send((REG8)(keycode + 0x80)); | |
| } | |
| } | } |
| } | } |
| } | } |
| Line 242 void keystat_resendstat(void) { | Line 307 void keystat_resendstat(void) { |
| REG8 i; | REG8 i; |
| for (i=0; i<0x70; i++) { | for (i=0; i<0x80; i++) { |
| if (keystat.ref[i] != NKEYREF_NC) { | if (keystat.ref[i] != NKEYREF_NC) { |
| keyboard_send(i); | keyboard_send(i); |
| } | } |
| } | } |
| for (i=0; i<0x10; i++) { | |
| if ((keystat.ref[0x70 + i] != NKEYREF_NC) || | |
| (keystat.ref[0x80 + i] != NKEYREF_NC)) { | |
| keyboard_send((REG8)(i + 0x70)); | |
| } | |
| } | |
| } | } |
| Line 306 void keystat_releaseref(REG8 ref) { | Line 365 void keystat_releaseref(REG8 ref) { |
| REG8 i; | REG8 i; |
| for (i=0; i<0x70; i++) { | for (i=0; i<0x80; i++) { |
| if (keystat.ref[i] == ref) { | if (keystat.ref[i] == ref) { |
| keystat.ref[i] = NKEYREF_NC; | keystat.ref[i] = NKEYREF_NC; |
| keyboard_send((REG8)(i + 0x80)); | keyboard_send((REG8)(i + 0x80)); |
| } | } |
| } | } |
| for (i=0; i<0x10; i++) { | |
| if (keystat.ref[0x70 + i] == ref) { | |
| keystat.ref[0x70 + i] = NKEYREF_NC; | |
| if (keystat.ref[0x80 + i] == NKEYREF_NC) { | |
| keyboard_send((REG8)(0xf0 + i)); | |
| } | |
| } | |
| if (keystat.ref[0x80 + i] == ref) { | |
| keystat.ref[0x80 + i] = NKEYREF_NC; | |
| if (keystat.ref[0x70 + i] == NKEYREF_NC) { | |
| keyboard_send((REG8)(0xf0 + i)); | |
| } | |
| } | |
| } | |
| } | } |
| void keystat_resetjoykey(void) { | void keystat_resetjoykey(void) { |
| Line 344 void keystat_resetjoykey(void) { | Line 389 void keystat_resetjoykey(void) { |
| void keystat_releasekey(REG8 key) { | void keystat_releasekey(REG8 key) { |
| key &= 0x7f; | key &= 0x7f; |
| if (key < 0x70) { | if (keystat.ref[key] != NKEYREF_NC) { |
| if (keystat.ref[key] != NKEYREF_NC) { | keystat.ref[key] = NKEYREF_NC; |
| keystat.ref[key] = NKEYREF_NC; | keyboard_send((REG8)(key + 0x80)); |
| keyboard_send((REG8)(key + 0x80)); | |
| } | |
| } | |
| else { | |
| if ((keystat.ref[key + 0x00] != NKEYREF_NC) || | |
| (keystat.ref[key + 0x10] != NKEYREF_NC)) { | |
| keystat.ref[key + 0x00] = NKEYREF_NC; | |
| keystat.ref[key + 0x10] = NKEYREF_NC; | |
| keyboard_send((REG8)(key + 0x80)); | |
| } | |
| } | } |
| } | } |