The distributed devc-con only provides US-101 keyboard mapping
for consoles, so I’ve patched it up to Japanese-106 keyboard.
Apply this patch to the Character DDK and recompile.
Using this devc-con under usual “diskboot” (ie qnxbase.ifs)
environment is the tricky part, so I’ll post it in the separate article.
Note you don’t need this under Photon environment.
(I don’t think anyone besides me reading qdn.* uses this anyway…)
kabe
Index: devc/con/intr.c
RCS file: /home/kabe/CVSROOT/hardware/devc/con/intr.c,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.5
diff -u -r1.1.1.1 -r1.1.1.1.2.5
— devc/con/intr.c 2001/03/24 18:17:43 1.1.1.1
+++ devc/con/intr.c 2002/01/04 21:07:09 1.1.1.1.2.5
@@ -149,49 +149,79 @@
/*
- Base codes
/
-static unsigned short kbtable[596] ={
+/*
-
- Changed around for Japanese 106 type keyboard
-
/
+#define KBTABSIZE 0x80
+static unsigned short kbtable[5KBTABSIZE] ={
0x8000,0x001B,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036, /* 00 */
- 0x0037,0x0038,0x0039,0x0030,0x002D,0x003D,0x007F,0x0009,
- 0x0037,0x0038,0x0039,0x0030,0x002D, ‘^’,0x007F,0x0009,
0x2071,0x2077,0x2065,0x2072,0x2074,0x2079,0x2075,0x2069, /* 10 */
- 0x206F,0x2070,0x005B,0x005D,0x000D,0x0202,0x2061,0x2073,
- 0x206F,0x2070, ‘@’, ‘[’,0x000D,0x0202,0x2061,0x2073,
0x2064,0x2066,0x2067,0x2068,0x206A,0x206B,0x206C,0x003B, /* 20 */
- 0x0027,0x0060,0x0201,0x005C,0x207A,0x2078,0x2063,0x2076,
-
':',0x001B,0x0201, ']',0x207A,0x2078,0x2063,0x2076,
0x2062,0x206E,0x206D,0x002C,0x002E,0x002F,0x0208,0x002A, /* 30 */
- 0x0204,0x0020,0x0804,0x0181,0x0182,0x0183,0x0184,0x0185,
- 0x0204,0x0020,0x0202,0x0181,0x0182,0x0183,0x0184,0x0185,
0x0186,0x0187,0x0188,0x0189,0x018A,0x0802,0x0801,0x05A0, /* 40 /
0x05A1,0x05A2,0x05A3,0x05A4,0x05A5,0x05A6,0x05A7,0x05A8,
0x05A9,0x05AA,0x05AB,0x05AC,0x8000,0x8000,0x8000,0x01AE, / 50 /
0x01AF,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,
+/ Japanese-106 additional codes: -
- 0x29 Hankaku/Zenkaku (map Esc for now)
-
- 0x70 Hiragana/Katakana (map invalid)
-
- 0x73 Backslash/Underbar
-
- 0x79 Henkan/MaeKouho (map space)
-
- 0x7B Muhenkan (map space)
-
- 0x7D Yen/Verticalbar
-
-
- Note that this keyboard’s scancode generates above 0x60.
-
-
- Other maps:
-
- Shift-Capslock mapped to CapsLock
-
- plain Capslock mapped to Ctrl
- */
- 0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000, /* 60 */
- 0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,
- 0x8000,0x8000,0x8000, ‘\’,0x8000,0x8000,0x8000,0x8000, /* 70 */
- 0x8000, ’ ',0x8000, ’ ',0x8000, ‘\’,0x8000,0x8000,
/*
- Shift codes
*/
- 0x8000,0x001B,0x0021,0x0040,0x0023,0x0024,0x0025,0x005E, /* 00 */
- 0x0026,0x002A,0x0028,0x0029,0x005F,0x002B,0x01FC,0x0180,
- 0x8000,0x001B,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026, /* 00 */
- 0x0027,0x0028,0x0029, ‘~’, ‘=’, ‘~’,0x01FC,0x0180,
0x2051,0x2057,0x2045,0x2052,0x2054,0x2059,0x2055,0x2049, /* 10 */
- 0x204F,0x2050,0x007B,0x007D,0x01E0,0x0202,0x2041,0x2053,
- 0x2044,0x2046,0x2047,0x2048,0x204A,0x204B,0x204C,0x003A, /* 20 */
- 0x0022,0x007E,0x0201,0x007C,0x205A,0x2058,0x2043,0x2056,
- 0x204F,0x2050, ‘`’, ‘{’,0x01E0,0x0202,0x2041,0x2053,
- 0x2044,0x2046,0x2047,0x2048,0x204A,0x204B,0x204C, ‘+’, /* 20 */
-
'*',0x001B,0x0201, '}',0x205A,0x2058,0x2043,0x2056,
0x2042,0x204E,0x204D,0x003C,0x003E,0x003F,0x0208,0x01AD, /* 30 */
- 0x0204,0x0020,0x8000,0x018B,0x018C,0x018D,0x018E,0x018F,
- 0x0204,0x0020,0x0804,0x018B,0x018C,0x018D,0x018E,0x018F,
0x0190,0x0191,0x0192,0x0193,0x0194,0x8000,0x8000,0x0437, /* 40 /
0x0438,0x0439,0x042D,0x0434,0x0435,0x0436,0x042B,0x0431,
0x0432,0x0433,0x0430,0x042E,0x8000,0x8000,0x8000,0x01DB, / 50 */
0x01DC,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000, - 0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000, /* 60 */
- 0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,
- 0x8000,0x8000,0x8000, ‘_’,0x8000,0x8000,0x8000,0x8000, /* 70 */
- 0x8000, ’ ',0x8000, ’ ',0x8000, ‘|’,0x8000,0x8000,
/*
- Cntl codes
*/
- 0x8000,0x001B,0x8000,0x0000,0x8000,0x8000,0x8000,0x001E, /* 00 */
- 0x8000,0x8000,0x8000,0x8000,0x001F,0x8000,0x01DE,0x019F,
- 0x8000,0x001B,0x8000,0x1022,0x8000,0x8000,0x8000,0x001E, /* 00 */
- 0x1027,0x8000,0x8000,0x8000,0x8000,0x105E,0x01DE,0x019F,
0x0011,0x0017,0x0005,0x0012,0x0014,0x0019,0x0015,0x0009, /* 10 */
- 0x000F,0x0010,0x001B,0x001D,0x01D0,0x0202,0x0001,0x0013,
- 0x000F,0x0010,0x0000,0x001B,0x01D0,0x0202,0x0001,0x0013,
0x0004,0x0006,0x0007,0x0008,0x000A,0x000B,0x000C,0x8000, /* 20 */
- 0x1027,0x8000,0x0201,0x001C,0x001A,0x0018,0x0003,0x0016,
- 0x8000,0x8000,0x0201,0x001D,0x001A,0x0018,0x0003,0x0016,
0x0002,0x000E,0x000D,0x8000,0x8000,0x8000,0x0208,0x01BD, /* 30 */
- 0x0204,0x0020,0x8000,0x0195,0x0196,0x0197,0x0198,0x0199,
- 0x0204,0x0020,0x0202,0x0195,0x0196,0x0197,0x0198,0x0199,
0x019A,0x019B,0x019C,0x019D,0x019E,0x8000,0x4012,0x01B0, /* 40 /
0x01B1,0x01B2,0x01B3,0x01B4,0x01B5,0x01B6,0x01B7,0x01B8,
0x01B9,0x01BA,0x01BB,0x01BC,0x8000,0x8000,0x8000,0x01BE, / 50 */
0x01BF,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000, - 0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000, /* 60 */
- 0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,
- 0x8000,0x8000,0x8000,0x001C,0x8000,0x8000,0x8000,0x8000, /* 70 */
- 0x8000,0x8000,0x8000,0x8000,0x8000,0x001C,0x8000,0x8000,
/*
- Alt codes
/
@@ -202,26 +232,34 @@
0x01E4,0x01E6,0x01E7,0x01E8,0x01EA,0x01EB,0x01EC,0x8000, / 20 /
0x8000,0x8000,0x0201,0x8000,0x01FA,0x01F8,0x01E3,0x01F6,
0x01E2,0x01EE,0x01ED,0x8000,0x8000,0x8000,0x0208,0x01CD, / 30 */
- 0x0204,0x8000,0x8000,0x01D1,0x01D2,0x01D3,0x01D4,0x01D5,
- 0x0204,0x8000,0x0202,0x01D1,0x01D2,0x01D3,0x01D4,0x01D5,
0x01D6,0x01D7,0x01D8,0x01D9,0x01DA,0x8000,0x8000,0x01C0, /* 40 /
0x01C1,0x01C2,0x01C3,0x01C4,0x01C5,0x01C6,0x01C7,0x01C8,
0x01C9,0x01CA,0x01CB,0x01CC,0x01DD,0x8000,0x8000,0x01CE, / 50 */
0x01CF,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000, - 0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000, /* 60 */
- 0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,
- 0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000, /* 70 */
- 0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,
/*
- Ctl-Alt codes
/
0x8000,0x4002,0x4005,0x4006,0x4007,0x4008,0x4009,0x400A, / 00 /
0x400B,0x400C,0x400D,0x400E,0x8000,0x8000,0x4004,0x8000,
0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000, / 10 */
- 0x8000,0x8000,0x8000,0x8000,0x4003,0x0202,0x8000,0x8000,
- 0x8000,0x8000,0x1060,0x8000,0x4003,0x0202,0x8000,0x8000,
0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000, /* 20 /
0x8000,0x8000,0x0201,0x8000,0x8000,0x8000,0x8000,0x8000,
0x8000,0x8000,0x8000,0x4010,0x400F,0x4011,0x0208,0x4020, / 30 */
- 0x0204,0x8000,0x8000,0x4021,0x4022,0x4023,0x4024,0x4025,
- 0x0204,0x8000,0x0202,0x4021,0x4022,0x4023,0x4024,0x4025,
0x4026,0x4027,0x4028,0x4029,0x402A,0x8000,0x8000,0x8000, /* 40 /
0x8000,0x8000,0x4004,0x8000,0x8000,0x8000,0x4003,0x8000,
0x8000,0x8000,0x8000,0x4001,0x4020,0x8000,0x8000,0x8000, / 50 */
0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000, - 0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000, /* 60 */
- 0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,
- 0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000, /* 70 */
- 0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,
};
static unsigned short *kb_base = &kbtable[0];
@@ -566,13 +604,13 @@
{
if( flag & KB_ALT) {
if( flag & KB_CTL)
-
return(&kbtable[4*96]); /* Ctl + Alt */
-
return(&kbtable[3*96]); /* Alt */
-
return(&kbtable[4*KBTABSIZE]); /* Ctl + Alt */
-
return(&kbtable[3*KBTABSIZE]); /* Alt */
}
if( flag & KB_CTL)
-
return(&kbtable[2*96]); /* Ctl */
-
return(&kbtable[2*KBTABSIZE]); /* Ctl */
if( flag & KB_SHIFT)
-
return(&kbtable[1*96]); /* Shift */
-
return(&kbtable[1*KBTABSIZE]); /* Shift */
return(&kbtable[0]); /* Normal */
}
@@ -665,28 +703,34 @@
key = *(kb_base + c);
op = (key >> ;
- if( c >= 0x60 ) {
- if( c >= KBTABSIZE ) {
/*
-
* Process special codes
-
* Ignore all other codes
-
* (KBTABSIZE==0x80, so no-op here...)
*/
-
if( s == 0xFA ) {
-
/*
-
* A received ACK from keyboard allows us to
-
* send another byte from the transmit queue
-
*/
-
rcv_ack();
-
goto done;
-
}
-
if( s == 0xE0 ) {
-
/*
-
* Extended scan-code follows
-
*/
-
kbflag &= ~KB_EXTENDED;
-
kbflag |= KB_EXT_ARM;
-
goto done;
-
}
-
goto done;
-
}
- if( s == 0xFA ) {
/*
-
* Ignore all other codes
-
* A received ACK from keyboard allows us to
-
* send another byte from the transmit queue
-
*/
-
rcv_ack();
-
goto done;
-
}
- if( s == 0xE0 ) {
-
/*
-
* Extended scan-code follows
-
*/
-
kbflag &= ~KB_EXTENDED;
-
kbflag |= KB_EXT_ARM;
-
goto done;
-
}
- if( op == 0x80 ) {
-
/*
-
* Ignore invalid key
*/
goto done;
}