if (ibmpc_error) {
- xprintf("\nERR: %02X\n", ibmpc_error);
+ xprintf("\nERR:%02X\n", ibmpc_error);
// when recv error, neither send error nor buffer full
if (!(ibmpc_error & (IBMPC_ERR_SEND | IBMPC_ERR_FULL))) {
keyboard_id = read_keyboard_id();
if (ibmpc_error) {
- xprintf("\nERR: %02X\n", ibmpc_error);
+ xprintf("\nERR:%02X\n", ibmpc_error);
ibmpc_error = IBMPC_ERR_NONE;
}
case 0x63: return 0x7B; // Wake (MUHENKAN)
default:
- xprintf("!CS1_?!\n");
+ xprintf("!CS1_E0_%02X!\n", code);
return code;
}
return 0x00;
static enum {
INIT,
E0,
- // Pause: E1 1D 45, E1 9D C5
+ // Pause: E1 1D 45, E1 9D C5 [a] (TODO: test)
E1,
E1_1D,
E1_9D,
return 0;
}
+ // Check invalid codes; 0x59-7F won't be used in real XT keyboards probably
+ // 0x62 is used to handle escape code E0 and E1
+ if ((code & 0x7F) >= 0x62) {
+ xprintf("!CS1_INV!\n");
+ state = INIT;
+ return -1;
+ }
+
switch (state) {
case INIT:
switch (code) {
case 0x00:
case 0xFF: // Error/Overrun [3]p.26
- xprintf("!CS1_%02X!\n", code);
+ xprintf("!CS1_ERR!\n");
return -1;
break;
case 0xE0:
case 0x00: // Error/Overrun [3]p.26
case 0xFF:
matrix_clear();
- xprintf("!CS2_%02X!\n", code);
+ xprintf("!CS2_ERR!\n");
state = INIT;
return -1;
break;
switch (code) {
case 0x00: // Error/Overrun [3]p.26
case 0xFF:
- xprintf("!CS3_%02X!\n", code);
+ xprintf("!CS3_ERR!\n");
return -1;
break;
case 0xF0:
if (code < 0x80) {
matrix_make(code);
} else {
- xprintf("!CS3_%02X!\n", code);
+ xprintf("!CS3_READY!\n");
return -1;
}
}
switch (code) {
case 0x00:
case 0xFF:
- xprintf("!CS3_F0_%02X!\n", code);
+ xprintf("!CS3_F0_ERR!\n");
state = READY;
return -1;
break;
if (code < 0x80) {
matrix_break(code);
} else {
- xprintf("!CS3_F0_%02X!\n", code);
+ xprintf("!CS3_F0!\n");
return -1;
}
}