Subversion Repositories Kolibri OS

Rev

Rev 6285 | Rev 6735 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
6285 leency 1
#ifndef INCLUDE_KEYBOARD_H
2
#define INCLUDE_KEYBOARD_H
3
#print "[include ]\n"
4
 
5
//ASCII KEYS
6
#define ASCII_KEY_BS    008
7
#define ASCII_KEY_TAB   009
8
#define ASCII_KEY_ENTER 013
9
#define ASCII_KEY_ESC   027
10
#define ASCII_KEY_DEL   182
11
#define ASCII_KEY_INS   185
12
#define ASCII_KEY_SPACE 032
13
 
14
#define ASCII_KEY_LEFT  176
15
#define ASCII_KEY_RIGHT 179
16
#define ASCII_KEY_DOWN  177
17
#define ASCII_KEY_UP    178
18
#define ASCII_KEY_HOME  180
19
#define ASCII_KEY_END   181
20
#define ASCII_KEY_PGDN  183
21
#define ASCII_KEY_PGUP  184
22
 
23
//SCAN CODE KEYS
24
#define SCAN_CODE_BS    014
25
#define SCAN_CODE_TAB   015
26
#define SCAN_CODE_ENTER 028
27
#define SCAN_CODE_ESC   001
28
#define SCAN_CODE_DEL   083
29
#define SCAN_CODE_INS   082
30
#define SCAN_CODE_SPACE 057
31
 
32
#define SCAN_CODE_LEFT  075
33
#define SCAN_CODE_RIGHT 077
34
#define SCAN_CODE_DOWN  080
35
#define SCAN_CODE_UP    072
36
#define SCAN_CODE_HOME  071
37
#define SCAN_CODE_END   079
38
#define SCAN_CODE_PGDN  081
39
#define SCAN_CODE_PGUP  073
40
 
41
#define KEY_LSHIFT     00000000001b
42
#define KEY_RSHIFT     00000000010b
43
#define KEY_LCTRL      00000000100b
44
#define KEY_RCTRL      00000001000b
45
#define KEY_LALT       00000010000b
46
#define KEY_RALT       00000100000b
47
#define KEY_CAPSLOCK   00001000000b
48
#define KEY_NUMLOCK    00010000000b
49
#define KEY_SCROLLLOCK 00100000000b
50
#define KEY_LWIN       01000000000b
51
#define KEY_RWIN       10000000000b
52
 
53
dword calc(EAX) { return EAX; }
54
 
55
inline fastcall word GetKey()  //+Gluk fix
56
{
57
		$push edx
58
GETKEY:
59
		$mov  eax,2
60
		$int  0x40
61
		$cmp eax,1
62
		$jne GETKEYI
63
		$mov ah,dh
64
		$jmp GETKEYII //jz?
65
GETKEYI:
66
		$mov dh,ah
67
		$jmp GETKEY
68
GETKEYII:
69
		$pop edx
70
		$shr eax,8
71
}
72
 
73
unsigned char key_ascii;
6640 leency 74
dword key_scancode, key_modifier, key_editbox;
6285 leency 75
int GetKeys()
76
{
77
		$push edx
78
GETKEY:
79
		$mov  eax,2
80
		$int  0x40
81
		$cmp eax,1
82
		$jne GETKEYI
83
		$mov eax,edx
84
		$jmp GETKEYII
85
GETKEYI:
86
		$mov edx,eax
87
		$jmp GETKEY
88
GETKEYII:
89
		$pop edx
6640 leency 90
	key_editbox = EAX;
6285 leency 91
	key_ascii = AH;
92
	$shr  eax,16
93
	key_scancode = AL;
94
	//get alt/shift/ctrl key status
95
	$mov eax,66
96
	$mov ebx,3
97
	$int 0x40
98
	key_modifier = EAX;
6640 leency 99
	EAX = key_editbox;
6285 leency 100
}
101
 
102
#endif