-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.c
More file actions
56 lines (48 loc) · 1.81 KB
/
main.c
File metadata and controls
56 lines (48 loc) · 1.81 KB
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
// --------------------------------------
// Single Row Keyboard Read
// --------------------------------------
// (c) 2010-2020 Defence Force
// Authors: Twilighte, Chema and Dbug
// --------------------------------------
// This code is provided as-is:
// We do not assume any responsability concerning the fact this is a bug-free software !!!
// You can use this example code without any limitation, but if you do, it would be nice
// if you could mention the origin somewhere and inform us :)
// --------------------------------------
// For more information, please contact us on internet:
// e-mail: mike@defence-force.org
// URL: http://www.defence-force.org
// --------------------------------------
// Note: This text was typed with a Win32 editor. So perhaps the text will not be
// displayed correctly with other OS.
#include <stdio.h>
#include "defines.h"
// Initialization of ISR
extern void InitIRQ();
extern unsigned char gKey; // One bit per key pressed
void main()
{
cls();
printf("Single Row Keyboard Read demo program\n");
printf("Left Arrow\n");
printf("Right Arrow\n");
printf("Up Arrow\n");
printf("Down Arrow\n");
printf("Space\n");
printf("Left Shift\n");
printf("< ,\n");
printf("> .\n");
InitIRQ();
while (1)
{
poke(0xbb80+40*2,(gKey & KEY_LEFT_ARROW)?16+1:16+2);
poke(0xbb80+40*3,(gKey & KEY_RIGHT_ARROW)?16+1:16+2);
poke(0xbb80+40*4,(gKey & KEY_UP_ARROW)?16+1:16+2);
poke(0xbb80+40*5,(gKey & KEY_DOWN_ARROW)?16+1:16+2);
poke(0xbb80+40*6,(gKey & KEY_SPACE)?16+1:16+2);
poke(0xbb80+40*7,(gKey & KEY_LEFT_SHIFT)?16+1:16+2);
poke(0xbb80+40*8,(gKey & KEY_LESS_THAN)?16+1:16+2);
poke(0xbb80+40*9,(gKey & KEY_GREATER_THAN)?16+1:16+2);
sprintf((char *)(0xbb80+40*10),"%c gKey=%u ",16+4,gKey);
}
}