aboutsummaryrefslogtreecommitdiff
path: root/board/MAI/bios_emulator/scitech/src/pm/codepage/us_eng.c
blob: 9aa871423e926890256047dd73901f842cf760bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
/****************************************************************************
*
*                   SciTech OS Portability Manager Library
*
*  ========================================================================
*
*    The contents of this file are subject to the SciTech MGL Public
*    License Version 1.0 (the "License"); you may not use this file
*    except in compliance with the License. You may obtain a copy of
*    the License at http://www.scitechsoft.com/mgl-license.txt
*
*    Software distributed under the License is distributed on an
*    "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
*    implied. See the License for the specific language governing
*    rights and limitations under the License.
*
*    The Original Code is Copyright (C) 1991-1998 SciTech Software, Inc.
*
*    The Initial Developer of the Original Code is SciTech Software, Inc.
*    All Rights Reserved.
*
*  ========================================================================
*
* Language:     ANSI C
* Environment:  Any
*
* Description:  Keyboard translation code pages for US English keyboards.
*
****************************************************************************/

#include "event.h"

/*--------------------------- Global variables ----------------------------*/

/* This table is used for all normal key translations, and is the fallback
 * table if the key is not found in any of the other translation tables.
 * If the code is not found in this table, the ASCII code is set to 0 to
 * indicate that there is no ASCII code equivalent for this key.
 */
static codepage_entry_t US_normal[] = {
    {0x01,  0x1B},
    {0x02,  '1'},
    {0x03,  '2'},
    {0x04,  '3'},
    {0x05,  '4'},
    {0x06,  '5'},
    {0x07,  '6'},
    {0x08,  '7'},
    {0x09,  '8'},
    {0x0A,  '9'},
    {0x0B,  '0'},
    {0x0C,  '-'},
    {0x0D,  '='},
    {0x0E,  0x08},
    {0x0F,  0x09},
    {0x10,  'q'},
    {0x11,  'w'},
    {0x12,  'e'},
    {0x13,  'r'},
    {0x14,  't'},
    {0x15,  'y'},
    {0x16,  'u'},
    {0x17,  'i'},
    {0x18,  'o'},
    {0x19,  'p'},
    {0x1A,  '['},
    {0x1B,  ']'},
    {0x1C,  0x0D},
    {0x1E,  'a'},
    {0x1F,  's'},
    {0x20,  'd'},
    {0x21,  'f'},
    {0x22,  'g'},
    {0x23,  'h'},
    {0x24,  'j'},
    {0x25,  'k'},
    {0x26,  'l'},
    {0x27,  ';'},
    {0x28,  '\''},
    {0x29,  '`'},
    {0x2B,  '\\'},
    {0x2C,  'z'},
    {0x2D,  'x'},
    {0x2E,  'c'},
    {0x2F,  'v'},
    {0x30,  'b'},
    {0x31,  'n'},
    {0x32,  'm'},
    {0x33,  ','},
    {0x34,  '.'},
    {0x35,  '/'},
    {0x37,  '*'},           /* Keypad */
    {0x39,  ' '},
    {0x4A,  '-'},           /* Keypad */
    {0x4E,  '+'},           /* Keypad */
    {0x60,  0x0D},          /* Keypad */
    {0x61,  '/'},           /* Keypad */
    };

/* This table is used for when CAPSLOCK is active and the shift or ctrl
 * keys are not down. If the code is not found in this table, the normal
 * table above is then searched.
 */
static codepage_entry_t US_caps[] = {
    {0x10,  'Q'},
    {0x11,  'W'},
    {0x12,  'E'},
    {0x13,  'R'},
    {0x14,  'T'},
    {0x15,  'Y'},
    {0x16,  'U'},
    {0x17,  'I'},
    {0x18,  'O'},
    {0x19,  'P'},
    {0x1E,  'A'},
    {0x1F,  'S'},
    {0x20,  'D'},
    {0x21,  'F'},
    {0x22,  'G'},
    {0x23,  'H'},
    {0x24,  'J'},
    {0x25,  'K'},
    {0x26,  'L'},
    {0x2C,  'Z'},
    {0x2D,  'X'},
    {0x2E,  'C'},
    {0x2F,  'V'},
    {0x30,  'B'},
    {0x31,  'N'},
    {0x32,  'M'},
    };

/* This table is used for when shift key is down, but the ctrl key is not
 * down and CAPSLOCK is not active. If the code is not found in this table,
 * the normal table above is then searched.
 */
static codepage_entry_t US_shift[] = {
    {0x02,  '!'},
    {0x03,  '@'},
    {0x04,  '#'},
    {0x05,  '$'},
    {0x06,  '%'},
    {0x07,  '^'},
    {0x08,  '&'},
    {0x09,  '*'},
    {0x0A,  '('},
    {0x0B,  ')'},
    {0x0C,  '_'},
    {0x0D,  '+'},
    {0x10,  'Q'},
    {0x11,  'W'},
    {0x12,  'E'},
    {0x13,  'R'},
    {0x14,  'T'},
    {0x15,  'Y'},
    {0x16,  'U'},
    {0x17,  'I'},
    {0x18,  'O'},
    {0x19,  'P'},
    {0x1A,  '{'},
    {0x1B,  '}'},
    {0x1E,  'A'},
    {0x1F,  'S'},
    {0x20,  'D'},
    {0x21,  'F'},
    {0x22,  'G'},
    {0x23,  'H'},
    {0x24,  'J'},
    {0x25,  'K'},
    {0x26,  'L'},
    {0x27,  ':'},
    {0x28,  '"'},
    {0x29,  '~'},
    {0x2B,  '|'},
    {0x2C,  'Z'},
    {0x2D,  'X'},
    {0x2E,  'C'},
    {0x2F,  'V'},
    {0x30,  'B'},
    {0x31,  'N'},
    {0x32,  'M'},
    {0x33,  '<'},
    {0x34,  '>'},
    {0x35,  '?'},
    };

/* This table is used for when CAPSLOCK is active and the shift key is
 * down, but the ctrl key is not. If the code is not found in this table,
 * the shift table above is then searched.
 */
static codepage_entry_t US_shiftCaps[] = {
    {0x10,  'q'},
    {0x11,  'w'},
    {0x12,  'e'},
    {0x13,  'r'},
    {0x14,  't'},
    {0x15,  'y'},
    {0x16,  'u'},
    {0x17,  'i'},
    {0x18,  'o'},
    {0x19,  'p'},
    {0x1E,  'a'},
    {0x1F,  's'},
    {0x20,  'd'},
    {0x21,  'f'},
    {0x22,  'g'},
    {0x23,  'h'},
    {0x24,  'j'},
    {0x25,  'k'},
    {0x26,  'l'},
    {0x2C,  'z'},
    {0x2D,  'x'},
    {0x2E,  'c'},
    {0x2F,  'v'},
    {0x30,  'b'},
    {0x31,  'n'},
    {0x32,  'm'},
    };

/* This table is used for all key translations when the ctrl key is down,
 * regardless of the state of the shift key and CAPSLOCK. If the code is
 * not found in this table, the ASCII code is set to 0 to indicate that
 * there is no ASCII code equivalent for this key.
 */
static codepage_entry_t US_ctrl[] = {
    {0x01,  0x1B},
    {0x06,  0x1E},
    {0x0C,  0x1F},
    {0x0E,  0x7F},
    {0x10,  0x11},
    {0x11,  0x17},
    {0x12,  0x05},
    {0x13,  0x12},
    {0x14,  0x14},
    {0x15,  0x19},
    {0x16,  0x16},
    {0x17,  0x09},
    {0x18,  0x0F},
    {0x19,  0x10},
    {0x1A,  0x1B},
    {0x1B,  0x1D},
    {0x1C,  0x0A},
    {0x1E,  0x01},
    {0x1F,  0x13},
    {0x20,  0x04},
    {0x21,  0x06},
    {0x22,  0x07},
    {0x23,  0x08},
    {0x24,  0x0A},
    {0x25,  0x0B},
    {0x26,  0x0C},
    {0x2B,  0x1C},
    {0x2C,  0x1A},
    {0x2D,  0x18},
    {0x2E,  0x03},
    {0x2F,  0x16},
    {0x30,  0x02},
    {0x31,  0x0E},
    {0x32,  0x0D},
    {0x39,  ' '},
    };

static codepage_entry_t US_numPad[] = {
    {0x4C,  '5'},
    {0x62,  '4'},
    {0x63,  '6'},
    {0x64,  '8'},
    {0x65,  '2'},
    {0x66,  '0'},
    {0x67,  '.'},
    {0x68,  '7'},
    {0x69,  '1'},
    {0x6A,  '9'},
    {0x6B,  '3'},
    };

codepage_t _CP_US_English = {
    "US English",
    US_normal,      EVT_ARR_SIZE(US_normal),
    US_caps,        EVT_ARR_SIZE(US_caps),
    US_shift,       EVT_ARR_SIZE(US_shift),
    US_shiftCaps,   EVT_ARR_SIZE(US_shiftCaps),
    US_ctrl,        EVT_ARR_SIZE(US_ctrl),
    US_numPad,      EVT_ARR_SIZE(US_numPad),
    };