Subversion Repositories Kolibri OS

Rev

Rev 6735 | Rev 6791 | 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
inline fastcall word GetKey()  //+Gluk fix
54
{
55
		$push edx
56
GETKEY:
57
		$mov  eax,2
58
		$int  0x40
59
		$cmp eax,1
60
		$jne GETKEYI
61
		$mov ah,dh
62
		$jmp GETKEYII //jz?
63
GETKEYI:
64
		$mov dh,ah
65
		$jmp GETKEY
66
GETKEYII:
67
		$pop edx
68
		$shr eax,8
69
}
70
 
6735 leency 71
:unsigned char key_ascii;
72
:dword key_scancode, key_modifier, key_editbox;
73
:int GetKeys()
6285 leency 74
{
75
		$push edx
76
GETKEY:
77
		$mov  eax,2
78
		$int  0x40
79
		$cmp eax,1
80
		$jne GETKEYI
81
		$mov eax,edx
82
		$jmp GETKEYII
83
GETKEYI:
84
		$mov edx,eax
85
		$jmp GETKEY
86
GETKEYII:
87
		$pop edx
6640 leency 88
	key_editbox = EAX;
6285 leency 89
	key_ascii = AH;
90
	$shr  eax,16
91
	key_scancode = AL;
92
	//get alt/shift/ctrl key status
93
	$mov eax,66
94
	$mov ebx,3
95
	$int 0x40
96
	key_modifier = EAX;
6640 leency 97
	EAX = key_editbox;
6285 leency 98
}
99
 
100
#endif