Skip to content

Commit 930cc09

Browse files
author
Mikolaj Feliks
committed
Clean up keyboard control module
1 parent 5aff719 commit 930cc09

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

control.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,29 @@
1010

1111
#include "globals.h"
1212

13-
void interrupt (*old_keyboard)();
13+
void interrupt (*old_keyboard)(void);
1414

1515
void interrupt my_keyboard(void)
1616
{
17-
int key = inportb(0x60);
17+
int key;
18+
19+
key = inportb(0x60);
1820
outportb(0x20, 0x20);
19-
if (key & 0x80)
21+
22+
if (key & 0x80) {
2023
keytab[key - 0x80] = 0;
21-
else
24+
}
25+
else {
2226
keytab[key] = 1;
27+
}
2328
}
2429

2530
void init_keyboard(void)
2631
{
27-
int x;
2832
old_keyboard = getvect(9);
2933
setvect(9, my_keyboard);
30-
for (x = 0; x < 256; x++)
31-
keytab[x] = 0;
34+
35+
memset(keytab, 0, 256);
3236
}
3337

3438
void restore_keyboard(void)

0 commit comments

Comments
 (0)