-
Notifications
You must be signed in to change notification settings - Fork 1
/
KEYS.CPP
60 lines (49 loc) · 910 Bytes
/
KEYS.CPP
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
#include <stdlib.h>
#include <stdio.h>
#include <dos.h>
#include "keys.h"
//void chkey(char butt);
//void interrupt NewInt9(...);
void far (*mainkey)(unsigned char);
void chkey(unsigned char butt) {
//printf("‘ª ª®¤: %d\n",butt);
//return;
}
void Keys::on(void) {
if ( newfunc!=NULL ) {
setvect(0x09, newfunc); /* ãáâ ®¢ë© ¢¥ªâ®à ¯à¥à */
}
}
void Keys::off(void) {
if ( oldfunc!=NULL ) {
setvect(0x09, oldfunc); /* ãáâ ®¢ë© ¢¥ªâ®à ¯à¥à */
}
}
void Keys::set(void far (*prog)(unsigned char)) {
asm cli;
mainkey=prog;
asm sti;
return;
}
void interrupt NewInt9(...) {
char butt;
asm {
cli
in al,60h ;áç¨â ¥¬ ¢¢¥¤¥ë© ᨬ¢®«
mov butt,al
in al,61h ;¨¨æ¨ «¨§ æ¨ï ª« ¢¨ âãàë
mov ah,al
or al,80h
out 61h,al
mov al,ah
out 61h,al
sti
}
(*mainkey)(butt); //¢ë§®¯ ¯/¯ ®¡à ¡®âª¨ ª« ¢¨è¨
asm { ;ª®¥æ ¯à¥àë¢ ¨ï
mov al,20h
out 20h,al
}
return;
}