-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgameclav.c
executable file
·66 lines (66 loc) · 1.75 KB
/
gameclav.c
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
56
57
58
59
60
61
62
63
64
65
66
#include <DOS.H>
#include "SOURGAME/GAMECLAV.H"
void interrupt far Routine_Clavier_Interruption (void);
void (interrupt far *Ancienne_Interruption_Clavier)(void);
char bktouche;
char codetouche;
char actiontouche [128];
char bufferfleche [2][128];
void interrupt far Routine_Clavier_Interruption (void)
{
register char x;
codetouche = inp (0x60);
x = inp (0x61);
(void)outp (0x61,(x | 0x80));
(void)outp (0x61,x);
(void)outp (0x20,0x20);
actiontouche[codetouche & 127] = 1;
if (codetouche & 128)
{
actiontouche[codetouche & 127] = 0;
codetouche = 0;
}
}
void far Installer_Clavier_Interruption (void)
{
OCTET cptbuf;
for (cptbuf = 0;
cptbuf < 128;
cptbuf++)
bufferfleche [0][cptbuf] = 0;
for (cptbuf = 0;
cptbuf < 128;
cptbuf++)
bufferfleche [1][cptbuf] = 0;
bufferfleche [1][FLECHE_DROITE] =1;
bufferfleche [1][FLECHE_GAUCHE] =2;
bufferfleche [1][FLECHE_BAS ] =3;
bufferfleche [1][FLECHE_HAUT ] =4;
Ancienne_Interruption_Clavier = getvect (CLAVIER_INTERRUPTION);
setvect (CLAVIER_INTERRUPTION,Routine_Clavier_Interruption);
}
void far Desinstaller_Clavier_Interruption (void)
{
disable ();
setvect (CLAVIER_INTERRUPTION,
Ancienne_Interruption_Clavier);
enable ();
}
char far Lire_Code_Touche (void)
{
return (codetouche);
}
char far Lire_Action_Touche (char touche)
{
return (actiontouche[touche]);
}
char far Lire_Direction_Touche (void)
{
if (actiontouche [bktouche] == 0) bktouche = 0;
if (actiontouche[codetouche] == 1)
{
if (codetouche == bktouche) return (0);
else bktouche = codetouche;
}
return (bufferfleche [ actiontouche [codetouche] ] [ codetouche ]);
}