Files
x1key/keytable.h
Philip Smart 6ac7fa5563 First push
2022-02-17 13:17:58 +00:00

295 lines
13 KiB
C
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
PS / 2- SHARP X1 keycode conversion table
I don't have the actual X1 keyboard, so the X1 keycode is
X1 emulator Xmillennium v0.26 T-tune STEP 1.43 (http://www.x1center.org/emu.html)
I used the table in Input.cpp contained in.
Created on July 23, 2014
Kyoichi Sato http://kyoutan.jpn.org/
There is no guarantee.
The part created by Kyoichi Sato has no restrictions on its use. You can use it freely regardless of whether it is commercial or non-commercial.
It means that you can copy, modify, distribute, or sell it without permission.
No need to contact.
*/
typedef const unsigned char BYTE;
#pragma section rom flash_data // Place the conversion table in the data flash
/* ~~~ ~~~~~~~~~~
| +-The name of the section you like.
| Add placement attributes such as _NE _NO to this name
| Build-Specify the starting address in the linker section settings
| (No need to edit the sect30.inc file)
+ --------- Default section name (program, rom, data, bss)
For placement attributes and default section names,
M16C Series, R8C Family C / C ++ Compiler User's Manual Chapter 2 Basic Usage of the Compiler
2.2.3 Customizing memory allocation a. See Section Configuration for more information.
(The manual is installed with the "High-performancd Embedded Workshop (HEW)"
You can see it in "Manual Navigator")
*/
#ifndef KEYTABLE_H
#define KEYTABLE_H
#ifdef __cplusplus
extern "C" {
#endif
// PS / 2 106 Keyboard to internal code conversion table
// If you convert the PS / 2 code directly to the X1 code, the X1 table will become large.
// Convert to internal code once
BYTE KEY106[0x100] =
{
// 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0A 0x0B 0x0C 0x0D 0x0E 0x0F
// 0x00 F9 F5 F3 F1 F2 F12 F10 F8 F6 F4 TAB ‘SŠp
0x00,0x43,0x00,0x3F,0x3D,0x3B,0x3C,0x58,0x00,0x44,0x42,0x40,0x3E,0x0F,0x29,0x00,
// 0x10 ALT SH L ‚Ђç CTRL Q 1 Z S A W 2 WIN
0x00,0x38,0x2A,0x55,0x1D,0x10,0x02,0x00,0x00,0x00,0x2C,0x1F,0x1E,0x11,0x03,0x00,
// 0x20 C X D E 4 3 WIN SP V F T R 5 APL
0x00,0x2E,0x2D,0x20,0x12,0x05,0x04,0x00,0x00,0x39,0x2F,0x21,0x14,0x13,0x06,0x00,
// 0x30 N B H G Y 6 M J U 7 8
0x00,0x31,0x30,0x23,0x22,0x15,0x07,0x00,0x00,0x00,0x32,0x24,0x16,0x08,0x09,0x00,
// 0x40 , K I O 0 9 . / L ; P -
0x00,0x33,0x25,0x17,0x18,0x0B,0x0A,0x00,0x00,0x34,0x35,0x26,0x27,0x19,0x0C,0x00,
// 0x50 ‚ë : @ ^ CAPS SH R ENT [ ]
0x00,0x59,0x28,0x00,0x1A,0x0d,0x00,0x00,0x3A,0x36,0x1C,0x1B,0x00,0x2B,0x00,0x00,
// 0x60 •ÏŠ· BS –³•Ï 1 \ 4 7
0x00,0x00,0x00,0x00,0x5E,0x00,0x0E,0x56,0x00,0x4F,0x5A,0x4B,0x47,0x00,0x00,0x00,
// 0x70 0 . 2 5 6 8 ESC NUM F11 + 3 - * 9 ScLk
0x52,0x53,0x50,0x4C,0x4D,0x48,0x01,0x00,0x57,0x4E,0x51,0x4A,0x37,0x49,0x00,0x00,
// 0x80 BRK F7
0x45,0x00,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
// Extended key
// 0x60 END © HOME
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5F,0x00,0xCB,0xC7,0x00,0x00,0x00,
// 0x70 INS DEL « ¨ ª PgDn PgUp
0xD2,0xD3,0xD0,0x00,0xCD,0xC8,0x00,0x00,0x00,0x00,0x5C,0x00,0x00,0x5B,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
// PAUSE/BREAK E1 14 77 E1 F0 14 F0 77 ¨ 0x80
// PRINT SCREEN E0 12 E0 7C ¨ [SH L]+[*(TEN KEY)]
};
/* ƒŠƒ^[ƒ“ƒR[ƒh ‘Œ©•\
0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0A 0x0B 0x0C 0x0D 0x0E 0x0F
0x00 ESC 1 2 3 4 5 6 7 8 9 0 - ^ BS TAB
0x10 Q W E R T Y U I O P @ [ ENT CTRL A S
0x20 D F G H J K L ; : ‘S SH L ] Z X C V
0x30 B N M , . / SH R * ALT SP CAPS F1 F2 F3 F4 F5
0x40 F6 F7 F8 F9 F10 BRK 7 8 9 - 4 5 6 + 1
0x50 2 3 0 . ‚©‚È –³•Ï F11 F12 ‚ë \ PgUp PgDn = •ÏŠ· END
0x60
0x70
0x80
0x90
0xA0
0xB0
0xC0 HOME ª © ¨
0xD0 « INS DEL
*/
#define GRAPH_CODE1 0x56 // Immutable
#define GRAPH_CODE2 0x38 // ALT
#define CAPS_CODE 0x3A // CAPS
#define KANA_CODE 0x55 // Katakana / Hiragana
#define SHIFTL_CODE 0x2A // Left SHIFT
#define SHIFTR_CODE 0x36 // Right SHIFT
#define CTRL_CODE 0x1D // CTRL
#define UP_CODE 0xC8 // ↑
#define DOWN_CODE 0xD0 // ↓
#define LEFT_CODE 0xCB // ←
#define RIGHT_CODE 0xCD // → →
#define INS_CODE 0xD2 // INS
#define DEL_CODE 0xD3 // DEL
#define HOME_CODE 0xC7 // HOME
BYTE BREAK_CODE[8]={0xE1,0x14,0x77,0xE1,0xF0,0x14,0xF0,0x77}; // BREAK key code string
// BASE
BYTE CHR_TBL0[]={
/* -- , ESC, ‚P, ‚Q, ‚R, ‚S, ‚T, ‚U, 0x00 */
0x00,0x1b, '1', '2', '3', '4', '5', '6',
/* ‚V, ‚W, ‚X, ‚O, |, O, BS, TAB, 0x08 */
'7', '8', '9', '0', '-', '^',0x08,0x09,
/* ‚p, ‚v, ‚d, ‚q, ‚s, ‚x, ‚t, ‚h, 0x10 */
'q', 'w', 'e', 'r', 't', 'y', 'u', 'i',
/* ‚n, ‚o, —, m, Ent,Ctrl, ‚`, ‚r, 0x18 */
'o', 'p', '@', '[',0x0d,0x00, 'a', 's',
/* ‚c, ‚e, ‚f, ‚g, ‚i, ‚j, ‚k, G, 0x20 */
'd', 'f', 'g', 'h', 'j', 'k', 'l', ';',
/* F, ‘S,SftL, n, ‚y, ‚w, ‚b, ‚u, 0x28 */
':',0x00,0x00, ']', 'z', 'x', 'c', 'v',
/* ‚a, ‚m, ‚l, C, D, ^,SftR, [*], 0x30 */
'b', 'n', 'm', ',', '.', '/',0x00,0x2a,
/* Alt, SPC, Cap, f.1, f.2, f.3, f.4, f.5, 0x38 */
0x00, ' ',0x00, 'q', 'r', 's', 't', 'u',
/* f.6, f.7, f.8, f.9,f.10,Paus,ScrL, [7], 0x40 */
0xec,0xeb,0xe2,0xe1,0x00,0x13,0x00, '7',
/* [8], [9], [-], [4], [5], [6], [+], [1], 0x48 */
'8', '9', '-', '4', '5', '6', '+', '1',
/* [2], [3], [0], [.], ???, ???, ???,f.11, 0x50 */
'2', '3', '0', '.',0x00,0x00,0x00,0x00,
/*f.12, _ , \ ,RLUP,RLDN,<>,XFER, END, 0x58 */
0x00,0x00,'\\',0x0e,0x0f, '=',0xfe,0x11,
};
// SHIFT
BYTE CHR_TBL1[]={
/* -- , ESC, ‚P, ‚Q, ‚R, ‚S, ‚T, ‚U, 0x00 */
0x00,0x1b, '!',0x22, '#', '$',0x25, '&',
/* ‚V, ‚W, ‚X, ‚O, |, O, BS, TAB, 0x08 */
0x27, '(', ')', '0', '=',0x60,0x12,0x09,
/* ‚p, ‚v, ‚d, ‚q, ‚s, ‚x, ‚t, ‚h, 0x10 */
'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I',
/* ‚n, ‚o, —, m, Ent,Ctrl, ‚`, ‚r, 0x18 */
'O', 'P',0x7e, '{',0x0d,0x00, 'A', 'S',
/* ‚c, ‚e, ‚f, ‚g, ‚i, ‚j, ‚k, G, 0x20 */
'D', 'F', 'G', 'H', 'J', 'K', 'L', '+',
/* F, ‘S,SftL, n, ‚y, ‚w, ‚b, ‚u, 0x28 */
0x2a,0x00,0x00, '}', 'Z', 'X', 'C', 'V',
/* ‚a, ‚m, ‚l, C, D, ^,SftR, [*], 0x30 */
'B', 'N', 'M', '<', '>',0x3f,0x00,0x2a,
/* Alt, SPC, Cap, f.1, f.2, f.3, f.4, f.5, 0x38 */
0x00, ' ',0x00, 'v', 'w', 'x', 'y', 'z',
/* f.6, f.7, f.8, f.9,f.10,Paus, ???, [7], 0x40 */
0x00,0x00,0x00,0x00,0x00,0x03,0x00, '7',
/* [8], [9], [-], [4], [5], [6], [+], [1], 0x48 */
'8', '9', '-', '4', '5', '6', '+', '1',
/* [2], [3], [0], [.], ???, ???, ???,f.11, 0x50 */
'2', '3', '0', '.',0x00,0x00,0x00,0x00,
/*f.12, _ , \ ,RLUP,RLDN,<>,XFER, END, 0x58 */
0x00, '_', '|',0x0e,0x0f, '=',0xfe,0x11,
};
// GRPH (Alt)
BYTE CHR_TBL2[]={
/* -- , ESC, ‚P, ‚Q, ‚R, ‚S, ‚T, ‚U, 0x00 */
0x00,0x00,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,
/* ‚V, ‚W, ‚X, ‚O, |, O, BS, TAB, 0x08 */
0xf7,0xf8,0xf9,0xfa,0x8c,0x8b,0x00,0x00,
/* ‚p, ‚v, ‚d, ‚q, ‚s, ‚x, ‚t, ‚h, 0x10 */
0xe0,0xe1,0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,
/* ‚n, ‚o, —, m, Ent,Ctrl, ‚`, ‚r, 0x18 */
0xf0,0x8d,0x8a,0xfc,0x00,0x00,0x7f,0xe9,
/* ‚c, ‚e, ‚f, ‚g, ‚i, ‚j, ‚k, G, 0x20 */
0xea,0xeb,0xec,0xed,0xee,0xef,0x8e,0x89,
/* F, ‘S,SftL, n, ‚y, ‚w, ‚b, ‚u, 0x28 */
0xfd,0x00,0x00,0xe8,0x80,0x81,0x82,0x83,
/* ‚a, ‚m, ‚l, C, D, ^,SftR, [*], 0x30 */
0x84,0x85,0x86,0x87,0x88,0xfe,0x00,0x9b,
/* Alt, SPC, Cap, f.1, f.2, f.3, f.4, f.5, 0x38 */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/* f.6, f.7, f.8, f.9,f.10,Paus, ???, [7], 0x40 */
0x00,0x00,0x00,0x00,0x00,0x13,0x00,0x9a,
/* [8], [9], [-], [4], [5], [6], [+], [1], 0x48 */
0x93,0x97,0x9c,0x95,0x96,0x94,0x9d,0x99,
/* [2], [3], [0], [.], ???, ???, ???,f.11, 0x50 */
0x92,0x98,0x8f,0x91,0x00,0x00,0x00,0x00,
/*f.12, _ , \ ,RLUP,RLDN,<>,XFER, END, 0x58 */
0x00,0xff,0xfb,0x0e,0x0f,0x90,0xfe,0x11,
};
// CTRL
BYTE CHR_TBL3[]={
/* -- , ESC, ‚P, ‚Q, ‚R, ‚S, ‚T, ‚U, 0x00 */
0x00,0x1b, '1', '2', '3', '4', '5', '6',
/* ‚V, ‚W, ‚X, ‚O, |, O, BS, TAB, 0x08 */
'7', '8', '9', '0',0x00,0x1e,0x08,0x09,
/* ‚p, ‚v, ‚d, ‚q, ‚s, ‚x, ‚t, ‚h, 0x10 */
0x11,0x17,0x05,0x12,0x14,0x19,0x15,0x09,
/* ‚n, ‚o, —, m, Ent,Ctrl, ‚`, ‚r, 0x18 */
0x0f,0x10, '@',0x1b,0x0d,0x00,0x01,0x13,
/* ‚c, ‚e, ‚f, ‚g, ‚i, ‚j, ‚k, G, 0x20 */
0x04,0x06,0x07,0x08,0x0a,0x0b,0x0c, ';',
/* F, ‘S,SftL, n, ‚y, ‚w, ‚b, ‚u, 0x28 */
':',0x00,0x1c,0x1d,0x1a,0x18,0x03,0x16,
/* ‚a, ‚m, ‚l, C, D, ^,SftR, [*], 0x30 */
0x02,0x0e,0x0d,0x00,0x00,0x00,0x00,0x2a,
/* Alt, SPC, Cap, f.1, f.2, f.3, f.4, f.5, 0x38 */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/* f.6, f.7, f.8, f.9,f.10,Paus, ???, [7], 0x40 */
0xec,0xeb,0xe2,0xe1,0x00,0x03,0x00, '7',
/* [8], [9], [-], [4], [5], [6], [+], [1], 0x48 */
'8', '9', '-', '4', '5', '6', '+', '1',
/* [2], [3], [0], [.], ???, ???, ???,f.11, 0x50 */
'2', '3', '0', '.',0x00,0x00,0x00,0x00,
/*f.12, _ , \ ,RLUP,RLDN,<>,XFER, END, 0x58 */
0x00,0x00,0x1c,0x0e,0x0f, '=',0xfe,0x11,
};
// ¶Å
BYTE CHR_TBL4[]={
/* -- , ESC, ‚P, ‚Q, ‚R, ‚S, ‚T, ‚U, 0x00 */
0x00,0x1b, 'Ç', 'Ì', '±', '³', '´', 'µ',
/* ‚V, ‚W, ‚X, ‚O, |, O, BS, TAB, 0x08 */
'Ô', 'Õ', 'Ö', 'Ü', 'Î', 'Í',0x08,0x09,
/* ‚p, ‚v, ‚d, ‚q, ‚s, ‚x, ‚t, ‚h, 0x10 */
'À', 'Ã', '²', '½', '', 'Ý', 'Å', 'Æ',
/* ‚n, ‚o, —, m, Ent,Ctrl, ‚`, ‚r, 0x18 */
'×', '¾', 'Þ', 'ß',0x0d,0x00, 'Á', 'Ä',
/* ‚c, ‚e, ‚f, ‚g, ‚i, ‚j, ‚k, G, 0x20 */
'¼', 'Ê', '·', '¸', 'Ï', 'É', 'Ø', 'Ú',
/* F, ‘S,SftL, n, ‚y, ‚w, ‚b, ‚u, 0x28 */
'¹',0x00,0x00, 'Ñ', 'Â', '»', '¿', 'Ë',
/* ‚a, ‚m, ‚l, C, D, ^,SftR, [*], 0x30 */
'º', 'Ð', 'Ó', 'È', 'Ù', 'Ò',0x00,0x2a,
/* Alt, SPC, Cap, f.1, f.2, f.3, f.4, f.5, 0x38 */
0x00,0x20,0x00, 'q', 'r', 's', 't', 'u',
/* f.6, f.7, f.8, f.9,f.10,Paus, ???, [7], 0x40 */
0xec,0xeb,0xe2,0xe1,0x00,0x13,0x00, '7',
/* [8], [9], [-], [4], [5], [6], [+], [1], 0x48 */
'8', '9', '-', '4', '5', '6', '+', '1',
/* [2], [3], [0], [.], ???, ???, ???,f.11, 0x50 */
'2', '3', '0', '.',0x00,0x00,0x00,0x00,
/*f.12, _ , \ ,RLUP,RLDN,<>,XFER, END, 0x58 */
0x00, 'Û', '°',0x0e,0x0f, '=',0xfe,0x11,
};
// ¶Å+¼ÌÄ
BYTE CHR_TBL5[]={
/* -- , ESC, ‚P, ‚Q, ‚R, ‚S, ‚T, ‚U, 0x00 */
0x00,0x1b, 'Ç', 'Ì', '§', '©', 'ª', '«',
/* ‚V, ‚W, ‚X, ‚O, |, O, BS, TAB, 0x08 */
'¬', '­', '®', '¦', 'Î', 'Í',0x12,0x09,
/* ‚p, ‚v, ‚d, ‚q, ‚s, ‚x, ‚t, ‚h, 0x10 */
'À', 'Ã', '¨', '½', '', 'Ý', 'Å', 'Æ',
/* ‚n, ‚o, —, m, Ent,Ctrl, ‚`, ‚r, 0x18 */
'×', '¾', 'Þ', '¢',0x0d,0x00, 'Á', 'Ä',
/* ‚c, ‚e, ‚f, ‚g, ‚i, ‚j, ‚k, G, 0x20 */
'¼', 'Ê', '·', '¸', 'Ï', 'É', 'Ø', 'Ú',
/* F, ‘S,SftL, n, ‚y, ‚w, ‚b, ‚u, 0x28 */
'¹',0x00,0x00, '£', '¯', '»', '¿', 'Ë',
/* ‚a, ‚m, ‚l, C, D, ^,SftR, [*], 0x30 */
'º', 'Ð', 'Ó', '¤', '¡', '¥',0x00,0x2a,
/* Alt, SPC, Cap, f.1, f.2, f.3, f.4, f.5, 0x38 */
0x00, ' ',0x00, 'v', 'w', 'x', 'y', 'z',
/* f.6, f.7, f.8, f.9,f.10,Paus, ???, [7], 0x40 */
0x00,0x00,0x00,0x00,0x00,0x03,0x00, '7',
/* [8], [9], [-], [4], [5], [6], [+], [1], 0x48 */
'8', '9', '-', '4', '5', '6', '+', '1',
/* [2], [3], [0], [.], ???, ???, ???,f.11, 0x50 */
'2', '3', '0', '.',0x00,0x00,0x00,0x00,
/*f.12, _ , \ ,RLUP,RLDN,<>,XFER, END, 0x58 */
0x00, 'Û', '°',0x0e,0x0f, '=',0xfe,0x11,
};
#pragma section rom rom
#ifdef __cplusplus
}
#endif
#endif // KEYTABLE_H