1 /***************************************************************************
3 * ZXEmuT -- ZX Spectrum Emulator with Tcl scripting
5 * Copyright (C) 2012-2020 Ketmar Dark <ketmar@ketmar.no-ip.org>
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, version 3 of the License ONLY.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 **************************************************************************/
23 #include "zxkeyinfo.h"
26 ZXKeyInfo zxKeyInfo
[50] = {
28 {.name
="cap", .port
=0, .mask
=0x01},
29 {.name
="cs", .port
=0, .mask
=0x01},
30 {.name
="z", .port
=0, .mask
=0x02},
31 {.name
="x", .port
=0, .mask
=0x04},
32 {.name
="c", .port
=0, .mask
=0x08},
33 {.name
="v", .port
=0, .mask
=0x10},
34 {.name
="a", .port
=1, .mask
=0x01},
35 {.name
="s", .port
=1, .mask
=0x02},
36 {.name
="d", .port
=1, .mask
=0x04},
37 {.name
="f", .port
=1, .mask
=0x08},
38 {.name
="g", .port
=1, .mask
=0x10},
39 {.name
="q", .port
=2, .mask
=0x01},
40 {.name
="w", .port
=2, .mask
=0x02},
41 {.name
="e", .port
=2, .mask
=0x04},
42 {.name
="r", .port
=2, .mask
=0x08},
43 {.name
="t", .port
=2, .mask
=0x10},
44 {.name
="1", .port
=3, .mask
=0x01},
45 {.name
="2", .port
=3, .mask
=0x02},
46 {.name
="3", .port
=3, .mask
=0x04},
47 {.name
="4", .port
=3, .mask
=0x08},
48 {.name
="5", .port
=3, .mask
=0x10},
49 {.name
="0", .port
=4, .mask
=0x01},
50 {.name
="9", .port
=4, .mask
=0x02},
51 {.name
="8", .port
=4, .mask
=0x04},
52 {.name
="7", .port
=4, .mask
=0x08},
53 {.name
="6", .port
=4, .mask
=0x10},
54 {.name
="p", .port
=5, .mask
=0x01},
55 {.name
="o", .port
=5, .mask
=0x02},
56 {.name
="i", .port
=5, .mask
=0x04},
57 {.name
="u", .port
=5, .mask
=0x08},
58 {.name
="y", .port
=5, .mask
=0x10},
59 {.name
="ent", .port
=6, .mask
=0x01},
60 {.name
="enter", .port
=6, .mask
=0x01},
61 {.name
="l", .port
=6, .mask
=0x02},
62 {.name
="k", .port
=6, .mask
=0x04},
63 {.name
="j", .port
=6, .mask
=0x08},
64 {.name
="h", .port
=6, .mask
=0x10},
65 {.name
="spc", .port
=7, .mask
=0x01},
66 {.name
="space", .port
=7, .mask
=0x01},
67 {.name
="sym", .port
=7, .mask
=0x02},
68 {.name
="ss", .port
=7, .mask
=0x02},
69 {.name
="m", .port
=7, .mask
=0x04},
70 {.name
="n", .port
=7, .mask
=0x08},
71 {.name
="b", .port
=7, .mask
=0x10},
73 {.name
="kright", .port
=8, .mask
=0x01},
74 {.name
="kleft", .port
=8, .mask
=0x02},
75 {.name
="kdown", .port
=8, .mask
=0x04},
76 {.name
="kup", .port
=8, .mask
=0x08},
77 {.name
="kfire", .port
=8, .mask
=0x10},
82 int zxFindKeyByName (const char *name
) {
83 if (name
!= NULL
&& name
[0]) {
84 for (int f
= 0; zxKeyInfo
[f
].name
!= NULL
; ++f
) if (strcasecmp(zxKeyInfo
[f
].name
, name
) == 0) return f
;
90 int zxFindKeyByWord (const uint16_t w
) {
92 for (int f
= 0; zxKeyInfo
[f
].name
!= NULL
; ++f
) if (w
== ((zxKeyInfo
[f
].port
<<8)|zxKeyInfo
[f
].mask
)) return f
;