Rev 9828 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 9828 | Rev 9911 | ||
---|---|---|---|
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
2 | ;; ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;; |
4 | ;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;; |
4 | ;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;; |
5 | ;; Distributed under terms of the GNU General Public License ;; |
5 | ;; Distributed under terms of the GNU General Public License ;; |
6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
7 | 7 | ||
8 | $Revision: 9828 $ |
8 | $Revision: 9911 $ |
9 | 9 | ||
10 | 10 | ||
11 | VKEY_LSHIFT = 00000000_00000001b |
11 | VKEY_LSHIFT = 00000000_00000001b |
12 | VKEY_RSHIFT = 00000000_00000010b |
12 | VKEY_RSHIFT = 00000000_00000010b |
13 | VKEY_LCONTROL = 00000000_00000100b |
13 | VKEY_LCONTROL = 00000000_00000100b |
14 | VKEY_RCONTROL = 00000000_00001000b |
14 | VKEY_RCONTROL = 00000000_00001000b |
15 | VKEY_LALT = 00000000_00010000b |
15 | VKEY_LALT = 00000000_00010000b |
16 | VKEY_RALT = 00000000_00100000b |
16 | VKEY_RALT = 00000000_00100000b |
17 | VKEY_CAPSLOCK = 00000000_01000000b |
17 | VKEY_CAPSLOCK = 00000000_01000000b |
18 | VKEY_NUMLOCK = 00000000_10000000b |
18 | VKEY_NUMLOCK = 00000000_10000000b |
19 | VKEY_SCRLOCK = 00000001_00000000b |
19 | VKEY_SCRLOCK = 00000001_00000000b |
20 | VKEY_LWIN = 00000010_00000000b |
20 | VKEY_LWIN = 00000010_00000000b |
21 | VKEY_RWIN = 00000100_00000000b |
21 | VKEY_RWIN = 00000100_00000000b |
22 | 22 | ||
23 | VKEY_SHIFT = VKEY_LSHIFT + VKEY_RSHIFT |
23 | VKEY_SHIFT = VKEY_LSHIFT + VKEY_RSHIFT |
24 | VKEY_CONTROL = VKEY_LCONTROL + VKEY_RCONTROL |
24 | VKEY_CONTROL = VKEY_LCONTROL + VKEY_RCONTROL |
25 | VKEY_ALT = VKEY_LALT + VKEY_RALT |
25 | VKEY_ALT = VKEY_LALT + VKEY_RALT |
26 | 26 | ||
27 | uglobal |
27 | uglobal |
28 | align 4 |
28 | align 4 |
29 | kb_state dd 0 |
29 | kb_state dd 0 |
30 | ext_code db 0 |
30 | ext_code db 0 |
31 | 31 | ||
32 | keyboard_mode db 0 |
32 | keyboard_mode db 0 |
33 | keyboard_data db 0 |
33 | keyboard_data db 0 |
34 | 34 | ||
35 | altmouseb db 0 |
35 | altmouseb db 0 |
36 | ctrl_alt_del db 0 |
36 | ctrl_alt_del db 0 |
37 | 37 | ||
38 | kb_lights db 0 |
38 | kb_lights db 0 |
39 | old_kb_lights db 0 |
39 | old_kb_lights db 0 |
40 | 40 | ||
41 | align 4 |
41 | align 4 |
42 | hotkey_scancodes rd 256 ; we have 256 scancodes |
42 | hotkey_scancodes rd 256 ; we have 256 scancodes |
43 | hotkey_list rd 256*4 ; max 256 defined hotkeys |
43 | hotkey_list rd 256*4 ; max 256 defined hotkeys |
44 | hotkey_buffer rd 120*2 ; buffer for 120 hotkeys |
44 | hotkey_buffer rd 120*2 ; buffer for 120 hotkeys |
45 | endg |
45 | endg |
46 | 46 | ||
47 | iglobal |
47 | iglobal |
48 | hotkey_tests dd hotkey_test0 |
48 | hotkey_tests dd hotkey_test0 |
49 | dd hotkey_test1 |
49 | dd hotkey_test1 |
50 | dd hotkey_test2 |
50 | dd hotkey_test2 |
51 | dd hotkey_test3 |
51 | dd hotkey_test3 |
52 | dd hotkey_test4 |
52 | dd hotkey_test4 |
53 | hotkey_tests_num = 5 |
53 | hotkey_tests_num = 5 |
54 | endg |
54 | endg |
55 | ;--------------------------------------------------------------------- |
55 | ;--------------------------------------------------------------------- |
56 | hotkey_test0: |
56 | hotkey_test0: |
57 | test al, al |
57 | test al, al |
58 | setz al |
58 | setz al |
59 | ret |
59 | ret |
60 | ;--------------------------------------------------------------------- |
60 | ;--------------------------------------------------------------------- |
61 | hotkey_test1: |
61 | hotkey_test1: |
62 | test al, al |
62 | test al, al |
63 | setnp al |
63 | setnp al |
64 | ret |
64 | ret |
65 | ;--------------------------------------------------------------------- |
65 | ;--------------------------------------------------------------------- |
66 | hotkey_test2: |
66 | hotkey_test2: |
67 | cmp al, 3 |
67 | cmp al, 3 |
68 | setz al |
68 | setz al |
69 | ret |
69 | ret |
70 | ;--------------------------------------------------------------------- |
70 | ;--------------------------------------------------------------------- |
71 | hotkey_test3: |
71 | hotkey_test3: |
72 | cmp al, 1 |
72 | cmp al, 1 |
73 | setz al |
73 | setz al |
74 | ret |
74 | ret |
75 | ;--------------------------------------------------------------------- |
75 | ;--------------------------------------------------------------------- |
76 | hotkey_test4: |
76 | hotkey_test4: |
77 | cmp al, 2 |
77 | cmp al, 2 |
78 | setz al |
78 | setz al |
79 | ret |
79 | ret |
80 | ;--------------------------------------------------------------------- |
80 | ;--------------------------------------------------------------------- |
81 | hotkey_do_test: |
81 | hotkey_do_test: |
82 | push eax |
82 | push eax |
83 | mov edx, [kb_state] |
83 | mov edx, [kb_state] |
84 | shr edx, cl |
84 | shr edx, cl |
85 | add cl, cl |
85 | add cl, cl |
86 | mov eax, [eax+4] |
86 | mov eax, [eax+4] |
87 | shr eax, cl |
87 | shr eax, cl |
88 | and eax, 15 |
88 | and eax, 15 |
89 | cmp al, hotkey_tests_num |
89 | cmp al, hotkey_tests_num |
90 | jae .fail |
90 | jae .fail |
91 | 91 | ||
92 | xchg eax, edx |
92 | xchg eax, edx |
93 | and al, 3 |
93 | and al, 3 |
94 | call [hotkey_tests + edx*4] |
94 | call [hotkey_tests + edx*4] |
95 | cmp al, 1 |
95 | cmp al, 1 |
96 | pop eax |
96 | pop eax |
97 | ret |
97 | ret |
98 | ;-------------------------------------- |
98 | ;-------------------------------------- |
99 | .fail: |
99 | .fail: |
100 | stc |
100 | stc |
101 | pop eax |
101 | pop eax |
102 | ret |
102 | ret |
103 | ;--------------------------------------------------------------------- |
103 | ;--------------------------------------------------------------------- |
104 | align 4 |
104 | align 4 |
- | 105 | ; @brief Export function - Add new scancode in buffer |
|
- | 106 | ; @param ecx - scancode |
|
- | 107 | ; @return not return |
|
105 | set_keyboard_data: |
108 | set_keyboard_data: |
106 | movzx eax, word[thread_count]; top window process |
109 | movzx eax, word[thread_count]; top window process |
107 | movzx eax, word[WIN_POS + eax*2] |
110 | movzx eax, word[WIN_POS + eax*2] |
108 | shl eax, BSF sizeof.APPDATA |
111 | shl eax, BSF sizeof.APPDATA |
109 | mov al, [SLOT_BASE + eax + APPDATA.keyboard_mode] |
112 | mov al, [SLOT_BASE + eax + APPDATA.keyboard_mode] |
110 | mov [keyboard_mode], al |
113 | mov [keyboard_mode], al |
111 | 114 | ||
112 | mov eax, ecx |
115 | mov eax, ecx |
113 | 116 | ||
114 | push ebx esi edi ebp |
117 | push ebx esi edi ebp |
115 | call send_scancode |
118 | call send_scancode |
116 | pop ebp edi esi ebx |
119 | pop ebp edi esi ebx |
117 | ret |
120 | ret |
118 | ;--------------------------------------------------------------------- |
121 | ;--------------------------------------------------------------------- |
119 | struct KEYBOARD |
122 | struct KEYBOARD |
120 | next dd ? |
123 | next dd ? |
121 | prev dd ? |
124 | prev dd ? |
122 | functions dd ? |
125 | functions dd ? |
123 | userdata dd ? |
126 | userdata dd ? |
124 | ends |
127 | ends |
- | 128 | ||
125 | struct KBDFUNC |
129 | struct KBDFUNC |
126 | strucsize dd ? |
130 | strucsize dd ? |
127 | close dd ? |
131 | close dd ? |
128 | setlights dd ? |
132 | setlights dd ? |
129 | ends |
133 | ends |
130 | 134 | ||
131 | iglobal |
135 | iglobal |
132 | keyboards: |
136 | keyboards: |
133 | dd keyboards |
137 | dd keyboards |
134 | dd keyboards |
138 | dd keyboards |
135 | endg |
139 | endg |
136 | uglobal |
140 | uglobal |
137 | keyboard_list_mutex MUTEX |
141 | keyboard_list_mutex MUTEX |
138 | endg |
142 | endg |
- | 143 | ||
- | 144 | ; @brief Export function - Registration new keyboard |
|
- | 145 | ; @param [esp + 4] - pointer on KBDFUNC this keyboard |
|
- | 146 | ; @param [esp + 8] - userdata for callback function |
|
139 | 147 | ; @return eax = pointer on KEYBOARD structure or 0 on error |
|
140 | register_keyboard: |
148 | register_keyboard: |
141 | push ebx |
149 | push ebx |
142 | movi eax, sizeof.KEYBOARD |
150 | movi eax, sizeof.KEYBOARD |
143 | call malloc |
151 | call malloc |
144 | test eax, eax |
152 | test eax, eax |
145 | jz .nothing |
153 | jz .nothing |
146 | mov ecx, [esp+4+4] |
154 | mov ecx, [esp+4+4] |
147 | mov [eax + KEYBOARD.functions], ecx |
155 | mov [eax + KEYBOARD.functions], ecx |
148 | mov ecx, [esp+8+4] |
156 | mov ecx, [esp+8+4] |
149 | mov [eax + KEYBOARD.userdata], ecx |
157 | mov [eax + KEYBOARD.userdata], ecx |
150 | xchg eax, ebx |
158 | xchg eax, ebx |
151 | mov ecx, keyboard_list_mutex |
159 | mov ecx, keyboard_list_mutex |
152 | call mutex_lock |
160 | call mutex_lock |
153 | mov ecx, keyboards |
161 | mov ecx, keyboards |
154 | mov edx, [ecx + KEYBOARD.prev] |
162 | mov edx, [ecx + KEYBOARD.prev] |
155 | mov [ebx + KEYBOARD.next], ecx |
163 | mov [ebx + KEYBOARD.next], ecx |
156 | mov [ebx + KEYBOARD.prev], edx |
164 | mov [ebx + KEYBOARD.prev], edx |
157 | mov [edx + KEYBOARD.next], ebx |
165 | mov [edx + KEYBOARD.next], ebx |
158 | mov [ecx + KEYBOARD.prev], ebx |
166 | mov [ecx + KEYBOARD.prev], ebx |
159 | mov ecx, [ebx + KEYBOARD.functions] |
167 | mov ecx, [ebx + KEYBOARD.functions] |
160 | cmp [ecx + KBDFUNC.strucsize], KBDFUNC.setlights |
168 | cmp [ecx + KBDFUNC.strucsize], KBDFUNC.setlights |
161 | jbe .unlock |
169 | jbe .unlock |
162 | mov ecx, [ecx + KBDFUNC.setlights] |
170 | mov ecx, [ecx + KBDFUNC.setlights] |
163 | test ecx, ecx |
171 | test ecx, ecx |
164 | jz .unlock |
172 | jz .unlock |
165 | stdcall ecx, [ebx + KEYBOARD.userdata], dword [kb_lights] |
173 | stdcall ecx, [ebx + KEYBOARD.userdata], dword [kb_lights] |
166 | .unlock: |
174 | .unlock: |
167 | mov ecx, keyboard_list_mutex |
175 | mov ecx, keyboard_list_mutex |
168 | call mutex_unlock |
176 | call mutex_unlock |
169 | xchg eax, ebx |
177 | xchg eax, ebx |
170 | .nothing: |
178 | .nothing: |
171 | pop ebx |
179 | pop ebx |
172 | ret 8 |
180 | ret 8 |
- | 181 | ||
- | 182 | ; @brief Export function - Delete keyboard |
|
- | 183 | ; @param [esp + 4] - pointer on KEYBOARD structure |
|
173 | 184 | ; @return not return |
|
174 | delete_keyboard: |
185 | delete_keyboard: |
175 | push ebx |
186 | push ebx |
176 | mov ebx, [esp+4+4] |
187 | mov ebx, [esp+4+4] |
177 | mov ecx, keyboard_list_mutex |
188 | mov ecx, keyboard_list_mutex |
178 | call mutex_lock |
189 | call mutex_lock |
179 | mov eax, [ebx + KEYBOARD.next] |
190 | mov eax, [ebx + KEYBOARD.next] |
180 | mov edx, [ebx + KEYBOARD.prev] |
191 | mov edx, [ebx + KEYBOARD.prev] |
181 | mov [eax + KEYBOARD.prev], edx |
192 | mov [eax + KEYBOARD.prev], edx |
182 | mov [edx + KEYBOARD.next], eax |
193 | mov [edx + KEYBOARD.next], eax |
183 | call mutex_unlock |
194 | call mutex_unlock |
184 | mov ecx, [ebx + KEYBOARD.functions] |
195 | mov ecx, [ebx + KEYBOARD.functions] |
185 | cmp [ecx + KBDFUNC.strucsize], KBDFUNC.close |
196 | cmp [ecx + KBDFUNC.strucsize], KBDFUNC.close |
186 | jbe .nothing |
197 | jbe .nothing |
187 | mov ecx, [ecx + KBDFUNC.close] |
198 | mov ecx, [ecx + KBDFUNC.close] |
188 | test ecx, ecx |
199 | test ecx, ecx |
189 | jz .nothing |
200 | jz .nothing |
190 | stdcall ecx, [ebx + KEYBOARD.userdata] |
201 | stdcall ecx, [ebx + KEYBOARD.userdata] |
191 | .nothing: |
202 | .nothing: |
192 | pop ebx |
203 | pop ebx |
193 | ret 4 |
204 | ret 4 |
194 | ;--------------------------------------------------------------------- |
205 | ;--------------------------------------------------------------------- |
195 | align 4 |
206 | align 4 |
196 | irq1: |
207 | irq1: |
197 | movzx eax, word[thread_count]; top window process |
208 | movzx eax, word[thread_count]; top window process |
198 | movzx eax, word[WIN_POS + eax*2] |
209 | movzx eax, word[WIN_POS + eax*2] |
199 | shl eax, BSF sizeof.APPDATA |
210 | shl eax, BSF sizeof.APPDATA |
200 | mov al, [SLOT_BASE + eax + APPDATA.keyboard_mode] |
211 | mov al, [SLOT_BASE + eax + APPDATA.keyboard_mode] |
201 | mov [keyboard_mode], al |
212 | mov [keyboard_mode], al |
202 | 213 | ||
203 | in al, 0x60 |
214 | in al, 0x60 |
204 | ;-------------------------------------- |
215 | ;-------------------------------------- |
205 | send_scancode: |
216 | send_scancode: |
206 | ;DEBUGF 1, "K : Scan code: %x \n", al |
217 | ;DEBUGF 1, "K : Scan code: %x \n", al |
207 | mov [keyboard_data], al |
218 | mov [keyboard_data], al |
208 | ; ch = scancode |
219 | ; ch = scancode |
209 | ; cl = ext_code |
220 | ; cl = ext_code |
210 | ; bh = 0 - normal key |
221 | ; bh = 0 - normal key |
211 | ; bh = 1 - modifier (Shift/Ctrl/Alt) |
222 | ; bh = 1 - modifier (Shift/Ctrl/Alt) |
212 | ; bh = 2 - extended code |
223 | ; bh = 2 - extended code |
213 | mov ch, al |
224 | mov ch, al |
214 | cmp al, 0xE0 |
225 | cmp al, 0xE0 |
215 | je @f |
226 | je @f |
216 | 227 | ||
217 | cmp al, 0xE1 |
228 | cmp al, 0xE1 |
218 | jne .normal_code |
229 | jne .normal_code |
219 | @@: |
230 | @@: |
220 | mov bh, 2 |
231 | mov bh, 2 |
221 | mov [ext_code], al |
232 | mov [ext_code], al |
222 | jmp .writekey |
233 | jmp .writekey |
223 | ;-------------------------------------- |
234 | ;-------------------------------------- |
224 | .normal_code: |
235 | .normal_code: |
225 | mov cl, 0 |
236 | mov cl, 0 |
226 | xchg cl, [ext_code] |
237 | xchg cl, [ext_code] |
227 | and al, 0x7F |
238 | and al, 0x7F |
228 | mov bh, 1 |
239 | mov bh, 1 |
229 | ;-------------------------------------- |
240 | ;-------------------------------------- |
230 | @@: |
241 | @@: |
231 | cmp al, 0x5B |
242 | cmp al, 0x5B |
232 | jne @f |
243 | jne @f |
233 | 244 | ||
234 | cmp cl, 0xE0 |
245 | cmp cl, 0xE0 |
235 | jne @f |
246 | jne @f |
236 | 247 | ||
237 | mov eax, VKEY_LWIN |
248 | mov eax, VKEY_LWIN |
238 | mov bh, 0 |
249 | mov bh, 0 |
239 | jmp .modifier |
250 | jmp .modifier |
240 | ;-------------------------------------- |
251 | ;-------------------------------------- |
241 | @@: |
252 | @@: |
242 | cmp al, 0x5C |
253 | cmp al, 0x5C |
243 | jne @f |
254 | jne @f |
244 | 255 | ||
245 | cmp cl, 0xE0 |
256 | cmp cl, 0xE0 |
246 | jne @f |
257 | jne @f |
247 | 258 | ||
248 | mov eax, VKEY_RWIN |
259 | mov eax, VKEY_RWIN |
249 | mov bh, 0 |
260 | mov bh, 0 |
250 | jmp .modifier |
261 | jmp .modifier |
251 | ;-------------------------------------- |
262 | ;-------------------------------------- |
252 | @@: |
263 | @@: |
253 | cmp al, 0x2A |
264 | cmp al, 0x2A |
254 | jne @f |
265 | jne @f |
255 | 266 | ||
256 | cmp cl, 0xE0 |
267 | cmp cl, 0xE0 |
257 | je .writekey |
268 | je .writekey |
258 | 269 | ||
259 | mov eax, VKEY_LSHIFT |
270 | mov eax, VKEY_LSHIFT |
260 | jmp .modifier |
271 | jmp .modifier |
261 | ;-------------------------------------- |
272 | ;-------------------------------------- |
262 | @@: |
273 | @@: |
263 | cmp al, 0x36 |
274 | cmp al, 0x36 |
264 | jne @f |
275 | jne @f |
265 | 276 | ||
266 | cmp cl, 0xE0 |
277 | cmp cl, 0xE0 |
267 | je .writekey |
278 | je .writekey |
268 | 279 | ||
269 | mov eax, VKEY_RSHIFT |
280 | mov eax, VKEY_RSHIFT |
270 | jmp .modifier |
281 | jmp .modifier |
271 | ;-------------------------------------- |
282 | ;-------------------------------------- |
272 | @@: |
283 | @@: |
273 | cmp al, 0x38 |
284 | cmp al, 0x38 |
274 | jne @f |
285 | jne @f |
275 | 286 | ||
276 | mov eax, VKEY_LALT |
287 | mov eax, VKEY_LALT |
277 | test cl, cl |
288 | test cl, cl |
278 | jz .modifier |
289 | jz .modifier |
279 | 290 | ||
280 | mov al, VKEY_RALT |
291 | mov al, VKEY_RALT |
281 | jmp .modifier |
292 | jmp .modifier |
282 | ;-------------------------------------- |
293 | ;-------------------------------------- |
283 | @@: |
294 | @@: |
284 | cmp al, 0x1D |
295 | cmp al, 0x1D |
285 | jne @f |
296 | jne @f |
286 | 297 | ||
287 | mov eax, VKEY_LCONTROL |
298 | mov eax, VKEY_LCONTROL |
288 | test cl, cl |
299 | test cl, cl |
289 | jz .modifier |
300 | jz .modifier |
290 | 301 | ||
291 | mov al, VKEY_RCONTROL |
302 | mov al, VKEY_RCONTROL |
292 | cmp cl, 0xE0 |
303 | cmp cl, 0xE0 |
293 | jz .modifier |
304 | jz .modifier |
294 | 305 | ||
295 | mov [ext_code], cl |
306 | mov [ext_code], cl |
296 | jmp .writekey |
307 | jmp .writekey |
297 | ;-------------------------------------- |
308 | ;-------------------------------------- |
298 | @@: |
309 | @@: |
299 | cmp al, 0x3A |
310 | cmp al, 0x3A |
300 | jne @f |
311 | jne @f |
301 | 312 | ||
302 | mov bl, 4 |
313 | mov bl, 4 |
303 | mov eax, VKEY_CAPSLOCK |
314 | mov eax, VKEY_CAPSLOCK |
304 | jmp .no_key.xor |
315 | jmp .no_key.xor |
305 | ;-------------------------------------- |
316 | ;-------------------------------------- |
306 | @@: |
317 | @@: |
307 | cmp al, 0x45 |
318 | cmp al, 0x45 |
308 | jne @f |
319 | jne @f |
309 | test cl, cl |
320 | test cl, cl |
310 | jnz .writekey |
321 | jnz .writekey |
311 | 322 | ||
312 | mov bl, 2 |
323 | mov bl, 2 |
313 | mov eax, VKEY_NUMLOCK |
324 | mov eax, VKEY_NUMLOCK |
314 | jmp .no_key.xor |
325 | jmp .no_key.xor |
315 | ;-------------------------------------- |
326 | ;-------------------------------------- |
316 | @@: |
327 | @@: |
317 | cmp al, 0x46 |
328 | cmp al, 0x46 |
318 | jne @f |
329 | jne @f |
319 | 330 | ||
320 | mov bl, 1 |
331 | mov bl, 1 |
321 | mov eax, VKEY_SCRLOCK |
332 | mov eax, VKEY_SCRLOCK |
322 | jmp .no_key.xor |
333 | jmp .no_key.xor |
323 | ;-------------------------------------- |
334 | ;-------------------------------------- |
324 | @@: |
335 | @@: |
325 | xor ebx, ebx |
336 | xor ebx, ebx |
326 | test ch, ch |
337 | test ch, ch |
327 | js .writekey |
338 | js .writekey |
328 | 339 | ||
329 | movzx eax, ch ; plain key |
340 | movzx eax, ch ; plain key |
330 | mov bl, [keymap + eax] |
341 | mov bl, [keymap + eax] |
331 | mov edx, [kb_state] |
342 | mov edx, [kb_state] |
332 | test dl, VKEY_CONTROL ; ctrl alt del |
343 | test dl, VKEY_CONTROL ; ctrl alt del |
333 | jz .noctrlaltdel |
344 | jz .noctrlaltdel |
334 | 345 | ||
335 | test dl, VKEY_ALT |
346 | test dl, VKEY_ALT |
336 | jz .noctrlaltdel |
347 | jz .noctrlaltdel |
337 | 348 | ||
338 | cmp ch, 53h |
349 | cmp ch, 53h |
339 | jne .noctrlaltdel |
350 | jne .noctrlaltdel |
340 | 351 | ||
341 | mov [ctrl_alt_del], 1 |
352 | mov [ctrl_alt_del], 1 |
342 | call wakeup_osloop |
353 | call wakeup_osloop |
343 | .noctrlaltdel: |
354 | .noctrlaltdel: |
344 | test dl, VKEY_CONTROL ; ctrl on ? |
355 | test dl, VKEY_CONTROL ; ctrl on ? |
345 | jz @f |
356 | jz @f |
346 | 357 | ||
347 | sub bl, 0x60 |
358 | sub bl, 0x60 |
348 | @@: |
359 | @@: |
349 | test dl, VKEY_CAPSLOCK ; caps lock on ? |
360 | test dl, VKEY_CAPSLOCK ; caps lock on ? |
350 | jz .no_caps_lock |
361 | jz .no_caps_lock |
351 | 362 | ||
352 | test dl, VKEY_SHIFT ; shift on ? |
363 | test dl, VKEY_SHIFT ; shift on ? |
353 | jz .keymap_shif |
364 | jz .keymap_shif |
354 | 365 | ||
355 | jmp @f |
366 | jmp @f |
356 | ;-------------------------------------- |
367 | ;-------------------------------------- |
357 | .no_caps_lock: |
368 | .no_caps_lock: |
358 | test dl, VKEY_SHIFT ; shift on ? |
369 | test dl, VKEY_SHIFT ; shift on ? |
359 | jz @f |
370 | jz @f |
360 | .keymap_shif: |
371 | .keymap_shif: |
361 | mov bl, [keymap_shift + eax] |
372 | mov bl, [keymap_shift + eax] |
362 | @@: |
373 | @@: |
363 | test dl, VKEY_ALT ; alt on ? |
374 | test dl, VKEY_ALT ; alt on ? |
364 | jz @f |
375 | jz @f |
365 | 376 | ||
366 | mov bl, [keymap_alt + eax] |
377 | mov bl, [keymap_alt + eax] |
367 | @@: |
378 | @@: |
368 | jmp .writekey |
379 | jmp .writekey |
369 | ;-------------------------------------- |
380 | ;-------------------------------------- |
370 | .modifier: |
381 | .modifier: |
371 | test ch, ch |
382 | test ch, ch |
372 | js .modifier.up |
383 | js .modifier.up |
373 | or [kb_state], eax |
384 | or [kb_state], eax |
374 | jmp .writekey |
385 | jmp .writekey |
375 | ;-------------------------------------- |
386 | ;-------------------------------------- |
376 | .modifier.up: |
387 | .modifier.up: |
377 | not eax |
388 | not eax |
378 | and [kb_state], eax |
389 | and [kb_state], eax |
379 | jmp .writekey |
390 | jmp .writekey |
380 | ;-------------------------------------- |
391 | ;-------------------------------------- |
381 | .no_key.xor: |
392 | .no_key.xor: |
382 | mov bh, 0 |
393 | mov bh, 0 |
383 | test ch, ch |
394 | test ch, ch |
384 | js .writekey |
395 | js .writekey |
385 | 396 | ||
386 | xor [kb_state], eax |
397 | xor [kb_state], eax |
387 | xor [kb_lights], bl |
398 | xor [kb_lights], bl |
388 | .writekey: |
399 | .writekey: |
389 | pushad |
400 | pushad |
390 | ; test for system hotkeys |
401 | ; test for system hotkeys |
391 | movzx eax, ch |
402 | movzx eax, ch |
392 | cmp bh, 1 |
403 | cmp bh, 1 |
393 | ja .nohotkey |
404 | ja .nohotkey |
394 | jb @f |
405 | jb @f |
395 | 406 | ||
396 | xor eax, eax |
407 | xor eax, eax |
397 | @@: |
408 | @@: |
398 | mov eax, [hotkey_scancodes + eax*4] |
409 | mov eax, [hotkey_scancodes + eax*4] |
399 | .hotkey_loop: |
410 | .hotkey_loop: |
400 | test eax, eax |
411 | test eax, eax |
401 | jz .nohotkey |
412 | jz .nohotkey |
402 | 413 | ||
403 | mov cl, 0 |
414 | mov cl, 0 |
404 | call hotkey_do_test |
415 | call hotkey_do_test |
405 | jc .hotkey_cont |
416 | jc .hotkey_cont |
406 | 417 | ||
407 | mov cl, 2 |
418 | mov cl, 2 |
408 | call hotkey_do_test |
419 | call hotkey_do_test |
409 | jc .hotkey_cont |
420 | jc .hotkey_cont |
410 | 421 | ||
411 | mov cl, 4 |
422 | mov cl, 4 |
412 | call hotkey_do_test |
423 | call hotkey_do_test |
413 | jnc .hotkey_found |
424 | jnc .hotkey_found |
414 | .hotkey_cont: |
425 | .hotkey_cont: |
415 | mov eax, [eax] |
426 | mov eax, [eax] |
416 | jmp .hotkey_loop |
427 | jmp .hotkey_loop |
417 | ;-------------------------------------- |
428 | ;-------------------------------------- |
418 | .hotkey_found: |
429 | .hotkey_found: |
419 | mov eax, [eax+8] |
430 | mov eax, [eax+8] |
420 | ; put key in buffer for process in slot eax |
431 | ; put key in buffer for process in slot eax |
421 | mov edi, hotkey_buffer |
432 | mov edi, hotkey_buffer |
422 | @@: |
433 | @@: |
423 | cmp dword [edi], 0 |
434 | cmp dword [edi], 0 |
424 | jz .found_free |
435 | jz .found_free |
425 | 436 | ||
426 | add edi, 8 |
437 | add edi, 8 |
427 | cmp edi, hotkey_buffer+120*8 |
438 | cmp edi, hotkey_buffer+120*8 |
428 | jb @b |
439 | jb @b |
429 | ; no free space - replace first entry |
440 | ; no free space - replace first entry |
430 | mov edi, hotkey_buffer |
441 | mov edi, hotkey_buffer |
431 | .found_free: |
442 | .found_free: |
432 | mov [edi], eax |
443 | mov [edi], eax |
433 | movzx eax, ch |
444 | movzx eax, ch |
434 | cmp bh, 1 |
445 | cmp bh, 1 |
435 | jnz @f |
446 | jnz @f |
436 | 447 | ||
437 | xor eax, eax |
448 | xor eax, eax |
438 | @@: |
449 | @@: |
439 | mov [edi+4], ax |
450 | mov [edi+4], ax |
440 | mov eax, [kb_state] |
451 | mov eax, [kb_state] |
441 | mov [edi+6], ax |
452 | mov [edi+6], ax |
442 | 453 | ||
443 | cmp [PID_lock_input], dword 0 |
454 | cmp [PID_lock_input], dword 0 |
444 | je .nohotkey |
455 | je .nohotkey |
445 | 456 | ||
446 | popad |
457 | popad |
447 | jmp .exit.irq1 |
458 | jmp .exit.irq1 |
448 | ;-------------------------------------- |
459 | ;-------------------------------------- |
449 | .nohotkey: |
460 | .nohotkey: |
450 | popad |
461 | popad |
451 | 462 | ||
452 | cmp [keyboard_mode], 0; return from keymap |
463 | cmp [keyboard_mode], 0; return from keymap |
453 | jne .scancode |
464 | jne .scancode |
454 | 465 | ||
455 | test bh, bh |
466 | test bh, bh |
456 | jnz .exit.irq1 |
467 | jnz .exit.irq1 |
457 | 468 | ||
458 | test bl, bl |
469 | test bl, bl |
459 | jz .exit.irq1 |
470 | jz .exit.irq1 |
460 | 471 | ||
461 | cmp cl, 0xE0 ; extended keycode |
472 | cmp cl, 0xE0 ; extended keycode |
462 | jne @f |
473 | jne @f |
463 | 474 | ||
464 | cmp ch, 53 |
475 | cmp ch, 53 |
465 | jne .dowrite |
476 | jne .dowrite |
466 | 477 | ||
467 | mov bl, '/' |
478 | mov bl, '/' |
468 | jmp .dowrite |
479 | jmp .dowrite |
469 | @@: |
480 | @@: |
470 | 481 | ||
471 | cmp ch, 55 |
482 | cmp ch, 55 |
472 | jne @f |
483 | jne @f |
473 | 484 | ||
474 | mov bl, '*' |
485 | mov bl, '*' |
475 | jmp .dowrite |
486 | jmp .dowrite |
476 | @@: |
487 | @@: |
477 | 488 | ||
478 | cmp ch, 74 |
489 | cmp ch, 74 |
479 | jne @f |
490 | jne @f |
480 | 491 | ||
481 | mov bl, '-' |
492 | mov bl, '-' |
482 | jmp .dowrite |
493 | jmp .dowrite |
483 | @@: |
494 | @@: |
484 | 495 | ||
485 | cmp ch, 78 |
496 | cmp ch, 78 |
486 | jne @f |
497 | jne @f |
487 | 498 | ||
488 | mov bl, '+' |
499 | mov bl, '+' |
489 | jmp .dowrite |
500 | jmp .dowrite |
490 | @@: |
501 | @@: |
491 | 502 | ||
492 | test [kb_state], VKEY_NUMLOCK |
503 | test [kb_state], VKEY_NUMLOCK |
493 | jz .dowrite |
504 | jz .dowrite |
494 | 505 | ||
495 | cmp ch, 71 |
506 | cmp ch, 71 |
496 | jb .dowrite |
507 | jb .dowrite |
497 | 508 | ||
498 | cmp ch, 83 |
509 | cmp ch, 83 |
499 | ja .dowrite |
510 | ja .dowrite |
500 | 511 | ||
501 | movzx eax, ch |
512 | movzx eax, ch |
502 | mov bl, [numlock_map + eax - 71] |
513 | mov bl, [numlock_map + eax - 71] |
503 | jmp .dowrite |
514 | jmp .dowrite |
504 | ;-------------------------------------- |
515 | ;-------------------------------------- |
505 | .scancode: |
516 | .scancode: |
506 | mov bl, ch |
517 | mov bl, ch |
507 | .dowrite: |
518 | .dowrite: |
508 | movzx eax, byte[KEY_COUNT] |
519 | movzx eax, byte[KEY_COUNT] |
509 | cmp al, 120 |
520 | cmp al, 120 |
510 | jae .exit.irq1 |
521 | jae .exit.irq1 |
511 | inc eax |
522 | inc eax |
512 | mov [KEY_COUNT], al |
523 | mov [KEY_COUNT], al |
513 | ; store ascii or scancode |
524 | ; store ascii or scancode |
514 | mov [KEY_BUFF + eax -1], bl |
525 | mov [KEY_BUFF + eax -1], bl |
515 | ; store original scancode |
526 | ; store original scancode |
516 | add eax, 120+2 |
527 | add eax, 120+2 |
517 | push ecx |
528 | push ecx |
518 | cmp [keyboard_mode], 0; return from keymap |
529 | cmp [keyboard_mode], 0; return from keymap |
519 | je @f |
530 | je @f |
520 | 531 | ||
521 | xor ch, ch |
532 | xor ch, ch |
522 | @@: |
533 | @@: |
523 | mov [KEY_BUFF + eax -1], ch |
534 | mov [KEY_BUFF + eax -1], ch |
524 | pop ecx |
535 | pop ecx |
525 | sub eax, 120+2 |
536 | sub eax, 120+2 |
526 | .exit.irq1: |
537 | .exit.irq1: |
527 | ret |
538 | ret |
528 | ;--------------------------------------------------------------------- |
539 | ;--------------------------------------------------------------------- |
529 | set_lights: |
540 | set_lights: |
530 | push ebx esi |
541 | push ebx esi |
531 | mov ecx, keyboard_list_mutex |
542 | mov ecx, keyboard_list_mutex |
532 | call mutex_lock |
543 | call mutex_lock |
533 | mov esi, keyboards |
544 | mov esi, keyboards |
534 | .loop: |
545 | .loop: |
535 | mov esi, [esi + KEYBOARD.next] |
546 | mov esi, [esi + KEYBOARD.next] |
536 | cmp esi, keyboards |
547 | cmp esi, keyboards |
537 | jz .done |
548 | jz .done |
538 | mov eax, [esi + KEYBOARD.functions] |
549 | mov eax, [esi + KEYBOARD.functions] |
539 | cmp dword [eax], KBDFUNC.setlights |
550 | cmp dword [eax], KBDFUNC.setlights |
540 | jbe .loop |
551 | jbe .loop |
541 | mov eax, [eax + KBDFUNC.setlights] |
552 | mov eax, [eax + KBDFUNC.setlights] |
542 | test eax, eax |
553 | test eax, eax |
543 | jz .loop |
554 | jz .loop |
544 | stdcall eax, [esi + KEYBOARD.userdata], dword [kb_lights] |
555 | stdcall eax, [esi + KEYBOARD.userdata], dword [kb_lights] |
545 | jmp .loop |
556 | jmp .loop |
546 | .done: |
557 | .done: |
547 | mov ecx, keyboard_list_mutex |
558 | mov ecx, keyboard_list_mutex |
548 | call mutex_unlock |
559 | call mutex_unlock |
549 | pop esi ebx |
560 | pop esi ebx |
550 | ret |
561 | ret |
551 | 562 | ||
552 | ps2_set_lights: |
563 | ps2_set_lights: |
553 | stdcall disable_irq, 1 |
564 | stdcall disable_irq, 1 |
554 | mov al, 0xED |
565 | mov al, 0xED |
555 | call kb_write_wait_ack |
566 | call kb_write_wait_ack |
556 | mov al, [esp+8] |
567 | mov al, [esp+8] |
557 | call kb_write_wait_ack |
568 | call kb_write_wait_ack |
558 | stdcall enable_irq, 1 |
569 | stdcall enable_irq, 1 |
559 | ret 8 |
570 | ret 8 |
560 | 571 | ||
561 | ;// mike.dld ] |
572 | ;// mike.dld ] |
562 | proc check_lights_state_has_work? |
573 | proc check_lights_state_has_work? |
563 | mov al, [kb_lights] |
574 | mov al, [kb_lights] |
564 | cmp al, [old_kb_lights] |
575 | cmp al, [old_kb_lights] |
565 | ret |
576 | ret |
566 | endp |
577 | endp |
567 | 578 | ||
568 | check_lights_state: |
579 | check_lights_state: |
569 | call check_lights_state_has_work? |
580 | call check_lights_state_has_work? |
570 | jz .nothing |
581 | jz .nothing |
571 | mov [old_kb_lights], al |
582 | mov [old_kb_lights], al |
572 | call set_lights |
583 | call set_lights |
573 | .nothing: |
584 | .nothing: |
574 | ret |
585 | ret |
575 | ;--------------------------------------------------------------------- |
586 | ;--------------------------------------------------------------------- |
576 | iglobal |
587 | iglobal |
577 | numlock_map db '789-456+1230.' |
588 | numlock_map db '789-456+1230.' |
578 | endg |
589 | endg |
579 | ;--------------------------------------------------------------------- |
590 | ;--------------------------------------------------------------------- |
- | 591 | align 4 |
|
- | 592 | kb_write_wait_ack: |
|
- | 593 | ||
- | 594 | push ecx edx |
|
- | 595 | ||
- | 596 | mov dl, al |
|
- | 597 | mov ecx, 0x1ffff; last 0xffff, new value in view of fast CPU's |
|
- | 598 | .wait_output_ready: |
|
- | 599 | in al, 0x64 |
|
- | 600 | test al, 2 |
|
- | 601 | jz @f |
|
- | 602 | loop .wait_output_ready |
|
- | 603 | mov ah, 1 |
|
- | 604 | jmp .nothing |
|
- | 605 | @@: |
|
- | 606 | mov al, dl |
|
- | 607 | out 0x60, al |
|
- | 608 | mov ecx, 0xfffff; last 0xffff, new value in view of fast CPU's |
|
- | 609 | .wait_ack: |
|
- | 610 | in al, 0x64 |
|
- | 611 | test al, 1 |
|
- | 612 | jnz @f |
|
- | 613 | loop .wait_ack |
|
- | 614 | mov ah, 1 |
|
- | 615 | jmp .nothing |
|
- | 616 | @@: |
|
- | 617 | in al, 0x60 |
|
- | 618 | xor ah, ah |
|
- | 619 | ||
- | 620 | .nothing: |
|
- | 621 | pop edx ecx |
|
- | 622 | ret |
|
- | 623 | ;----------------------------------------------------------------------------- |
|
- | 624 | ||
- | 625 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
- | 626 | ;; 66 sys function. ;; |
|
- | 627 | ;; in eax=66,ebx in [0..5],ecx,edx ;; |
|
- | 628 | ;; out eax ;; |
|
- | 629 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
- | 630 | iglobal |
|
- | 631 | align 4 |
|
- | 632 | f66call: |
|
- | 633 | dd sys_process_def.1 ; 1 = set keyboard mode |
|
- | 634 | dd sys_process_def.2 ; 2 = get keyboard mode |
|
- | 635 | dd sys_process_def.3 ; 3 = get keyboard ctrl, alt, shift |
|
- | 636 | dd sys_process_def.4 ; 4 = set system-wide hotkey |
|
- | 637 | dd sys_process_def.5 ; 5 = delete installed hotkey |
|
- | 638 | dd sys_process_def.6 ; 6 = disable input, work only hotkeys |
|
- | 639 | dd sys_process_def.7 ; 7 = enable input, opposition to f.66.6 |
|
- | 640 | endg |
|
- | 641 | ;----------------------------------------------------------------------------- |
|
- | 642 | align 4 |
|
- | 643 | sys_process_def: |
|
- | 644 | dec ebx |
|
- | 645 | cmp ebx, 7 |
|
- | 646 | jae .not_support ;if >=8 then or eax,-1 |
|
- | 647 | ||
- | 648 | mov edi, [current_slot] |
|
- | 649 | jmp dword [f66call + ebx*4] |
|
- | 650 | ||
- | 651 | .not_support: |
|
- | 652 | or [esp + SYSCALL_STACK.eax], -1 |
|
- | 653 | ret |
|
- | 654 | ;----------------------------------------------------------------------------- |
|
- | 655 | align 4 |
|
- | 656 | .1: |
|
- | 657 | mov [edi + APPDATA.keyboard_mode], cl |
|
- | 658 | ret |
|
- | 659 | ;----------------------------------------------------------------------------- |
|
- | 660 | align 4 |
|
- | 661 | .2: ; 2 = get keyboard mode |
|
- | 662 | movzx eax, byte [edi + APPDATA.keyboard_mode] |
|
- | 663 | mov [esp + SYSCALL_STACK.eax], eax |
|
- | 664 | ret |
|
- | 665 | ;----------------------------------------------------------------------------- |
|
- | 666 | align 4 |
|
- | 667 | .3: ;3 = get keyboard ctrl, alt, shift |
|
- | 668 | mov eax, [kb_state] |
|
- | 669 | mov [esp + SYSCALL_STACK.eax], eax |
|
- | 670 | ret |
|
- | 671 | ;----------------------------------------------------------------------------- |
|
- | 672 | align 4 |
|
- | 673 | .4: |
|
- | 674 | mov edi, [current_slot_idx] |
|
- | 675 | mov eax, hotkey_list |
|
- | 676 | @@: |
|
- | 677 | cmp dword [eax + 8], 0 |
|
- | 678 | jz .found_free |
|
- | 679 | add eax, 16 |
|
- | 680 | cmp eax, hotkey_list+16*256 |
|
- | 681 | jb @b |
|
- | 682 | mov dword [esp + SYSCALL_STACK.eax], 1 |
|
- | 683 | ret |
|
- | 684 | .found_free: |
|
- | 685 | mov [eax + 8], edi |
|
- | 686 | mov [eax + 4], edx |
|
- | 687 | movzx ecx, cl |
|
- | 688 | lea ecx, [hotkey_scancodes+ecx*4] |
|
- | 689 | mov edx, [ecx] |
|
- | 690 | mov [eax], edx |
|
- | 691 | mov [ecx], eax |
|
- | 692 | mov [eax + 12], ecx |
|
- | 693 | test edx, edx |
|
- | 694 | jz @f |
|
- | 695 | mov [edx + 12], eax |
|
- | 696 | @@: |
|
- | 697 | and dword [esp + SYSCALL_STACK.eax], 0 |
|
- | 698 | ret |
|
- | 699 | ;----------------------------------------------------------------------------- |
|
- | 700 | align 4 |
|
- | 701 | .5: |
|
- | 702 | mov edi, [current_slot_idx] |
|
- | 703 | movzx ebx, cl |
|
- | 704 | lea ebx, [hotkey_scancodes+ebx*4] |
|
- | 705 | mov eax, [ebx] |
|
- | 706 | .scan: |
|
- | 707 | test eax, eax |
|
- | 708 | jz .notfound |
|
- | 709 | cmp [eax + 8], edi |
|
- | 710 | jnz .next |
|
- | 711 | cmp [eax + 4], edx |
|
- | 712 | jz .found |
|
- | 713 | .next: |
|
- | 714 | mov eax, [eax] |
|
- | 715 | jmp .scan |
|
- | 716 | .notfound: |
|
- | 717 | mov dword [esp + SYSCALL_STACK.eax], 1 |
|
- | 718 | ret |
|
- | 719 | .found: |
|
- | 720 | mov ecx, [eax] |
|
- | 721 | jecxz @f |
|
- | 722 | mov edx, [eax + 12] |
|
- | 723 | mov [ecx + 12], edx |
|
- | 724 | @@: |
|
- | 725 | mov ecx, [eax + 12] |
|
- | 726 | mov edx, [eax] |
|
- | 727 | mov [ecx], edx |
|
- | 728 | xor edx, edx |
|
- | 729 | mov [eax + 4], edx |
|
- | 730 | mov [eax + 8], edx |
|
- | 731 | mov [eax + 12], edx |
|
- | 732 | mov [eax], edx |
|
- | 733 | mov [esp + SYSCALL_STACK.eax], edx |
|
- | 734 | ret |
|
- | 735 | ;----------------------------------------------------------------------------- |
|
- | 736 | align 4 |
|
- | 737 | .6: |
|
- | 738 | pushfd |
|
- | 739 | cli |
|
- | 740 | mov eax, [PID_lock_input] |
|
- | 741 | test eax, eax |
|
- | 742 | jnz @f |
|
- | 743 | ; get current PID |
|
- | 744 | mov eax, [current_slot] |
|
- | 745 | mov eax, [eax + APPDATA.tid] |
|
- | 746 | ; set current PID for lock input |
|
- | 747 | mov [PID_lock_input], eax |
|
- | 748 | @@: |
|
- | 749 | popfd |
|
- | 750 | ret |
|
- | 751 | ;----------------------------------------------------------------------------- |
|
- | 752 | align 4 |
|
- | 753 | .7: |
|
- | 754 | mov eax, [PID_lock_input] |
|
- | 755 | test eax, eax |
|
- | 756 | jz @f |
|
- | 757 | ; get current PID |
|
- | 758 | mov ebx, [current_slot] |
|
- | 759 | mov ebx, [ebx + APPDATA.tid] |
|
- | 760 | ; compare current lock input with current PID |
|
- | 761 | cmp ebx, eax |
|
- | 762 | jne @f |
|
- | 763 | ||
- | 764 | xor eax, eax |
|
- | 765 | mov [PID_lock_input], eax |
|
- | 766 | @@: |
|
- | 767 | ret |
|
- | 768 | ;----------------------------------------------------------------------------- |
|
- | 769 | uglobal |
|
- | 770 | PID_lock_input dd 0x0 |
|
- | 771 | endg |
|
- | 772 | ;----------------------------------------------------------------------------- |
|
- | 773 | align 4 |
|
- | 774 | ; @brief System function 2 - Get pressed key |
|
- | 775 | ; @param eax = 2- number function |
|
- | 776 | ; @return eax = 1 - buffer empty, else |
|
- | 777 | ; al = 0, ah = code pressed key, |
|
- | 778 | ; 16-23 bits - scancode pressed key(in ASCII mode) |
|
- | 779 | ; if al=2 ah=scancode pressed key, 16-31 bits - state control keys |
|
- | 780 | sys_getkey: |
|
- | 781 | mov [esp + SYSCALL_STACK.eax], dword 1 |
|
- | 782 | ; test main buffer |
|
- | 783 | mov ebx, [current_slot_idx] ; TOP OF WINDOW STACK |
|
- | 784 | movzx ecx, word [WIN_STACK + ebx * 2] |
|
- | 785 | mov edx, [thread_count] |
|
- | 786 | cmp ecx, edx |
|
- | 787 | jne .finish |
|
- | 788 | cmp [KEY_COUNT], byte 0 |
|
- | 789 | je .finish |
|
- | 790 | movzx ax, byte [KEY_BUFF + 120 + 2] |
|
- | 791 | shl eax, 8 |
|
- | 792 | mov al, byte [KEY_BUFF] |
|
- | 793 | shl eax, 8 |
|
- | 794 | push eax |
|
- | 795 | dec byte [KEY_COUNT] |
|
- | 796 | and byte [KEY_COUNT], 127 |
|
- | 797 | movzx ecx, byte [KEY_COUNT] |
|
- | 798 | add ecx, 2 |
|
- | 799 | mov eax, KEY_BUFF + 1 |
|
- | 800 | mov ebx, KEY_BUFF |
|
- | 801 | call memmove |
|
- | 802 | add eax, 120 + 2 |
|
- | 803 | add ebx, 120 + 2 |
|
- | 804 | call memmove |
|
- | 805 | pop eax |
|
- | 806 | ;-------------------------------------- |
|
- | 807 | align 4 |
|
- | 808 | .ret_eax: |
|
- | 809 | mov [esp + SYSCALL_STACK.eax], eax |
|
- | 810 | ret |
|
- | 811 | ;-------------------------------------- |
|
- | 812 | align 4 |
|
- | 813 | .finish: |
|
- | 814 | ; test hotkeys buffer |
|
- | 815 | mov ecx, hotkey_buffer |
|
- | 816 | ;-------------------------------------- |
|
- | 817 | align 4 |
|
- | 818 | @@: |
|
- | 819 | cmp [ecx], ebx |
|
- | 820 | jz .found |
|
- | 821 | add ecx, 8 |
|
- | 822 | cmp ecx, hotkey_buffer + 120 * 8 |
|
- | 823 | jb @b |
|
- | 824 | ret |
|
- | 825 | ;-------------------------------------- |
|
- | 826 | align 4 |
|
- | 827 | .found: |
|
- | 828 | mov ax, [ecx + 6] |
|
- | 829 | shl eax, 16 |
|
- | 830 | mov ah, [ecx + 4] |
|
- | 831 | mov al, 2 |
|
- | 832 | and dword [ecx + 4], 0 |
|
- | 833 | and dword [ecx], 0 |
|
- | 834 | jmp .ret_eax |
|
- | 835 | ;------------------------------------------------------------------------------ |
|
580 | 836 |