1 /* $NetBSD: wskbdmap_atari.c,v 1.3 2005/12/11 12:16:54 christos Exp $ */
4 * Copyright (c) 1997 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Juergen Hannken-Illjes.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
32 #include <sys/cdefs.h>
33 __KERNEL_RCSID(0, "$NetBSD: wskbdmap_atari.c,v 1.3 2005/12/11 12:16:54 christos Exp $");
35 #include <sys/types.h>
36 #include <dev/wscons/wsksymdef.h>
37 #include <dev/wscons/wsksymvar.h>
39 #define KC(n) KS_KEYCODE(n)
41 static const keysym_t atarikbd_keydesc_us
[] = {
42 /* pos command normal shifted */
43 KC(1), KS_Cmd_Debugger
, KS_Escape
,
44 KC(2), KS_1
, KS_exclam
,
46 KC(4), KS_3
, KS_numbersign
,
47 KC(5), KS_4
, KS_dollar
,
48 KC(6), KS_5
, KS_percent
,
49 KC(7), KS_6
, KS_asciicircum
,
50 KC(8), KS_7
, KS_ampersand
,
51 KC(9), KS_8
, KS_asterisk
,
52 KC(10), KS_9
, KS_parenleft
,
53 KC(11), KS_0
, KS_parenright
,
54 KC(12), KS_minus
, KS_underscore
,
55 KC(13), KS_equal
, KS_plus
,
56 KC(14), KS_Cmd_ResetEmul
, KS_Delete
,
68 KC(26), KS_bracketleft
, KS_braceleft
,
69 KC(27), KS_bracketright
, KS_braceright
,
71 KC(29), KS_Cmd1
, KS_Control_L
,
81 KC(39), KS_semicolon
, KS_colon
,
82 KC(40), KS_apostrophe
, KS_quotedbl
,
83 KC(41), KS_grave
, KS_asciitilde
,
85 KC(43), KS_backslash
, KS_bar
,
93 KC(51), KS_comma
, KS_less
,
94 KC(52), KS_period
, KS_greater
,
95 KC(53), KS_slash
, KS_question
,
97 KC(56), KS_Cmd2
, KS_Alt_L
,
100 KC(59), KS_Cmd_Screen0
, KS_f1
,
101 KC(60), KS_Cmd_Screen1
, KS_f2
,
102 KC(61), KS_Cmd_Screen2
, KS_f3
,
103 KC(62), KS_Cmd_Screen3
, KS_f4
,
104 KC(63), KS_Cmd_Screen4
, KS_f5
,
105 KC(64), KS_Cmd_Screen5
, KS_f6
,
106 KC(65), KS_Cmd_Screen6
, KS_f7
,
107 KC(66), KS_Cmd_Screen7
, KS_f8
,
108 KC(67), KS_Cmd_Screen8
, KS_f9
,
109 KC(68), KS_Cmd_Screen9
, KS_f10
,
111 KC(72), KS_KP_Up
, KS_KP_8
,
112 KC(74), KS_KP_Subtract
,
113 KC(75), KS_KP_Left
, KS_KP_4
,
114 KC(77), KS_KP_Right
, KS_KP_6
,
116 KC(80), KS_KP_Down
, KS_KP_2
,
117 KC(82), KS_KP_Insert
, KS_KP_0
,
118 KC(83), KS_KP_Delete
, KS_KP_Decimal
,
119 KC(97), KS_Pause
, /* should be KS_Help. but this is not available */
121 KC(99), KS_parenleft
, /* should be KS_KP_parenleft */
122 KC(100), KS_parenright
, /* should be KS_KP_parenright */
123 KC(101), KS_slash
, /* should be KS_KP_slash */
124 KC(102), KS_KP_Multiply
,
135 KC(113), KS_KP_Decimal
,
136 KC(114), KS_KP_Enter
,
139 static const keysym_t atarikbd_keydesc_de
[] = {
140 /* pos normal shifted altgr shift-altgr */
141 KC(3), KS_2
, KS_quotedbl
,
142 KC(4), KS_3
, KS_section
,
143 KC(7), KS_6
, KS_ampersand
,
144 KC(8), KS_7
, KS_slash
,
145 KC(9), KS_8
, KS_parenleft
,
146 KC(10), KS_9
, KS_parenright
,
147 KC(11), KS_0
, KS_equal
,
148 KC(12), KS_ssharp
, KS_question
,
149 KC(13), KS_dead_acute
, KS_dead_grave
,
152 KC(26), KS_udiaeresis
, KS_Udiaeresis
, KS_at
, KS_backslash
,
153 KC(27), KS_plus
, KS_asterisk
,
154 KC(39), KS_odiaeresis
, KS_Odiaeresis
, KS_bracketleft
, KS_braceleft
,
155 KC(40), KS_adiaeresis
, KS_Adiaeresis
, KS_bracketright
,KS_braceright
,
156 KC(41), KS_numbersign
, KS_dead_circumflex
,
157 KC(43), KS_dead_tilde
, KS_bar
,
159 KC(51), KS_comma
, KS_semicolon
,
160 KC(52), KS_period
, KS_colon
,
161 KC(53), KS_minus
, KS_underscore
,
162 KC(56), KS_Mode_switch
, KS_Multi_key
,
163 KC(96), KS_less
, KS_greater
,
166 static const keysym_t atarikbd_keydesc_de_nodead
[] = {
167 /* pos normal shifted altgr shift-altgr */
168 KC(13), KS_apostrophe
, KS_grave
,
169 KC(41), KS_numbersign
, KS_asciicircum
,
170 KC(43), KS_asciitilde
, KS_bar
,
173 static const keysym_t atarikbd_keydesc_dk
[] = {
174 /* pos normal shifted altgr shift-altgr */
175 KC(3), KS_2
, KS_quotedbl
, KS_at
,
176 KC(4), KS_3
, KS_numbersign
, KS_sterling
,
177 KC(5), KS_4
, KS_currency
, KS_dollar
,
178 KC(7), KS_6
, KS_ampersand
,
179 KC(8), KS_7
, KS_slash
, KS_braceleft
,
180 KC(9), KS_8
, KS_parenleft
, KS_bracketleft
,
181 KC(10), KS_9
, KS_parenright
, KS_bracketright
,
182 KC(11), KS_0
, KS_equal
, KS_braceright
,
183 KC(12), KS_plus
, KS_question
,
184 KC(13), KS_dead_acute
, KS_dead_grave
, KS_bar
,
186 KC(27), KS_dead_diaeresis
, KS_dead_circumflex
, KS_dead_tilde
,
189 KC(41), KS_onehalf
, KS_paragraph
,
190 KC(43), KS_apostrophe
, KS_asterisk
,
191 KC(51), KS_comma
, KS_semicolon
,
192 KC(52), KS_period
, KS_colon
,
193 KC(53), KS_minus
, KS_underscore
,
194 KC(86), KS_less
, KS_greater
, KS_backslash
,
195 KC(184), KS_Mode_switch
, KS_Multi_key
,
198 static const keysym_t atarikbd_keydesc_dk_nodead
[] = {
199 /* pos normal shifted altgr shift-altgr */
200 KC(13), KS_apostrophe
, KS_grave
, KS_bar
,
201 KC(27), KS_diaeresis
, KS_asciicircum
, KS_asciitilde
,
204 static const keysym_t atarikbd_keydesc_sv
[] = {
205 /* pos normal shifted altgr shift-altgr */
206 KC(12), KS_plus
, KS_question
, KS_backslash
,
207 KC(27), KS_dead_diaeresis
, KS_dead_circumflex
, KS_dead_tilde
,
208 KC(39), KS_odiaeresis
,
209 KC(40), KS_adiaeresis
,
210 KC(41), KS_paragraph
, KS_onehalf
,
211 KC(86), KS_less
, KS_greater
, KS_bar
,
212 KC(184), KS_Mode_switch
, KS_Multi_key
,
215 static const keysym_t atarikbd_keydesc_sv_nodead
[] = {
216 /* pos normal shifted altgr shift-altgr */
217 KC(13), KS_apostrophe
, KS_grave
, KS_bar
,
218 KC(27), KS_diaeresis
, KS_asciicircum
, KS_asciitilde
,
221 static const keysym_t atarikbd_keydesc_no
[] = {
222 /* pos normal shifted altgr shift-altgr */
223 KC(13), KS_backslash
, KS_dead_grave
, KS_dead_acute
,
224 KC(27), KS_dead_diaeresis
, KS_dead_circumflex
, KS_dead_tilde
,
227 KC(41), KS_bar
, KS_paragraph
,
228 KC(86), KS_less
, KS_greater
,
231 static const keysym_t atarikbd_keydesc_no_nodead
[] = {
232 /* pos normal shifted altgr shift-altgr */
233 KC(13), KS_backslash
, KS_grave
, KS_acute
,
234 KC(27), KS_diaeresis
, KS_asciicircum
, KS_asciitilde
,
237 static const keysym_t atarikbd_keydesc_fr
[] = {
238 /* pos normal shifted altgr shift-altgr */
239 KC(2), KS_ampersand
, KS_1
,
240 KC(3), KS_eacute
, KS_2
, KS_asciitilde
,
241 KC(4), KS_quotedbl
, KS_3
, KS_numbersign
,
242 KC(5), KS_apostrophe
, KS_4
, KS_braceleft
,
243 KC(6), KS_parenleft
, KS_5
, KS_bracketleft
,
244 KC(7), KS_minus
, KS_6
, KS_bar
,
245 KC(8), KS_egrave
, KS_7
, KS_grave
,
246 KC(9), KS_underscore
, KS_8
, KS_backslash
,
247 KC(10), KS_ccedilla
, KS_9
, KS_asciicircum
,
248 KC(11), KS_agrave
, KS_0
, KS_at
,
249 KC(12), KS_parenright
, KS_degree
, KS_bracketright
,
250 KC(13), KS_equal
, KS_plus
, KS_braceright
,
253 KC(26), KS_dead_circumflex
, KS_dead_diaeresis
,
254 KC(27), KS_dollar
, KS_sterling
, KS_currency
,
257 KC(40), KS_ugrave
, KS_percent
,
258 KC(41), KS_twosuperior
, KS_asciitilde
,
259 KC(43), KS_asterisk
, KS_mu
,
261 KC(50), KS_comma
, KS_question
,
262 KC(51), KS_semicolon
, KS_period
,
263 KC(52), KS_colon
, KS_slash
,
264 KC(53), KS_exclam
, KS_section
,
265 KC(86), KS_less
, KS_greater
,
266 KC(184), KS_Mode_switch
, KS_Multi_key
,
269 static const keysym_t atarikbd_keydesc_it
[] = {
270 /* pos normal shifted altgr shift-altgr */
271 KC(3), KS_2
, KS_quotedbl
, KS_twosuperior
,
272 KC(4), KS_3
, KS_sterling
, KS_threesuperior
,
273 KC(5), KS_4
, KS_dollar
,
274 KC(6), KS_5
, KS_percent
,
275 KC(7), KS_6
, KS_ampersand
,
276 KC(8), KS_7
, KS_slash
,
277 KC(9), KS_8
, KS_parenleft
,
278 KC(10), KS_9
, KS_parenright
,
279 KC(11), KS_0
, KS_equal
,
280 KC(12), KS_apostrophe
, KS_question
,
281 KC(13), KS_igrave
, KS_asciicircum
,
282 KC(26), KS_egrave
, KS_eacute
, KS_braceleft
, KS_bracketleft
,
283 KC(27), KS_plus
, KS_asterisk
, KS_braceright
, KS_bracketright
,
284 KC(39), KS_ograve
, KS_Ccedilla
, KS_at
,
285 KC(40), KS_agrave
, KS_degree
, KS_numbersign
,
286 KC(41), KS_backslash
, KS_bar
,
287 KC(43), KS_ugrave
, KS_section
,
288 KC(51), KS_comma
, KS_semicolon
,
289 KC(52), KS_period
, KS_colon
,
290 KC(53), KS_minus
, KS_underscore
,
291 KC(86), KS_less
, KS_greater
,
292 KC(184), KS_Mode_switch
, KS_Multi_key
,
295 static const keysym_t atarikbd_keydesc_uk
[] = {
296 /* pos normal shifted altgr shift-altgr */
297 KC(2), KS_1
, KS_exclam
, KS_plusminus
, KS_exclamdown
,
298 KC(3), KS_2
, KS_quotedbl
, KS_twosuperior
, KS_cent
,
299 KC(4), KS_3
, KS_sterling
, KS_threesuperior
,
300 KC(5), KS_4
, KS_dollar
, KS_acute
, KS_currency
,
301 KC(6), KS_5
, KS_percent
, KS_mu
, KS_yen
,
302 KC(7), KS_6
, KS_asciicircum
, KS_paragraph
,
303 KC(8), KS_7
, KS_ampersand
, KS_periodcentered
, KS_brokenbar
,
304 KC(9), KS_8
, KS_asterisk
, KS_cedilla
, KS_ordfeminine
,
305 KC(10), KS_9
, KS_parenleft
, KS_onesuperior
, KS_diaeresis
,
306 KC(11), KS_0
, KS_parenright
, KS_masculine
, KS_copyright
,
307 KC(12), KS_minus
, KS_underscore
, KS_hyphen
, KS_ssharp
,
308 KC(13), KS_equal
, KS_plus
, KS_onehalf
, KS_guillemotleft
,
309 KC(40), KS_apostrophe
, KS_at
, KS_section
, KS_Agrave
,
310 KC(41), KS_grave
, KS_grave
, KS_agrave
, KS_agrave
,
311 KC(43), KS_numbersign
, KS_asciitilde
, KS_sterling
, KS_thorn
,
312 KC(86), KS_backslash
, KS_bar
, KS_Udiaeresis
,
315 static const keysym_t atarikbd_keydesc_jp
[] = {
316 /* pos normal shifted altgr shift-altgr */
317 KC(3), KS_2
, KS_quotedbl
,
318 KC(7), KS_6
, KS_ampersand
,
319 KC(8), KS_7
, KS_apostrophe
,
320 KC(9), KS_8
, KS_parenleft
,
321 KC(10), KS_9
, KS_parenright
,
323 KC(12), KS_minus
, KS_equal
,
324 KC(13), KS_asciicircum
, KS_asciitilde
,
325 KC(26), KS_at
, KS_grave
,
326 KC(27), KS_bracketleft
, KS_braceleft
,
327 KC(39), KS_semicolon
, KS_plus
,
328 KC(40), KS_colon
, KS_asterisk
,
329 KC(41), KS_Zenkaku_Hankaku
, /* replace grave/tilde */
330 KC(43), KS_bracketright
, KS_braceright
,
331 KC(112), KS_Hiragana_Katakana
,
332 KC(115), KS_backslash
, KS_underscore
,
334 KC(123), KS_Muhenkan
,
335 KC(125), KS_backslash
, KS_bar
,
338 static const keysym_t atarikbd_keydesc_es
[] = {
339 /* pos normal shifted altgr shift-altgr */
340 KC(2), KS_1
, KS_exclam
, KS_bar
,
341 KC(3), KS_2
, KS_quotedbl
, KS_at
,
342 KC(4), KS_3
, KS_periodcentered
, KS_numbersign
,
343 KC(5), KS_4
, KS_dollar
, KS_asciitilde
,
344 KC(7), KS_6
, KS_ampersand
,
345 KC(8), KS_7
, KS_slash
,
346 KC(9), KS_8
, KS_parenleft
,
347 KC(10), KS_9
, KS_parenright
,
348 KC(11), KS_0
, KS_equal
,
349 KC(12), KS_apostrophe
, KS_question
,
350 KC(13), KS_exclamdown
, KS_questiondown
,
351 KC(26), KS_dead_grave
, KS_dead_circumflex
, KS_bracketleft
,
352 KC(27), KS_plus
, KS_asterisk
, KS_bracketright
,
354 KC(40), KS_dead_acute
, KS_dead_diaeresis
, KS_braceleft
,
355 KC(41), KS_degree
, KS_ordfeminine
, KS_backslash
,
356 KC(43), KS_ccedilla
, KS_Ccedilla
, KS_braceright
,
357 KC(51), KS_comma
, KS_semicolon
,
358 KC(52), KS_period
, KS_colon
,
359 KC(53), KS_minus
, KS_underscore
,
360 KC(86), KS_less
, KS_greater
,
361 KC(184), KS_Mode_switch
, KS_Multi_key
,
364 static const keysym_t atarikbd_keydesc_us_declk
[] = {
365 /* pos normal shifted altgr shift-altgr */
366 KC(1), KS_grave
, KS_asciitilde
, /* replace escape */
367 KC(41), KS_less
, KS_greater
, /* replace grave/tilde */
368 KC(143), KS_Multi_key
, /* left compose */
369 KC(157), KS_Multi_key
, /* right compose, replace right control */
370 KC(87), KS_Cmd_Debugger
, KS_Escape
, /* replace F11 */
377 KC(70), KS_f19
, /* replace scroll lock */
378 KC(127), KS_f20
, /* replace break */
379 KC(69), KS_KP_F1
, /* replace num lock */
380 KC(181), KS_KP_F2
, /* replace divide */
381 KC(55), KS_KP_F3
, /* replace multiply */
382 KC(74), KS_KP_F4
, /* replace subtract */
384 /* keypad is numbers only - no num lock */
395 KC(83), KS_KP_Decimal
,
397 KC(206), KS_KP_Subtract
,
398 KC(78), KS_KP_Separator
, /* replace add */
399 KC(199), KS_Find
, /* replace home */
400 KC(207), KS_Select
, /* replace end */
403 static const keysym_t atarikbd_keydesc_us_dvorak
[] = {
404 /* pos command normal shifted */
405 KC(12), KS_bracketleft
, KS_braceleft
,
406 KC(13), KS_bracketright
, KS_braceright
,
407 KC(16), KS_apostrophe
, KS_quotedbl
,
408 KC(17), KS_comma
, KS_less
,
409 KC(18), KS_period
, KS_greater
,
417 KC(26), KS_slash
, KS_question
,
418 KC(27), KS_equal
, KS_plus
,
428 KC(40), KS_minus
, KS_underscore
,
429 KC(44), KS_semicolon
, KS_colon
,
440 static const keysym_t atarikbd_keydesc_swapctrlcaps
[] = {
441 /* pos command normal shifted */
442 KC(29), KS_Caps_Lock
,
443 KC(58), KS_Cmd1
, KS_Control_L
,
446 static const keysym_t atarikbd_keydesc_iopener
[] = {
447 /* pos command normal shifted */
448 KC(59), KS_Cmd_Debugger
, KS_Escape
,
449 KC(60), KS_Cmd_Screen0
, KS_f1
,
450 KC(61), KS_Cmd_Screen1
, KS_f2
,
451 KC(62), KS_Cmd_Screen2
, KS_f3
,
452 KC(63), KS_Cmd_Screen3
, KS_f4
,
453 KC(64), KS_Cmd_Screen4
, KS_f5
,
454 KC(65), KS_Cmd_Screen5
, KS_f6
,
455 KC(66), KS_Cmd_Screen6
, KS_f7
,
456 KC(67), KS_Cmd_Screen7
, KS_f8
,
457 KC(68), KS_Cmd_Screen8
, KS_f9
,
458 KC(87), KS_Cmd_Screen9
, KS_f10
,
462 #define KBD_MAP(name, base, map) \
463 { name, base, sizeof(map)/sizeof(keysym_t), map }
464 /* KBD_NULLMAP generates a entry for machine native variant.
465 the entry will be modified by machine dependent keyboard driver. */
466 #define KBD_NULLMAP(name, base) { name, base, 0, 0 }
468 const struct wscons_keydesc atarikbd_keydesctab
[] = {
469 KBD_MAP(KB_US
, 0, atarikbd_keydesc_us
),
470 KBD_MAP(KB_DE
, KB_US
, atarikbd_keydesc_de
),
471 KBD_MAP(KB_DE
| KB_NODEAD
, KB_DE
, atarikbd_keydesc_de_nodead
),
472 KBD_MAP(KB_FR
, KB_US
, atarikbd_keydesc_fr
),
473 KBD_MAP(KB_DK
, KB_US
, atarikbd_keydesc_dk
),
474 KBD_MAP(KB_DK
| KB_NODEAD
, KB_DK
, atarikbd_keydesc_dk_nodead
),
475 KBD_MAP(KB_IT
, KB_US
, atarikbd_keydesc_it
),
476 KBD_MAP(KB_UK
, KB_US
, atarikbd_keydesc_uk
),
477 KBD_MAP(KB_JP
, KB_US
, atarikbd_keydesc_jp
),
478 KBD_MAP(KB_SV
, KB_DK
, atarikbd_keydesc_sv
),
479 KBD_MAP(KB_SV
| KB_NODEAD
, KB_SV
, atarikbd_keydesc_sv_nodead
),
480 KBD_MAP(KB_NO
, KB_DK
, atarikbd_keydesc_no
),
481 KBD_MAP(KB_NO
| KB_NODEAD
, KB_NO
, atarikbd_keydesc_no_nodead
),
482 KBD_MAP(KB_US
| KB_DECLK
, KB_US
, atarikbd_keydesc_us_declk
),
483 KBD_MAP(KB_US
| KB_DVORAK
, KB_US
, atarikbd_keydesc_us_dvorak
),
484 KBD_MAP(KB_US
| KB_SWAPCTRLCAPS
, KB_US
, atarikbd_keydesc_swapctrlcaps
),
485 KBD_MAP(KB_US
| KB_IOPENER
, KB_US
, atarikbd_keydesc_iopener
),
486 KBD_MAP(KB_JP
| KB_SWAPCTRLCAPS
, KB_JP
, atarikbd_keydesc_swapctrlcaps
),
487 KBD_MAP(KB_FR
| KB_SWAPCTRLCAPS
, KB_FR
, atarikbd_keydesc_swapctrlcaps
),
488 KBD_MAP(KB_US
| KB_DVORAK
| KB_SWAPCTRLCAPS
, KB_US
| KB_DVORAK
,
489 atarikbd_keydesc_swapctrlcaps
),
490 KBD_MAP(KB_US
| KB_IOPENER
| KB_SWAPCTRLCAPS
, KB_US
| KB_IOPENER
,
491 atarikbd_keydesc_swapctrlcaps
),
492 KBD_MAP(KB_ES
, KB_US
, atarikbd_keydesc_es
),
493 KBD_NULLMAP(KB_US
| KB_MACHDEP
, KB_US
),
494 KBD_NULLMAP(KB_JP
| KB_MACHDEP
, KB_JP
),
495 KBD_NULLMAP(KB_US
| KB_MACHDEP
| KB_SWAPCTRLCAPS
,
496 KB_US
| KB_SWAPCTRLCAPS
),
497 KBD_NULLMAP(KB_JP
| KB_MACHDEP
| KB_SWAPCTRLCAPS
,
498 KB_JP
| KB_SWAPCTRLCAPS
),