| version 1.2, 2003/10/21 11:22:05 | version 1.10, 2005/02/07 14:46:14 | 
| Line 1 | Line 1 | 
 | #include        "compiler.h" | #include        "compiler.h" | 
 | #include        "np2.h" | #include        "np2.h" | 
 | #include        "winkbd.h" | #include        "winkbd.h" | 
| #include        "pccore.h" | #include        "keystat.h" | 
| #include        "iocore.h" |  | 
 |  |  | 
 |  |  | 
 | #define         NC              0xff | #define         NC              0xff | 
 |  |  | 
| static const BYTE key106[256] = { | static UINT8 key106[256] = { | 
 | //          ,    ,    ,STOP,    ,    ,    ,             ; 0x00 | //          ,    ,    ,STOP,    ,    ,    ,             ; 0x00 | 
 | NC,  NC,  NC,0x60,  NC,  NC,  NC,  NC, | NC,  NC,  NC,0x60,  NC,  NC,  NC,  NC, | 
 | //        BS, TAB,    ,    , CLR, ENT,    ,             ; 0x08 | //        BS, TAB,    ,    , CLR, ENT,    ,             ; 0x08 | 
| Line 35  static const BYTE key106[256] = { | Line 34  static const BYTE key106[256] = { | 
 | //      <£°>,<£±>,<£²>,<£³>,<£´>,<£µ>,<£¶>,<£·>         ; 0x60 | //      <£°>,<£±>,<£²>,<£³>,<£´>,<£µ>,<£¶>,<£·>         ; 0x60 | 
 | 0x4e,0x4a,0x4b,0x4c,0x46,0x47,0x48,0x42, | 0x4e,0x4a,0x4b,0x4c,0x46,0x47,0x48,0x42, | 
 | //      <£¸>,<£¹>,<¡ö>,<¡Ü>,<¡¤>,<¡Ý>,<¡¥>,<¡¿>         ; 0x68 | //      <£¸>,<£¹>,<¡ö>,<¡Ü>,<¡¤>,<¡Ý>,<¡¥>,<¡¿>         ; 0x68 | 
| 0x43,0x44,0x45,0x49,  NC,0x40,0x50,0x41, | 0x43,0x44,0x45,0x49,0x4f,0x40,0x50,0x41, | 
 | //       f.1, f.2, f.3, f.4, f.5, f.6, f.7, f.8         ; 0x70 | //       f.1, f.2, f.3, f.4, f.5, f.6, f.7, f.8         ; 0x70 | 
 | 0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69, | 0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69, | 
 | //       f.9, f10, f11, f12, f13, f14, f15, f16         ; 0x78 | //       f.9, f10, f11, f12, f13, f14, f15, f16         ; 0x78 | 
| 0x6a,0x6b,  NC,0x7f,  NC,  NC,  NC,  NC, | 0x6a,0x6b,  NC,  NC,  NC,  NC,  NC,  NC, | 
 | //          ,    ,    ,    ,    ,    ,    ,             ; 0x80 | //          ,    ,    ,    ,    ,    ,    ,             ; 0x80 | 
 | NC,  NC,  NC,  NC,  NC,  NC,  NC,  NC, | NC,  NC,  NC,  NC,  NC,  NC,  NC,  NC, | 
 | //          ,    ,    ,    ,    ,    ,    ,             ; 0x88 | //          ,    ,    ,    ,    ,    ,    ,             ; 0x88 | 
| Line 62  static const BYTE key106[256] = { | Line 61  static const BYTE key106[256] = { | 
 | NC,  NC,  NC,  NC,  NC,  NC,  NC,  NC, | NC,  NC,  NC,  NC,  NC,  NC,  NC,  NC, | 
 | //          ,    ,    ,    ,    ,    ,    ,             ; 0xd0 | //          ,    ,    ,    ,    ,    ,    ,             ; 0xd0 | 
 | NC,  NC,  NC,  NC,  NC,  NC,  NC,  NC, | NC,  NC,  NC,  NC,  NC,  NC,  NC,  NC, | 
| //          ,    ,    ,  ¡Î,  ¡ï,  ¡Ï,  ¡°,             ; 0xd8 | //          ,    ,    ,  ¡Î,  ¡ï,  ¡Ï,  ¡°,  ¡²         ; 0xd8 | 
| NC,  NC,  NC,0x1b,0x0d,0x28,0x0c,  NC, | NC,  NC,  NC,0x1b,0x0d,0x28,0x0c,0x33, | 
 | //          ,    ,  ¡²,    ,    ,    ,    ,             ; 0xe0 | //          ,    ,  ¡²,    ,    ,    ,    ,             ; 0xe0 | 
 | NC,  NC,0x33,  NC,  NC,  NC,  NC,  NC, | NC,  NC,0x33,  NC,  NC,  NC,  NC,  NC, | 
 | //          ,    ,    ,    ,    ,    ,    ,             ; 0xe8 | //          ,    ,    ,    ,    ,    ,    ,             ; 0xe8 | 
| Line 73  static const BYTE key106[256] = { | Line 72  static const BYTE key106[256] = { | 
 | //          ,    ,    ,    ,    ,    ,    ,             ; 0xf8 | //          ,    ,    ,    ,    ,    ,    ,             ; 0xf8 | 
 | NC,  NC,  NC,  NC,  NC,  NC,  NC,  NC}; | NC,  NC,  NC,  NC,  NC,  NC,  NC,  NC}; | 
 |  |  | 
| static const BYTE key106ext[256] = { | static const UINT8 key106ext[256] = { | 
 | //          ,    ,    ,STOP,    ,    ,    ,             ; 0x00 | //          ,    ,    ,STOP,    ,    ,    ,             ; 0x00 | 
 | NC,  NC,  NC,  NC,  NC,  NC,  NC,  NC, | NC,  NC,  NC,  NC,  NC,  NC,  NC,  NC, | 
 | //        BS, TAB,    ,    , CLR, ENT,    ,             ; 0x08 | //        BS, TAB,    ,    , CLR, ENT,    ,             ; 0x08 | 
| Line 139  static const BYTE key106ext[256] = { | Line 138  static const BYTE key106ext[256] = { | 
 | //          ,    ,    ,    ,    ,    ,    ,             ; 0xf8 | //          ,    ,    ,    ,    ,    ,    ,             ; 0xf8 | 
 | NC,  NC,  NC,  NC,  NC,  NC,  NC,  NC}; | NC,  NC,  NC,  NC,  NC,  NC,  NC,  NC}; | 
 |  |  | 
 |  | static const UINT8 f12keys[] = { | 
 |  | 0x61, 0x60, 0x4d, 0x4f, 0x76, 0x77}; | 
 |  |  | 
 |  |  | 
| void winkeydown106(WPARAM wParam, LPARAM lParam) {                      // ver0.28 | void winkbd_keydown(WPARAM wParam, LPARAM lParam) { | 
 |  |  | 
| BYTE    data; | UINT8   data; | 
 |  |  | 
 | data = key106[wParam & 0xff]; | data = key106[wParam & 0xff]; | 
 | if (data != NC) { | if (data != NC) { | 
| if (data == 0x7f) { | if ((data == 0x73) && | 
| if (np2oscfg.F12COPY == 1) { |  | 
| data = 0x61; |  | 
| } |  | 
| else { |  | 
| data = 0x60; |  | 
| } |  | 
| } |  | 
| else if ((data == 0x73) && |  | 
 | (np2oscfg.KEYBOARD == KEY_KEY101) && | (np2oscfg.KEYBOARD == KEY_KEY101) && | 
 | (lParam & 0x01000000)) { | (lParam & 0x01000000)) { | 
 | data = 0x72; | data = 0x72; | 
| Line 175  void winkeydown106(WPARAM wParam, LPARAM | Line 169  void winkeydown106(WPARAM wParam, LPARAM | 
 | } | } | 
 | } | } | 
 |  |  | 
| void winkeyup106(WPARAM wParam, LPARAM lParam) { | void winkbd_keyup(WPARAM wParam, LPARAM lParam) { | 
 |  |  | 
| BYTE    data; | UINT8   data; | 
 |  |  | 
 | data = key106[wParam & 0xff]; | data = key106[wParam & 0xff]; | 
 | if (data != NC) { | if (data != NC) { | 
| if (data == 0x7f) { | if ((data == 0x73) && | 
| if (np2oscfg.F12COPY == 1) { |  | 
| data = 0x61; |  | 
| } |  | 
| else { |  | 
| data = 0x60; |  | 
| } |  | 
| } |  | 
| else if ((data == 0x73) && |  | 
 | (np2oscfg.KEYBOARD == KEY_KEY101) && | (np2oscfg.KEYBOARD == KEY_KEY101) && | 
 | (lParam & 0x01000000)) { | (lParam & 0x01000000)) { | 
 | ; // none ! | ; // none ! | 
| Line 200  void winkeyup106(WPARAM wParam, LPARAM l | Line 186  void winkeyup106(WPARAM wParam, LPARAM l | 
 | keystat_senddata(0x70 | 0x80);                          // PC/AT only | keystat_senddata(0x70 | 0x80);                          // PC/AT only | 
 | data = key106ext[wParam & 0xff]; | data = key106ext[wParam & 0xff]; | 
 | } | } | 
| keystat_senddata((BYTE)(data | 0x80)); | keystat_senddata((UINT8)(data | 0x80)); | 
 | } | } | 
 | else {                                                                                          // ver0.28 | else {                                                                                          // ver0.28 | 
 | if ((np2oscfg.KEYBOARD != KEY_PC98) && (wParam == 0x0c)) { | if ((np2oscfg.KEYBOARD != KEY_PC98) && (wParam == 0x0c)) { | 
| Line 210  void winkeyup106(WPARAM wParam, LPARAM l | Line 196  void winkeyup106(WPARAM wParam, LPARAM l | 
 | } | } | 
 | } | } | 
 |  |  | 
 |  | void winkbd_roll(BOOL pcat) { | 
 |  |  | 
 |  | if (pcat) { | 
 |  | key106[0x21] = 0x36; | 
 |  | key106[0x22] = 0x37; | 
 |  | } | 
 |  | else { | 
 |  | key106[0x21] = 0x37; | 
 |  | key106[0x22] = 0x36; | 
 |  | } | 
 |  | } | 
 |  |  | 
 |  | void winkbd_setf12(UINT f12key) { | 
 |  |  | 
 |  | UINT8   key; | 
 |  |  | 
 |  | f12key--; | 
 |  | if (f12key < NELEMENTS(f12keys)) { | 
 |  | key = f12keys[f12key]; | 
 |  | } | 
 |  | else { | 
 |  | key = NC; | 
 |  | } | 
 |  | key106[0x7b] = key; | 
 |  | } | 
 |  |  | 
 |  | void winkbd_resetf12(void) { | 
 |  |  | 
 |  | UINT    i; | 
 |  |  | 
 |  | for (i=0; i<NELEMENTS(f12keys); i++) { | 
 |  | keystat_forcerelease(f12keys[i]); | 
 |  | } | 
 |  | } | 
 |  |  |