--- np2/win9xc/winkbd.cpp 2003/10/16 17:59:22 1.1.1.1 +++ np2/win9xc/winkbd.cpp 2005/02/07 14:46:15 1.4 @@ -1,15 +1,12 @@ #include "compiler.h" #include "np2.h" -#include "dosio.h" -#include "memory.h" -#include "pccore.h" -#include "iocore.h" #include "winkbd.h" +#include "keystat.h" #define NC 0xff -static const BYTE key106[256] = { +static const UINT8 key106[256] = { // , , ,STOP, , , , ; 0x00 NC, NC, NC,0x60, NC, NC, NC, NC, // BS, TAB, , , CLR, ENT, , ; 0x08 @@ -41,7 +38,7 @@ static const BYTE key106[256] = { // 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, // 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 NC, NC, NC, NC, NC, NC, NC, NC, // , , , , , , , ; 0x88 @@ -75,7 +72,7 @@ static const BYTE key106[256] = { // , , , , , , , ; 0xf8 NC, NC, NC, NC, NC, NC, NC, NC}; -static const BYTE key106ext[256] = { +static const UINT8 key106ext[256] = { // , , ,STOP, , , , ; 0x00 NC, NC, NC, NC, NC, NC, NC, NC, // BS, TAB, , , CLR, ENT, , ; 0x08 @@ -141,22 +138,35 @@ static const BYTE key106ext[256] = { // , , , , , , , ; 0xf8 NC, NC, NC, NC, NC, NC, NC, NC}; +static const UINT8 f12keys[] = { + 0x61, 0x60, 0x4d, 0x4f}; -void winkeydown106(WPARAM wParam, LPARAM lParam) { // ver0.28 - BYTE data; +static UINT8 getf12key(void) { - data = key106[wParam & 0xff]; + UINT key; + + key = np2oscfg.F12COPY - 1; + if (key < NELEMENTS(f12keys)) { + return(f12keys[key]); + } + else { + return(NC); + } +} + +void winkbd_keydown(WPARAM wParam, LPARAM lParam) { + + UINT8 data; + + if (wParam != VK_F12) { + data = key106[wParam & 0xff]; + } + else { + data = getf12key(); + } if (data != NC) { - if (data == 0x7f) { - if (np2oscfg.F12COPY == 1) { - data = 0x61; - } - else { - data = 0x60; - } - } - else if ((data == 0x73) && + if ((data == 0x73) && (np2oscfg.KEYBOARD == KEY_KEY101) && (lParam & 0x01000000)) { data = 0x72; @@ -177,21 +187,18 @@ 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]; + if (wParam != VK_F12) { + data = key106[wParam & 0xff]; + } + else { + data = getf12key(); + } if (data != NC) { - if (data == 0x7f) { - if (np2oscfg.F12COPY == 1) { - data = 0x61; - } - else { - data = 0x60; - } - } - else if ((data == 0x73) && + if ((data == 0x73) && (np2oscfg.KEYBOARD == KEY_KEY101) && (lParam & 0x01000000)) { ; // none ! @@ -202,7 +209,7 @@ void winkeyup106(WPARAM wParam, LPARAM l keystat_senddata(0x70 | 0x80); // PC/AT only data = key106ext[wParam & 0xff]; } - keystat_senddata((BYTE)(data | 0x80)); + keystat_senddata((UINT8)(data | 0x80)); } else { // ver0.28 if ((np2oscfg.KEYBOARD != KEY_PC98) && (wParam == 0x0c)) { @@ -212,3 +219,12 @@ void winkeyup106(WPARAM wParam, LPARAM l } } +void winkbd_resetf12(void) { + + UINT i; + + for (i=0; i