I now did manage to do the cable and tested you new keyboard driver... Close, but no cigar... You obviously ignored my last configuration file update and therefore ie. Numpad issue was not resolved and so there is still two keys on one physical key. Now also Graph & code jumped to wrong sides of space etc. I would also try to avoid using Windows-keys as they may not exist in all keyboards, but even if you use them, it makes more sense to use the right one instead of left one. Good thing is that as you managed to put "CODE" in to "Alt Gr" as this kind of proved that the scan codes in our USB-keyboards are the same, so this should not be reason for our problems.
I now fixed names on my version of config file based on your constants list. Can you please at least read it trough and compare to your implementation side by side. This is not "only right way to do it", but there are reasons why I've selected the extra keys that I have. (SELECT is usually close to STOP and so on) If you don't agree with this, we can talk about the remaining issues. Please include also your version when you change it, so that we can talk about the issues with same names.
Code: Select all
// Array of 3 elements USB_KEYCODE, MSX_ROW, MSX_BIT
static const uint8_t msxkeymap[MSX_KEYS_SIZE][3] =
{
//7 & 6 ^ 5 % 4 $ 3 # 2 @ 1 ! 0 )
{KEY_7_AMPERSAND, KB_ROW_0, KB_BIT_7},
{KEY_6_CARET, KB_ROW_0, KB_BIT_6},
{KEY_5_PERCENT, KB_ROW_0, KB_BIT_5},
{KEY_4_DOLLAR, KB_ROW_0, KB_BIT_4},
{KEY_3_NUMBER_SIGN, KB_ROW_0, KB_BIT_3},
{KEY_2_AT, KB_ROW_0, KB_BIT_2},
{KEY_1_EXCLAMATION_MARK, KB_ROW_0, KB_BIT_1},
{KEY_0_CPARENTHESIS, KB_ROW_0, KB_BIT_0},
//; : ] } [ { \ ¦ = + - _ 9 ( 8 *
{KEY_SEMICOLON_COLON, KB_ROW_1, KB_BIT_7},
{KEY_CBRACKET_AND_CBRACE, KB_ROW_1, KB_BIT_6},
{KEY_OBRACKET_AND_OBRACE , KB_ROW_1, KB_BIT_5},
{KEY_BACKSLASH_VERTICAL_BAR, KB_ROW_1, KB_BIT_4},
{KEY_EQUAL_PLUS, KB_ROW_1, KB_BIT_3},
{KEY_MINUS_UNDERSCORE, KB_ROW_1, KB_BIT_2},
{KEY_9_OPARENTHESIS, KB_ROW_1, KB_BIT_1},
{KEY_8_ASTERISK, KB_ROW_1, KB_BIT_0},
//B A _ / ? . > , < ` ~ ' "
{KEY_B, KB_ROW_2, KB_BIT_7},
{KEY_A, KB_ROW_2, KB_BIT_6},
{KEY_RIGHTCONTROL, KB_ROW_2, KB_BIT_5},
{KEY_SLASH_QUESTION, KB_ROW_2, KB_BIT_4},
{KEY_DOT_GREATER, KB_ROW_2, KB_BIT_3},
{KEY_COMMA_AND_LESS, KB_ROW_2, KB_BIT_2},
{KEY_GRAVE_ACCENT_AND_TILDE, KB_ROW_2, KB_BIT_1},
{KEY_SINGLE_AND_DOUBLE_QUOTE, KB_ROW_2, KB_BIT_0},
//J I H G F E D C
{KEY_J, KB_ROW_3, KB_BIT_7},
{KEY_I, KB_ROW_3, KB_BIT_6},
{KEY_H, KB_ROW_3, KB_BIT_5},
{KEY_G, KB_ROW_3, KB_BIT_4},
{KEY_F, KB_ROW_3, KB_BIT_3},
{KEY_E, KB_ROW_3, KB_BIT_2},
{KEY_D, KB_ROW_3, KB_BIT_1},
{KEY_C, KB_ROW_3, KB_BIT_0},
//R Q P O N M L K
{KEY_R, KB_ROW_4, KB_BIT_7},
{KEY_Q, KB_ROW_4, KB_BIT_6},
{KEY_P, KB_ROW_4, KB_BIT_5},
{KEY_O, KB_ROW_4, KB_BIT_4},
{KEY_N, KB_ROW_4, KB_BIT_3},
{KEY_M, KB_ROW_4, KB_BIT_2},
{KEY_L, KB_ROW_4, KB_BIT_1},
{KEY_K, KB_ROW_4, KB_BIT_0},
//Z Y X W V U T S
{KEY_Z, KB_ROW_5, KB_BIT_7},
{KEY_Y, KB_ROW_5, KB_BIT_6},
{KEY_X, KB_ROW_5, KB_BIT_5},
{KEY_W, KB_ROW_5, KB_BIT_4},
{KEY_V, KB_ROW_5, KB_BIT_3},
{KEY_U, KB_ROW_5, KB_BIT_2},
{KEY_T, KB_ROW_5, KB_BIT_1},
{KEY_S, KB_ROW_5, KB_BIT_0},
//F3 F2 F1 CODE CAPS GRAPH CTRL SHIFT
{KEY_F3, KB_ROW_6, KB_BIT_7},
{KEY_F2, KB_ROW_6, KB_BIT_6},
{KEY_F1, KB_ROW_6, KB_BIT_5},
{KEY_LEFTALT, KB_ROW_6, KB_BIT_4},
{0x39, KB_ROW_6, KB_BIT_3},// KEY_CAPS LOCK,
{KEY_RIGHTALT, KB_ROW_6, KB_BIT_2},
{KEY_LEFTCONTROL, KB_ROW_6, KB_BIT_1},
{KEY_LEFTSHIFT, KB_ROW_6, KB_BIT_0},
{KEY_RIGHTSHIFT, KB_ROW_6, KB_BIT_0},
{KEY_F10, KB_ROW_6, 0xE8},
//RET SELECT BS STOP TAB ESC F5 F4
{KEY_KEYPAD_ENTER, KB_ROW_7, KB_BIT_7},
{KEY_ENTER, KB_ROW_7, KB_BIT_7},
{0x47, KB_ROW_7, KB_BIT_6}, // KEY_SCROLL LOCK
{KEY_BACKSPACE, KB_ROW_7, KB_BIT_5},
{KEY_PAUSE, KB_ROW_7, KB_BIT_4},
{KEY_TAB, KB_ROW_7, KB_BIT_3},
{KEY_ESCAPE, KB_ROW_7, KB_BIT_2},
{KEY_F5, KB_ROW_7, KB_BIT_1},
{KEY_F4, KB_ROW_7, KB_BIT_0},
//? ? ? ? DEL INS HOME SPACE
{KEY_RIGHTARROW, KB_ROW_8, KB_BIT_7},
{KEY_DOWNARROW, KB_ROW_8, KB_BIT_6},
{KEY_UPARROW, KB_ROW_8, KB_BIT_5},
{KEY_LEFTARROW, KB_ROW_8, KB_BIT_4},
{KEY_DELETE, KB_ROW_8, KB_BIT_3},
{KEY_INSERT, KB_ROW_8, KB_BIT_2},
{KEY_HOME, KB_ROW_8, KB_BIT_1},
{KEY_SPACEBAR, KB_ROW_8, KB_BIT_0},
//NUM4 NUM3 NUM2 NUM1 NUM0 NUM/ NUM+ NUM*
{KEY_KEYPAD_4_LEFT_ARROW, KB_ROW_9, KB_BIT_7},
{KEY_KEYPAD_3_PAGEDN, KB_ROW_9, KB_BIT_6},
{KEY_KEYPAD_2_DOWN_ARROW, KB_ROW_9, KB_BIT_5},
{KEY_KEYPAD_1_END, KB_ROW_9, KB_BIT_4},
{KEY_KEYPAD_0_INSERT, KB_ROW_9, KB_BIT_3},
{KEY_KEYPAD_SLASH, KB_ROW_9, KB_BIT_2},
{KEY_KEYPAD_PLUS, KB_ROW_9, KB_BIT_1},
{KEY_KEYPAD_ASTERIKS, KB_ROW_9, KB_BIT_0},
//NUM. NUM, NUM- NUM9 NUM8 NUM7 NUM6 NUM5
{KEY_KEYPAD_DECIMAL_SEPARATOR_DELETE, KB_ROW_10, KB_BIT_7},
{KEY_KEYPAD_NUM_LOCK_AND_CLEAR, KB_ROW_10, KB_BIT_6},
{KEY_KEYPAD_MINUS, KB_ROW_10, KB_BIT_5},
{KEY_KEYPAD_9_PAGEUP, KB_ROW_10, KB_BIT_4},
{KEY_KEYPAD_8_UP_ARROW, KB_ROW_10, KB_BIT_3},
{KEY_KEYPAD_7_HOME, KB_ROW_10, KB_BIT_2},
{KEY_KEYPAD_6_RIGHT_ARROW, KB_ROW_10, KB_BIT_1},
{KEY_KEYPAD_5, KB_ROW_10, KB_BIT_0},
// X X X X Cancel X Execute X
{KEY_F12, KB_ROW_11, KB_BIT_3},
{KEY_F11, KB_ROW_11, KB_BIT_1},
};
Do you think it would be also possible to support MSX leds on the USB-keyboard? In MSX CapsLock-led is controlled by PPI port C (I/O $AA), bit 6 and Kana-lock led (could be mapped ie. to ScrollLock led) is controlled by PSG register 15, bit 7. These are both inverted, so 0=Led on, 1=Led off
As I said this is close to situation of early PCs. Many MSX2 games (like ie. Breaker Breaker) benefit if you have mouse, but you can still play without (like ie. Sierra adventures on PC)... and you can still attach a real MSX mouse if you wish... After supporting USB keyboard and joypads this sounds to me like next logical step to take, but mostly it is about how you value your time.
Ps. Your implementation of ctlr+shift+graph+code worked just fine.