PharLap E.T.S. Keyboard Driver Foreign Language Application Notes

The following table has been provided for ease of conversion from the PharLap standard US keyboard driver to a foreign or UK keyboard driver. The UK driver has already been implemented by Hitex (UK) Ltd. and can be obtained from them. It was produced in response to a request from one of our UK customers. This document is meant as a guide and is not intended as a complete method of writing keyboard drivers.

You should already be referring to PharLap’s ETS Kernel Users Guide, Basics of Operation Chapter 13 Page 277 and Visual System Builder & ETS Utilities Guide Chapter 4 Page 43. From this you will have gathered that you need to edit PCKEY.C. The easiest way to do this is to create a new Project with Development Studio. Use File: New: Projects: Win32 Static Library and give it a name such as UKKEY (Figure 1).

Figure 1

Copy PCKEY.C into your new directory and rename it (UKKEY.C). From Project: Add to Project: Files add the new file UKKEY.C.

Now Edit UKKEY.C. Because the US keyboard is 101 keys and all other Keyboard type are 102 you will need to add an entry in the Scan2VK structure for the missing scan code. The Scan code is 0x56 therefore you need to add an entry at offset 56 HEX in Scan2VK. The value I have chosen is 0xd8 because this offset is not currently used in Vk2Ascii.

NOTE: This might change in future versions of the driver and therefore you might have to change this value to an unused offset.

Next edit the Structures Vk2Ascii and Vk2CapAscii in UKKEY.C. using Table 1 as a guide. To use the Table refer to Figure 3 for the key number. Look across to column 4 to obtain the offset into the structures Vk2Ascii and Vk2CapAscii.

Change the characters at these offsets to those required for your language. Remember the structure is zero based. Finally build the library from the BUILD: BUILD UKKEY.LIB menu.

The driver can then be included, by using Visual System Builder and changing the Kernel keyboard driver to custom. Browse to the newly created UKKEY.LIB. (Figure 2).

Figure 2


If you are not using Visual System Builder you will have to make a copy of pharemb\linkcmd\pcat_kb.emb to say ukkb.emb. Rename the .LIB in ukkb.emb then include ukkb.emb in your linkloc command line i.e. Linkloc @vc.emb @ukkb.emb yourapp

 

Figure 3

Table 1

KEY Number SCAN CODE (HEX) ENTRY in Scan2VK Ascii Table Entry Offset (HEX) Current Value in UK keyboard Vk2Ascii Current Value in UK keyboard Vk2CapAscii
01 29 0xc0 C0 ‘`’ ‘¬’
02 02 ‘1’ 31 ‘1’ ‘!’
03 03 ‘2’ 32 ‘2’ ‘"’
04 04 ‘3’ 33 ‘3’ ‘£’
05 05 ‘4’ 34 ‘4’ ‘$’
06 06 ‘5’ 35 ‘5’ ‘%’
07 07 ‘6’ 36 ‘6’ ‘^’
08 08 ‘7’ 37 ‘7’ ‘&’
09 09 ‘8’ 38 ‘8’ ‘*’
10 0A ‘9’ 39 ‘9’ ‘(‘
11 0B ‘0’ 30 ‘0’ ‘)’
12 0C 0xbd BD ‘-‘ ‘_’
13 0D 0xbb BB ‘=’ ‘+’
15 0E VK_BACK 08 0x08 0x08
16 0F VK_TAB 09 0x09 0x09
17 10 ‘Q’ 51 ‘q’ ‘Q’
18 11 ‘W’ 57 ‘w’ ‘W’
19 12 ‘E’ 45 ‘e’ ‘E’
20 13 ‘R’ 52 ‘r’ ‘R’
21 14 ‘T’ 54 ‘t’ ‘T’
22 15 ‘Y’ 59 ‘y’ ‘Y’
23 16 ‘U’ 55 ‘u’ ‘U’
24 17 ‘I’ 49 ‘i’ ‘I’
25 18 ‘O’ 4F ‘o’ ‘O’
26 19 ‘P’ 50 ‘p’ ‘P’
27 1A 0xdb DB ‘[’ ‘{’
28 1B 0xdd DD ‘]’ ‘}’
29 (101 only) 2B 0xdc DC ‘#’ ‘~’
30 3A VK_CAPITAL 14 0x0 0x0
31 1E ‘A’ 41 ‘a’ ‘A’
32 1F ‘S’ 53 ‘s’ ‘S’
33 20 ‘D’ 44 ‘d’ ‘D’
34 21 ‘F’ 46 ‘f’ ‘F’
35 22 ‘G’ 47 ‘g’ ‘G’
36 23 ‘H’ 48 ‘h’ ‘H’
37 24 ‘J’ 4A ‘j’ ‘J’
38 25 ‘K’ 4B ‘k’ ‘K’
39 26 ‘L’ 4C ‘l’ ‘L’
40 27 0xba BA ‘;’ ‘:’
41 28 0xde DE ‘\’’ ‘@’
42 (102 only) 2B 0xdc DC ‘#’ ‘~’
43 1C VK_RETURN 0D 0D 0D
44 2A VK_SHIFT 10 0x0 0x0
45 (102 only) 56 0xd8 D8 ‘\’ ‘|’
46 2C ‘Z’ 5A ‘z’ ‘Z’
47 2D ‘X’ 58 ‘x’ ‘X’
48 2E ‘C’ 43 ‘c’ ‘C’
49 2F ‘V’ 56 ‘v’ ‘V’
50 30 ‘B’ 42 ‘b’ ‘B’
51 31 ‘N’ 4E ‘n’ ‘N’
52 32 ‘M’ 4D ‘m’ ‘M’
53 33 0xbc BC ‘,’ ‘<’
54 34 0xbe BE ‘.’ ‘>’
55 35 0xbf BF ‘/’ ‘?’
57 36 VK_SHIFT 10 0x0 0x0
58 1D VK_CONTROL 11 0x0 0x0
60 38 VK_MENU 12 0x0 0x0
61 39 VK_SPACE 20 ‘ ‘ ‘ ‘
62 E0 38        
64 E0 1D        
75          
76          
79          
80          
81          
83          
84          
85          
86          
89          
90 45 VK_NUMLOCK 90 0x0 0x0
91 47 VK_HOME 24 0x0 0x0
92 4B VK_LEFT 25 0x0 0x0
93 4F VK_END 23 0x0 0x0
95          
96 48 VK_UP 26 0x0 0x0
97 4C VK_CLEAR 0C 0x0 0x0
98 50 VK_DOWN 28 0x0 0x0
99 52 VK_INSERT 2D 0x0 0x0
100 37 VK_MULTIPLY 6A ‘*’ ‘*’
101 49 VK_PRIOR 21 0x0 0x0
102 4D VK_RIGHT 27 0x0 0x0
103 51 VK_NEXT 22 0x0 0x0
104 53 VK_DELETE 2E 0x0 0x0
105 4A VK_SUBTRACT 6D ‘-‘ ‘-‘
106 4E VK_ADD 6B ‘+’ ‘+’
108 E0 1C        
110 01 VK_ESCAPE 1B 0x1b 0x0
112 3B VK_F1 70 0x0 0x0
113 3C VK_F2 71 0x0 0x0
114 3D VK_F3 72 0x0 0x0
115 3E VK_F4 73 0x0 0x0
116 3F VK_F5 74 0x0 0x0
117 40 VK_F6 75 0x0 0x0
118 41 VK_F7 76 0x0 0x0
119 42 VK_F8 77 0x0 0x0
120 43 VK_F9 78 0x0 0x0
121 44 VK_F10 79 0x0 0x0
122 57 VK_F11 7A 0x0 0x0
123 58 VK_F12 7B 0x0 0x0
124          
125 46 VK_SCROLL 91 0x0 0x0
126