2 Copyright 2016 Jun Wako <wakojun@gmail.com>
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #include <avr/pgmspace.h>
25 /* Mapping to Universal keyboard layout
27 * Universal keyboard layout
28 * ,-----------------------------------------------.
29 * |F13|F14|F15|F16|F17|F18|F19|F20|F21|F22|F23|F24|
30 * ,---. |-----------------------------------------------| ,-----------. ,-----------.
31 * |Esc| |F1 |F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12| |PrS|ScL|Pau| |VDn|VUp|Mut|
32 * `---' `-----------------------------------------------' `-----------' `-----------'
33 * ,-----------------------------------------------------------. ,-----------. ,---------------.
34 * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|JPY|Bsp| |Ins|Hom|PgU| |NmL| /| *| -|
35 * |-----------------------------------------------------------| |-----------| |---------------|
36 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ | |Del|End|PgD| | 7| 8| 9| +|
37 * |-----------------------------------------------------------| `-----------' |---------------|
38 * |CapsL | A| S| D| F| G| H| J| K| L| ;| '| #|Retn| | 4| 5| 6|KP,|
39 * |-----------------------------------------------------------| ,---. |---------------|
40 * |Shft| <| Z| X| C| V| B| N| M| ,| .| /| RO|Shift | |Up | | 1| 2| 3|Ent|
41 * |-----------------------------------------------------------| ,-----------. |---------------|
42 * |Ctl|Gui|Alt|MHEN| Space |HENK|KANA|Alt|Gui|App|Ctl| |Lef|Dow|Rig| | 0 | .|KP=|
43 * `-----------------------------------------------------------' `-----------' `---------------'
45 const uint8_t PROGMEM unimap_trans[MATRIX_ROWS][MATRIX_COLS] = {
46 { UNIMAP_ESC, UNIMAP_1, UNIMAP_2, UNIMAP_3, UNIMAP_4, UNIMAP_5, UNIMAP_6, UNIMAP_7 }, /* 00-07 */
47 { UNIMAP_8, UNIMAP_9, UNIMAP_0, UNIMAP_MINS, UNIMAP_EQL, UNIMAP_JYEN, UNIMAP_BSPC, UNIMAP_TAB }, /* 08-0F */
48 { UNIMAP_Q, UNIMAP_W, UNIMAP_E, UNIMAP_R, UNIMAP_T, UNIMAP_Y, UNIMAP_U, UNIMAP_I }, /* 10-17 */
49 { UNIMAP_O, UNIMAP_P, UNIMAP_LBRC, UNIMAP_RBRC, UNIMAP_ENT, UNIMAP_A, UNIMAP_S, UNIMAP_D }, /* 18-1F */
50 { UNIMAP_F, UNIMAP_G, UNIMAP_H, UNIMAP_J, UNIMAP_K, UNIMAP_L, UNIMAP_SCLN, UNIMAP_QUOT }, /* 20-27 */
51 { UNIMAP_BSLS, UNIMAP_Z, UNIMAP_X, UNIMAP_C, UNIMAP_V, UNIMAP_B, UNIMAP_N, UNIMAP_M }, /* 28-2F */
52 { UNIMAP_COMM, UNIMAP_DOT, UNIMAP_SLSH, UNIMAP_RO, UNIMAP_SPC, UNIMAP_HENK, UNIMAP_PGDN, UNIMAP_PGUP }, /* 30-37 */
53 { UNIMAP_INS, UNIMAP_DEL, UNIMAP_UP, UNIMAP_LEFT, UNIMAP_RGHT, UNIMAP_DOWN, UNIMAP_HOME, UNIMAP_END }, /* 38-3F */
54 { UNIMAP_PMNS, UNIMAP_PSLS, UNIMAP_P7, UNIMAP_P8, UNIMAP_P9, UNIMAP_PAST, UNIMAP_P4, UNIMAP_P5 }, /* 40-47 */
55 { UNIMAP_P6, UNIMAP_PPLS, UNIMAP_P1, UNIMAP_P2, UNIMAP_P3, UNIMAP_PEQL, UNIMAP_P0, UNIMAP_PCMM }, /* 48-4F */
56 { UNIMAP_PDOT, UNIMAP_MHEN, UNIMAP_F11, UNIMAP_F12, UNIMAP_F13, UNIMAP_F14, UNIMAP_F15, UNIMAP_NO }, /* 50-57 */
57 { UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_APP, UNIMAP_NO }, /* 58-5F */
58 { UNIMAP_PAUS, UNIMAP_PSCR, UNIMAP_F1, UNIMAP_F2, UNIMAP_F3, UNIMAP_F4, UNIMAP_F5, UNIMAP_F6 }, /* 60-67 */
59 { UNIMAP_F7, UNIMAP_F8, UNIMAP_F9, UNIMAP_F10, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO }, /* 68-6F */
60 { UNIMAP_LSFT, UNIMAP_CAPS, UNIMAP_KANA, UNIMAP_LALT, UNIMAP_LCTL, UNIMAP_NO, UNIMAP_NO, UNIMAP_LGUI }, /* 70-77 */
61 { UNIMAP_RGUI, UNIMAP_RALT, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_RSFT, UNIMAP_NO, UNIMAP_NO } /* 78-7F */
65 /* PC-9801/9821 keyboard
66 ,---. ,---. ,------------------------. ,------------------------. ,------------------------.
67 |Stp| |PrS| | F1 | F2 | F3 | F4 | F5 | | F6 | F7 | F8 | F9 | F10| | F11| F12| F13| F14| F15|
68 `---' `---' `------------------------' `------------------------' `------------------------'
69 ,-------------------------------------------------------------. ,-------. ,---------------.
70 | Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|JPY|Bspc| |Ins|Del| |Hom|End| -| /|
71 |-------------------------------------------------------------| |-------| |---------------|
72 | Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | |PgD|PgU| | 7| 8| 9| *|
73 |-------------------------------------------------------`Enter| |-------| |---------------|
74 |Ctl|Cap| A| S| D| F| G| H| J| K| L| ;| '| \| | | Up | | 4| 5| 6| +|
75 |-------------------------------------------------------------| |-------| |---------------|
76 | Shift | Z| X| C| V| B| N| M| ,| .| /| RO| Shift | |Lef|Rig| | 1| 2| 3|KP=|
77 `-------------------------------------------------------------' |-------| |---------------|
78 |Kana|Gui|GRPH|NFER| Space |XFER|Alt|Gui|App|^2 | Down | | 0| ,| .| ^1|
79 `--------------------------------------------------------' `-------' `---------------'
80 ^1: Enter on keypad is identical to Enter on alphanumeric portion.
81 ^2: Alt is ALT on DIGITAL WAVE Dboard while Menu on PC-9821 keyboard.
82 App is HOME key on PC98XL keyboard.
84 #define UNIMAP_PC98( \
85 K48, K46, K3A,K3B,K3C,K3D,K3E, K3F,K40,K41,K42,K43, K44,K45,K68,K69,K6A, \
86 K29,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K2D,K2E,K74,K2A, K49,K4C, K4A,K4D,K56,K54, \
87 K2B, K14,K1A,K08,K15,K17,K1C,K18,K0C,K12,K13,K2F,K30, K4B,K4E, K5F,K60,K61,K55, \
88 K78,K39,K04,K16,K07,K09,K0A,K0B,K0D,K0E,K0F,K33,K34,K31,K28, K52, K5C,K5D,K5E,K57, \
89 K79, K1D,K1B,K06,K19,K05,K11,K10,K36,K37,K38,K75, K7D, K50,K4F, K59,K5A,K5B,K67, \
90 K00,K7B,K7A,K77, K2C, K76,K7E,K7F,K65, K51, K62,K66,K63,K58 \
92 { AC_##K00, AC_NO, AC_NO, AC_NO, AC_##K04, AC_##K05, AC_##K06, AC_##K07, /* 00-07 */ \
93 AC_##K08, AC_##K09, AC_##K0A, AC_##K0B, AC_##K0C, AC_##K0D, AC_##K0E, AC_##K0F }, /* 08-0F */ \
94 { AC_##K10, AC_##K11, AC_##K12, AC_##K13, AC_##K14, AC_##K15, AC_##K16, AC_##K17, /* 10-17 */ \
95 AC_##K18, AC_##K19, AC_##K1A, AC_##K1B, AC_##K1C, AC_##K1D, AC_##K1E, AC_##K1F }, /* 18-1F */ \
96 { AC_##K20, AC_##K21, AC_##K22, AC_##K23, AC_##K24, AC_##K25, AC_##K26, AC_##K27, /* 20-27 */ \
97 AC_##K28, AC_##K29, AC_##K2A, AC_##K2B, AC_##K2C, AC_##K2D, AC_##K2E, AC_##K2F }, /* 28-2F */ \
98 { AC_##K30, AC_##K31, AC_NO, AC_##K33, AC_##K34, AC_NO, AC_##K36, AC_##K37, /* 30-37 */ \
99 AC_##K38, AC_##K39, AC_##K3A, AC_##K3B, AC_##K3C, AC_##K3D, AC_##K3E, AC_##K3F }, /* 38-3F */ \
100 { AC_##K40, AC_##K41, AC_##K42, AC_##K43, AC_##K44, AC_##K45, AC_##K46, AC_NO, /* 40-47 */ \
101 AC_##K48, AC_##K49, AC_##K4A, AC_##K4B, AC_##K4C, AC_##K4D, AC_##K4E, AC_##K4F }, /* 48-4F */ \
102 { AC_##K50, AC_##K51, AC_##K52, AC_NO, AC_##K54, AC_##K55, AC_##K56, AC_##K57, /* 50-57 */ \
103 AC_##K58, AC_##K59, AC_##K5A, AC_##K5B, AC_##K5C, AC_##K5D, AC_##K5E, AC_##K5F }, /* 58-5F */ \
104 { AC_##K60, AC_##K61, AC_##K62, AC_##K63, AC_NO, AC_##K65, AC_##K66, AC_##K67, /* 60-67 */ \
105 AC_##K68, AC_##K69, AC_##K6A, AC_NO, AC_NO, AC_NO, AC_NO, AC_NO, }, /* 68-6F */ \
106 { AC_NO, AC_NO, AC_NO, AC_NO, AC_##K74, AC_##K75, AC_##K76, AC_##K77, /* 70-77 */ \
107 AC_##K78, AC_##K79, AC_##K7A, AC_##K7B, AC_NO, AC_##K7D, AC_##K7E, AC_##K7F } /* 78-7F */ \