-
Notifications
You must be signed in to change notification settings - Fork 1
/
input.inc
63 lines (50 loc) · 1.33 KB
/
input.inc
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
;useless .. but keep it for now
ShowMouse MACRO
mov ax , 1
int 33h
ENDM
HideMouse MACRO
mov ax , 2
int 33h
ENDM
AddKeyHandler MACRO key_scan , func
mov CH , key_scan
mov CURRENT_KEY_SCAN_CODE , CH
mov ax , OFFSET func
mov cx , cs
mov CURRENT_FUNC_A0 , AL
mov CURRENT_FUNC_A1 , AH
mov CURRENT_FUNC_A2 , CL
mov CURRENT_FUNC_A3 , CH
call int_add_key_handler
ENDM
AddGlobalKeyHandler MACRO func
mov ax , OFFSET func
mov cx , cs
mov CURRENT_FUNC_A0 , AL
mov CURRENT_FUNC_A1 , AH
mov CURRENT_FUNC_A2 , CL
mov CURRENT_FUNC_A3 , CH
call int_add_global_key_handler
ENDM
UpdateInputs MACRO
call int_update_inputs
ENDM
ClearAllInputHandlers MACRO
mov KEY_HANDERLS_LIST_SIZE , 0
mov GLOBAL_HANDERLS_LIST_SIZE , 0
mov CANCEL_EVENT , 1 ; if we cleared then this event is canseled to prevent any errors
ENDM
EXTRN int_fire_key_event:FAR
EXTRN int_add_key_handler:FAR
EXTRN int_add_global_key_handler:FAR
EXTRN int_update_inputs:FAR
EXTRN CURRENT_KEY_ASCII:BYTE
EXTRN CANCEL_EVENT:BYTE
EXTRN CURRENT_KEY_SCAN_CODE:BYTE
EXTRN CURRENT_FUNC_A0:BYTE
EXTRN CURRENT_FUNC_A1:BYTE
EXTRN CURRENT_FUNC_A2:BYTE
EXTRN CURRENT_FUNC_A3:BYTE
EXTRN KEY_HANDERLS_LIST_SIZE:WORD
EXTRN GLOBAL_HANDERLS_LIST_SIZE:WORD