--- np2/io/serial.c 2004/02/07 21:23:22 1.9 +++ np2/io/serial.c 2004/02/13 08:33:48 1.11 @@ -86,7 +86,7 @@ static void keybrd_out(REG8 data) { // ---- - UINT8 keystat[0x80]; +static UINT8 keystat[0x80]; void keystat_reset(void) { @@ -96,8 +96,10 @@ void keystat_reset(void) { void keystat_senddata(REG8 data) { - REG8 key; - BOOL keynochange; + REG8 key; + BOOL keynochange; +const _NKEYM *user; + UINT i; key = data & 0x7f; keynochange = FALSE; @@ -110,6 +112,17 @@ void keystat_senddata(REG8 data) { data = key | (keystat[key] & 0x80); keystat[key] ^= 0x80; } + else if ((key == 0x76) || (key == 0x77)) { // user key + user = np2cfg.userkey + (key - 0x76); + for (i=0; ikeys; i++) { + key = user->key[i] & 0x7f; + if (!((keystat[key] ^ data) & 0x80)) { + keystat[key] ^= 0x80; + keybrd_out((REG8)(key | (data & 0x80))); + } + } + return; + } else { if ((np2cfg.XSHIFT) && (((key == 0x70) && (np2cfg.XSHIFT & 1)) || @@ -150,6 +163,31 @@ void keystat_senddata(REG8 data) { } } +void keystat_forcerelease(REG8 value) { + + REG8 key; +const _NKEYM *user; + UINT i; + + key = value & 0x7f; + if ((key != 0x76) && (key != 0x77)) { + if (keystat[key] & 0x80) { + keystat[key] &= ~0x80; + keybrd_out((REG8)(key | 0x80)); + } + } + else { + user = np2cfg.userkey + (key - 0x76); + for (i=0; ikeys; i++) { + key = user->key[i] & 0x7f; + if (keystat[key] & 0x80) { + keystat[key] &= ~0x80; + keybrd_out((REG8)(key | 0x80)); + } + } + } +} + void keystat_resetcopyhelp(void) { REG8 i; @@ -174,14 +212,6 @@ void keystat_allrelease(void) { } } -void keystat_forcerelease(REG8 value) { - - if (keystat[value & 0x7f] & 0x80) { - keystat[value & 0x7f] &= ~0x80; - keybrd_out((REG8)(value | 0x80)); - } -} - void keystat_resetjoykey(void) { int i;