88 {
89
93
94
95 unsigned code;
96
97
98 bool release;
99
100
102
103
105 if (code == 0xe0)
107
108
109
110 release = (code & 0x80) != 0;
111 code &= ~0x80u;
112
113
114 if (code == 0x3a) {
115
116 if (!release)
121
122 if (!release) {
123
124
125 if (ctrl && c >= 0x40 && c < 0x60) {
126
127 c -= 0x40;
130
131
132
133
134 if (alt)
135 c += 0x80;
136
137
141 }
142 }
143 } else {
144
145 struct shift_key {
146 unsigned scancode;
147 bool *state_var;
148 };
149
150
151 static const struct shift_key shift_keys[] = {
159 };
160
161 const struct shift_key *key;
162
163
164 for (key = shift_keys; key->scancode != 0; key++)
165 if (key->scancode == code) {
166 *key->state_var = !release;
167 break;
168 }
169 }
170}
static int tolower(int c)
Definition: ctype.h:25
static uint8_t inb(uint16_t port)
Definition: io.h:49
static bool left_ctrl
Definition: kbd.c:17
static bool right_shift
Definition: kbd.c:15
static bool map_key(const struct keymap[], unsigned scancode, uint8_t *)
Definition: kbd.c:177
static const struct keymap unshifted_keymap[]
Definition: kbd.c:65
static bool caps_lock
Definition: kbd.c:21
static bool left_shift
Definition: kbd.c:15
#define DATA_REG
Definition: kbd.c:11
static const struct keymap invariant_keymap[]
Definition: kbd.c:51
static bool right_ctrl
Definition: kbd.c:17
static bool left_alt
Definition: kbd.c:16
static const struct keymap shifted_keymap[]
Definition: kbd.c:76
static bool right_alt
Definition: kbd.c:16
#define NULL
Definition: stddef.h:4
unsigned char uint8_t
Definition: stdint.h:20