Rev 473 | Rev 593 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
425 | victor | 1 | $Revision: 531 $ |
431 | serge | 2 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
3 | ;; ;; |
||
4 | ;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; |
||
5 | ;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;; |
||
6 | ;; Distributed under terms of the GNU General Public License ;; |
||
7 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
227 | serge | 8 | |
9 | align 4 |
||
10 | init_events: |
||
354 | serge | 11 | stdcall kernel_alloc, 512*EVENT_SIZE |
227 | serge | 12 | mov [events], eax |
13 | xor eax, eax |
||
354 | serge | 14 | mov [event_uid], eax |
227 | serge | 15 | not eax |
16 | mov edi, event_map |
||
17 | mov [event_start], edi |
||
354 | serge | 18 | mov ecx, 64/4 |
227 | serge | 19 | cld |
20 | rep stosd |
||
21 | mov [event_end], edi |
||
22 | ret |
||
23 | |||
24 | align 4 |
||
25 | proc alloc_event |
||
26 | |||
27 | pushfd |
||
28 | cli |
||
29 | mov ebx, [event_start] |
||
30 | mov ecx, [event_end] |
||
31 | .l1: |
||
32 | bsf eax,[ebx] |
||
33 | jnz .found |
||
34 | add ebx,4 |
||
35 | cmp ebx, ecx |
||
36 | jb .l1 |
||
37 | popfd |
||
38 | xor eax,eax |
||
39 | ret |
||
40 | .found: |
||
41 | btr [ebx], eax |
||
42 | mov [event_start],ebx |
||
354 | serge | 43 | inc [event_uid] |
44 | |||
227 | serge | 45 | sub ebx, event_map |
254 | serge | 46 | lea eax,[eax+ebx*8] |
354 | serge | 47 | |
48 | lea ebx, [eax+eax*4] |
||
227 | serge | 49 | shl eax,5 |
354 | serge | 50 | lea eax,[eax+ebx*4] ;eax*=52 (EVENT_SIZE) |
227 | serge | 51 | add eax, [events] |
354 | serge | 52 | mov ebx, [event_uid] |
227 | serge | 53 | popfd |
54 | ret |
||
55 | endp |
||
56 | |||
57 | align 4 |
||
58 | free_event: |
||
354 | serge | 59 | sub eax, [events] |
60 | mov ecx, EVENT_SIZE |
||
61 | mov ebx, event_map |
||
62 | cdq |
||
63 | div ecx |
||
64 | |||
227 | serge | 65 | pushfd |
66 | cli |
||
67 | bts [ebx], eax |
||
68 | shr eax, 3 |
||
69 | and eax, not 3 |
||
70 | add eax, ebx |
||
71 | cmp [event_start], eax |
||
72 | ja @f |
||
73 | popfd |
||
74 | ret |
||
75 | @@: |
||
76 | mov [event_start], eax |
||
77 | popfd |
||
78 | ret |
||
79 | |||
354 | serge | 80 | EVENT_WATCHED equ 0x10000000 |
81 | EVENT_SIGNALED equ 0x20000000 |
||
82 | MANUAL_RESET equ 0x40000000 |
||
83 | MANUAL_DESTROY equ 0x80000000 |
||
84 | |||
85 | |||
86 | ; param |
||
87 | ; eax= event data |
||
88 | ; ebx= flags |
||
89 | ; |
||
90 | ; retval |
||
91 | ; eax= event |
||
92 | ; edx= id |
||
93 | |||
94 | create_event: |
||
95 | .flags equ esp+4 |
||
96 | .data equ esp |
||
97 | |||
98 | push ebx |
||
99 | push eax |
||
100 | |||
101 | call alloc_event |
||
102 | test eax, eax |
||
103 | jz .fail |
||
104 | |||
105 | mov [eax+APPOBJ.magic], 'EVNT' |
||
363 | serge | 106 | mov [eax+APPOBJ.destroy], destroy_event.internal |
354 | serge | 107 | mov [eax+EVENT.id], ebx |
108 | |||
109 | mov ebx, [CURRENT_TASK] |
||
110 | shl ebx, 5 |
||
379 | serge | 111 | mov ebx, [CURRENT_TASK+ebx+4] |
354 | serge | 112 | mov [eax+APPOBJ.pid], ebx |
113 | mov edx, [.flags] |
||
114 | mov [eax+EVENT.state], edx |
||
115 | |||
116 | mov esi, [.data] |
||
117 | test esi, esi |
||
118 | jz @F |
||
119 | lea edi, [eax+EVENT.code] |
||
120 | mov ecx, 6 |
||
121 | cld |
||
122 | rep movsd |
||
123 | @@: |
||
465 | serge | 124 | mov ecx, [current_slot] |
125 | add ecx, APP_OBJ_OFFSET |
||
354 | serge | 126 | |
127 | pushfd |
||
128 | cli |
||
129 | mov edx, [ecx+APPOBJ.fd] |
||
130 | mov [eax+APPOBJ.fd], edx |
||
131 | mov [eax+APPOBJ.bk], ecx |
||
132 | mov [ecx+APPOBJ.fd], eax |
||
133 | mov [edx+APPOBJ.bk], eax |
||
134 | popfd |
||
135 | mov edx, [eax+EVENT.id] |
||
136 | .fail: |
||
137 | add esp, 8 |
||
138 | ret |
||
139 | |||
140 | restore .flags |
||
141 | restore .data |
||
142 | |||
143 | ; param |
||
144 | ; eax= event |
||
145 | ; ebx= id |
||
146 | |||
147 | destroy_event: |
||
148 | |||
149 | cmp [eax+APPOBJ.magic], 'EVNT' |
||
150 | jne .fail |
||
151 | cmp [eax+EVENT.id], ebx |
||
152 | jne .fail |
||
363 | serge | 153 | .internal: |
354 | serge | 154 | mov ebx, [eax+APPOBJ.fd] |
155 | mov ecx, [eax+APPOBJ.bk] |
||
156 | mov [ebx+APPOBJ.bk], ecx |
||
157 | mov [ecx+APPOBJ.fd], ebx |
||
363 | serge | 158 | .force: |
354 | serge | 159 | xor edx, edx ;clear common header |
160 | mov [eax], edx |
||
161 | mov [eax+4], edx |
||
162 | mov [eax+8], edx |
||
163 | mov [eax+12], edx |
||
164 | mov [eax+16], edx |
||
165 | |||
166 | call free_event ;release object memory |
||
167 | .fail: |
||
168 | ret |
||
169 | |||
227 | serge | 170 | align 4 |
171 | proc send_event stdcall pid:dword, event:dword |
||
172 | locals |
||
173 | slot dd ? |
||
174 | endl |
||
175 | |||
176 | mov eax, [pid] |
||
177 | call pid_to_slot |
||
178 | test eax, eax |
||
179 | jz .fail |
||
180 | |||
181 | shl eax, 8 |
||
380 | serge | 182 | cmp [SLOT_BASE+eax+APPDATA.ev_count], 32 |
227 | serge | 183 | ja .fail |
184 | |||
185 | mov [slot], eax |
||
354 | serge | 186 | |
227 | serge | 187 | call alloc_event |
188 | test eax, eax |
||
189 | jz .fail |
||
190 | |||
354 | serge | 191 | lea edi, [eax+EVENT.code] |
227 | serge | 192 | mov ecx, 6 |
193 | mov esi, [event] |
||
194 | cld |
||
195 | rep movsd |
||
196 | |||
354 | serge | 197 | mov ecx, [slot] |
380 | serge | 198 | add ecx, SLOT_BASE+APP_EV_OFFSET |
354 | serge | 199 | |
200 | mov [eax+APPOBJ.magic], 'EVNT' |
||
201 | mov [eax+APPOBJ.destroy], destroy_event |
||
202 | mov ebx, [pid] |
||
203 | mov [eax+APPOBJ.pid], ebx |
||
204 | mov [eax+EVENT.state], EVENT_SIGNALED |
||
205 | |||
206 | pushfd |
||
207 | cli ;insert event into |
||
208 | mov edx, [ecx+APPOBJ.fd] ;events list |
||
209 | mov [eax+APPOBJ.fd], edx ;and set events flag |
||
210 | mov [eax+APPOBJ.bk], ecx |
||
211 | mov [ecx+APPOBJ.fd], eax |
||
212 | mov [edx+APPOBJ.bk], eax |
||
213 | inc [ecx+APPDATA.ev_count-APP_EV_OFFSET] |
||
214 | or [ecx+APPDATA.event_mask-APP_EV_OFFSET], EVENT_EXTENDED |
||
215 | popfd |
||
227 | serge | 216 | .fail: |
217 | ret |
||
218 | endp |
||
219 | |||
354 | serge | 220 | ; timeout ignored |
221 | |||
227 | serge | 222 | align 4 |
223 | proc get_event_ex stdcall, p_ev:dword, timeout:dword |
||
224 | |||
225 | .wait: |
||
465 | serge | 226 | mov edx,[current_slot] |
380 | serge | 227 | ; cmp [SLOT_BASE+edx+APPDATA.ev_count], 0 |
377 | serge | 228 | ; je .switch |
227 | serge | 229 | |
465 | serge | 230 | add edx, APP_EV_OFFSET |
227 | serge | 231 | |
377 | serge | 232 | mov eax, [edx+APPOBJ.fd] |
354 | serge | 233 | cmp eax, edx |
234 | je .switch |
||
235 | |||
236 | lea esi, [eax+EVENT.code] |
||
237 | mov edi, [p_ev] ;copy event data |
||
227 | serge | 238 | mov ecx, 6 |
239 | cld |
||
240 | rep movsd |
||
354 | serge | 241 | |
242 | and dword [edi-24], 0xFF00FFFF ;clear priority field |
||
377 | serge | 243 | ; |
354 | serge | 244 | test [eax+EVENT.state], MANUAL_RESET |
245 | jnz .done |
||
246 | |||
247 | pushfd |
||
248 | cli ;remove event from events |
||
249 | mov ebx, [eax+APPOBJ.fd] ;list (reset event) |
||
250 | mov ecx, [eax+APPOBJ.bk] ;and clear events flag |
||
251 | mov [ebx+APPOBJ.bk], ecx ;if no active events |
||
252 | mov [ecx+APPOBJ.fd], ebx |
||
377 | serge | 253 | |
254 | and [eax+EVENT.state], not (EVENT_SIGNALED+EVENT_WATCHED) |
||
255 | |||
354 | serge | 256 | dec [edx+APPDATA.ev_count-APP_EV_OFFSET] |
257 | jnz @F |
||
258 | and [edx+APPDATA.event_mask-APP_EV_OFFSET], not EVENT_EXTENDED |
||
377 | serge | 259 | @@: |
354 | serge | 260 | popfd |
261 | |||
262 | test [eax+EVENT.state], MANUAL_DESTROY |
||
263 | jz .destroy |
||
264 | |||
265 | add edx, (APP_OBJ_OFFSET-APP_EV_OFFSET) |
||
266 | |||
267 | pushfd |
||
268 | cli |
||
377 | serge | 269 | mov ebx, [edx+APPOBJ.fd] ;insert event into |
270 | mov [eax+APPOBJ.fd], ebx ;objects list |
||
271 | mov [eax+APPOBJ.bk], edx |
||
272 | mov [edx+APPOBJ.fd], eax |
||
273 | mov [ebx+APPOBJ.bk], eax |
||
354 | serge | 274 | popfd |
275 | .done: |
||
227 | serge | 276 | ret |
354 | serge | 277 | |
278 | .destroy: |
||
363 | serge | 279 | call destroy_event.force |
354 | serge | 280 | ret |
227 | serge | 281 | .switch: |
379 | serge | 282 | mov eax, [TASK_BASE] |
227 | serge | 283 | mov [eax+TASKDATA.state], byte 5 |
284 | call change_task |
||
285 | jmp .wait |
||
286 | endp |
||
287 | |||
354 | serge | 288 | ; param |
289 | ; eax= event |
||
290 | ; ebx= id |
||
291 | |||
292 | align 4 |
||
293 | wait_event: |
||
294 | .event equ esp |
||
295 | push eax |
||
296 | .wait: |
||
297 | cmp [eax+APPOBJ.magic], 'EVNT' |
||
298 | jne .done |
||
299 | cmp [eax+EVENT.id], ebx |
||
300 | jne .done |
||
301 | |||
302 | test [eax+EVENT.state], EVENT_SIGNALED |
||
303 | jz .switch |
||
304 | |||
305 | test [eax+EVENT.state], MANUAL_RESET |
||
306 | jnz .done |
||
307 | |||
465 | serge | 308 | mov edx,[current_slot] |
354 | serge | 309 | |
310 | pushfd |
||
311 | cli ;remove event from events |
||
312 | mov ebx, [eax+APPOBJ.fd] ;list (reset event) |
||
313 | mov ecx, [eax+APPOBJ.bk] ;and clear events flag |
||
314 | mov [ebx+APPOBJ.bk], ecx ;if no active events |
||
315 | mov [ecx+APPOBJ.fd], ebx |
||
316 | dec [edx+APPDATA.ev_count] |
||
317 | jnz @F |
||
318 | and [edx+APPDATA.event_mask], not EVENT_EXTENDED |
||
319 | @@: |
||
320 | and [eax+EVENT.state], not (EVENT_SIGNALED+EVENT_WATCHED) |
||
321 | popfd |
||
322 | |||
323 | test [eax+EVENT.state], MANUAL_DESTROY |
||
324 | jz .destroy |
||
325 | |||
326 | add edx, APP_OBJ_OFFSET |
||
327 | |||
328 | pushfd |
||
329 | cli |
||
330 | mov ecx, [edx+APPOBJ.fd] ;insert event into |
||
331 | mov [eax+APPOBJ.fd], ecx ;objects list |
||
332 | mov [eax+APPOBJ.bk], edx |
||
333 | mov [edx+APPOBJ.fd], eax |
||
334 | mov [ecx+APPOBJ.bk], eax |
||
335 | popfd |
||
336 | .done: |
||
337 | add esp, 4 |
||
338 | ret |
||
339 | .destroy: |
||
363 | serge | 340 | call destroy_event.force |
354 | serge | 341 | add esp, 4 |
342 | ret |
||
343 | .switch: |
||
344 | or [eax+EVENT.state], EVENT_WATCHED |
||
379 | serge | 345 | mov eax, [TASK_BASE] |
354 | serge | 346 | mov [eax+TASKDATA.state], byte 5 |
347 | call change_task |
||
348 | mov eax, [.event] |
||
349 | jmp .wait |
||
350 | restore .event |
||
351 | |||
352 | ; param |
||
353 | ; eax= event |
||
354 | ; ebx= id |
||
355 | ; ecx= flags |
||
377 | serge | 356 | ; edx= event data |
354 | serge | 357 | |
358 | raise_event: |
||
359 | .event equ esp |
||
360 | push eax |
||
361 | |||
362 | cmp [eax+APPOBJ.magic], 'EVNT' |
||
363 | jne .fail |
||
364 | cmp [eax+EVENT.id], ebx |
||
365 | jne .fail |
||
366 | |||
367 | mov eax, [eax+APPOBJ.pid] |
||
368 | call pid_to_slot |
||
369 | test eax, eax |
||
370 | jz .fail |
||
371 | |||
377 | serge | 372 | mov esi, edx |
373 | test esi, esi |
||
354 | serge | 374 | mov edx, [.event] |
377 | serge | 375 | jz @F |
376 | |||
377 | push ecx |
||
378 | lea edi, [edx+EVENT.code] |
||
379 | mov ecx, 6 |
||
380 | cld |
||
381 | rep movsd |
||
382 | pop ecx |
||
383 | @@: |
||
354 | serge | 384 | test [edx+EVENT.state], EVENT_SIGNALED |
385 | jnz .done |
||
386 | |||
387 | test ecx, EVENT_WATCHED |
||
388 | jz @F |
||
389 | test [edx+EVENT.state], EVENT_WATCHED |
||
390 | jz .done |
||
391 | @@: |
||
392 | shl eax, 8 |
||
380 | serge | 393 | add eax, SLOT_BASE+APP_EV_OFFSET |
354 | serge | 394 | |
395 | pushfd |
||
396 | cli |
||
397 | mov ebx, [edx+APPOBJ.fd] |
||
398 | mov ecx, [edx+APPOBJ.bk] |
||
399 | mov [ebx+APPOBJ.bk], ecx |
||
400 | mov [ecx+APPOBJ.fd], ebx |
||
401 | |||
402 | mov ecx, [eax+APPOBJ.fd] |
||
403 | mov [edx+APPOBJ.fd], ecx |
||
404 | mov [edx+APPOBJ.bk], eax |
||
405 | mov [eax+APPOBJ.fd], edx |
||
406 | mov [ecx+APPOBJ.bk], edx |
||
407 | or [edx+EVENT.state], EVENT_SIGNALED |
||
408 | |||
409 | inc [eax+APPDATA.ev_count-APP_EV_OFFSET] |
||
410 | or [eax+APPDATA.event_mask-APP_EV_OFFSET], EVENT_EXTENDED |
||
411 | popfd |
||
412 | .fail: |
||
413 | .done: |
||
414 | add esp, 4 |
||
415 | ret |
||
416 | restore .event |
||
417 | |||
377 | serge | 418 | ; param |
419 | ; eax= event |
||
420 | ; ebx= id |
||
421 | align 4 |
||
422 | clear_event: |
||
423 | .event equ esp |
||
424 | push eax |
||
425 | |||
426 | cmp [eax+APPOBJ.magic], 'EVNT' |
||
427 | jne .fail |
||
428 | cmp [eax+EVENT.id], ebx |
||
429 | jne .fail |
||
430 | |||
431 | mov eax, [eax+APPOBJ.pid] |
||
432 | call pid_to_slot |
||
433 | test eax, eax |
||
434 | jz .fail |
||
435 | |||
436 | shl eax, 8 |
||
380 | serge | 437 | add eax, SLOT_BASE+APP_EV_OFFSET |
377 | serge | 438 | mov edx, [.event] |
439 | pushfd |
||
440 | cli ;remove event from events |
||
441 | mov ebx, [edx+APPOBJ.fd] ;list (reset event) |
||
442 | mov ecx, [edx+APPOBJ.bk] ;and clear events flag |
||
443 | mov [ebx+APPOBJ.bk], ecx ;if no active events |
||
444 | mov [ecx+APPOBJ.fd], ebx |
||
445 | |||
446 | and [edx+EVENT.state], not (EVENT_SIGNALED+EVENT_WATCHED) |
||
447 | |||
448 | dec [eax+APPDATA.ev_count-APP_EV_OFFSET] |
||
449 | jnz @F |
||
450 | and [eax+APPDATA.event_mask-APP_EV_OFFSET], not EVENT_EXTENDED |
||
451 | @@: |
||
452 | add eax, (APP_OBJ_OFFSET-APP_EV_OFFSET) |
||
453 | |||
454 | mov ecx, [eax+APPOBJ.fd] ;insert event into |
||
455 | mov [edx+APPOBJ.fd], ecx ;objects list |
||
456 | mov [edx+APPOBJ.bk], eax |
||
457 | mov [eax+APPOBJ.fd], edx |
||
458 | mov [ecx+APPOBJ.bk], edx |
||
459 | popfd |
||
460 | .fail: |
||
461 | .done: |
||
462 | add esp, 4 |
||
463 | ret |
||
464 | restore .event |
||
465 | |||
1 | ha | 466 | sys_getevent: |
467 | |||
468 | call get_event_for_app |
||
469 | mov [esp+36],eax |
||
470 | ret |
||
471 | |||
531 | diamond | 472 | sys_waitforevent: |
473 | or eax, 0xFFFFFFFF ; infinite timeout |
||
474 | jmp @f |
||
1 | ha | 475 | |
476 | sys_wait_event_timeout: |
||
531 | diamond | 477 | add eax, [timer_ticks] |
478 | @@: |
||
479 | mov ebx, [current_slot] |
||
480 | mov [ebx + APPDATA.wait_timeout], eax |
||
481 | call get_event_for_app |
||
482 | test eax, eax |
||
483 | jnz eventoccur |
||
1 | ha | 484 | |
531 | diamond | 485 | mov eax, [TASK_BASE] |
486 | mov [eax+TASKDATA.state], byte 5 |
||
487 | call change_task |
||
1 | ha | 488 | |
531 | diamond | 489 | mov eax, [event_sched] |
490 | eventoccur: |
||
491 | mov [esp+36], eax |
||
492 | ret |
||
1 | ha | 493 | |
494 | get_event_for_app: |
||
495 | |||
496 | pushad |
||
497 | |||
379 | serge | 498 | mov edi,[TASK_BASE] ; WINDOW REDRAW |
531 | diamond | 499 | test [edi+TASKDATA.event_mask], 1 |
1 | ha | 500 | jz no_eventoccur1 |
379 | serge | 501 | ;mov edi,[TASK_BASE] |
115 | poddubny | 502 | cmp [edi-twdw+WDATA.fl_redraw],byte 0 |
1 | ha | 503 | je no_eventoccur1 |
504 | popad |
||
505 | mov eax,1 |
||
506 | ret |
||
507 | no_eventoccur1: |
||
508 | |||
379 | serge | 509 | ;mov edi,[TASK_BASE] ; KEY IN BUFFER |
115 | poddubny | 510 | test [edi+TASKDATA.event_mask],dword 2 |
1 | ha | 511 | jz no_eventoccur2 |
379 | serge | 512 | mov ecx, [CURRENT_TASK] |
380 | serge | 513 | movzx edx,word [WIN_STACK+ecx*2] |
379 | serge | 514 | mov eax, [TASK_COUNT] |
1 | ha | 515 | cmp eax,edx |
92 | diamond | 516 | jne no_eventoccur2x |
381 | serge | 517 | cmp [KEY_COUNT],byte 0 |
92 | diamond | 518 | je no_eventoccur2x |
519 | eventoccur2: |
||
1 | ha | 520 | popad |
521 | mov eax,2 |
||
522 | ret |
||
92 | diamond | 523 | no_eventoccur2x: |
524 | mov eax, hotkey_buffer |
||
525 | @@: |
||
526 | cmp [eax], ecx |
||
527 | jz eventoccur2 |
||
528 | add eax, 8 |
||
529 | cmp eax, hotkey_buffer+120*8 |
||
530 | jb @b |
||
1 | ha | 531 | no_eventoccur2: |
532 | |||
379 | serge | 533 | ;mov edi,[TASK_BASE] ; BUTTON IN BUFFER |
115 | poddubny | 534 | test [edi+TASKDATA.event_mask],dword 4 |
1 | ha | 535 | jz no_eventoccur3 |
381 | serge | 536 | cmp [BTN_COUNT],byte 0 |
21 | poddubny | 537 | je no_eventoccur3 |
379 | serge | 538 | mov ecx, [CURRENT_TASK] |
380 | serge | 539 | movzx edx, word [WIN_STACK+ecx*2] |
379 | serge | 540 | mov eax, [TASK_COUNT] |
1 | ha | 541 | cmp eax,edx |
542 | jnz no_eventoccur3 |
||
543 | popad |
||
381 | serge | 544 | mov eax,[BTN_BUFF] |
1 | ha | 545 | cmp eax,65535 |
546 | je no_event_1 |
||
547 | mov eax,3 |
||
548 | ret |
||
549 | |||
550 | no_event_1: |
||
551 | mov [window_minimize],1 |
||
381 | serge | 552 | mov [BTN_COUNT],byte 0 |
1 | ha | 553 | xor eax, eax |
554 | ret |
||
555 | |||
465 | serge | 556 | no_eventoccur3: |
227 | serge | 557 | |
379 | serge | 558 | ;mov edi,[TASK_BASE] ; mouse event |
473 | diamond | 559 | mov eax, [CURRENT_TASK] |
560 | shl eax, 8 |
||
561 | add eax, SLOT_BASE |
||
115 | poddubny | 562 | test [edi+TASKDATA.event_mask],dword 00100000b |
21 | poddubny | 563 | jz no_mouse_event |
465 | serge | 564 | |
473 | diamond | 565 | test [eax+APPDATA.event_mask],dword 00100000b |
21 | poddubny | 566 | jz no_mouse_event |
473 | diamond | 567 | and [eax+APPDATA.event_mask],dword (not 00100000b) |
21 | poddubny | 568 | popad |
569 | mov eax,6 |
||
570 | ret |
||
465 | serge | 571 | no_mouse_event: |
1 | ha | 572 | |
379 | serge | 573 | ;mov edi,[TASK_BASE] ; DESKTOP BACKGROUND REDRAW |
473 | diamond | 574 | test [edi+TASKDATA.event_mask], 16 |
1 | ha | 575 | jz no_eventoccur5 |
473 | diamond | 576 | ; cmp [REDRAW_BACKGROUND],byte 2 |
577 | ; jnz no_eventoccur5 |
||
578 | test [eax+APPDATA.event_mask], 16 |
||
579 | jz no_eventoccur5 |
||
580 | and [eax+APPDATA.event_mask], not 16 |
||
1 | ha | 581 | popad |
582 | mov eax,5 |
||
583 | ret |
||
465 | serge | 584 | no_eventoccur5: |
1 | ha | 585 | |
379 | serge | 586 | ;mov edi,[TASK_BASE] ; IPC |
115 | poddubny | 587 | test [edi+TASKDATA.event_mask],dword 01000000b |
1 | ha | 588 | jz no_ipc |
473 | diamond | 589 | test [eax+APPDATA.event_mask],dword 01000000b |
1 | ha | 590 | jz no_ipc |
473 | diamond | 591 | and [eax+APPDATA.event_mask],dword 0xffffffff-01000000b |
1 | ha | 592 | popad |
593 | mov eax,7 |
||
594 | ret |
||
465 | serge | 595 | no_ipc: |
1 | ha | 596 | |
379 | serge | 597 | ;mov edi,[TASK_BASE] ; STACK |
115 | poddubny | 598 | test [edi+TASKDATA.event_mask],dword 10000000b |
1 | ha | 599 | jz no_stack_event |
473 | diamond | 600 | test [eax+APPDATA.event_mask],dword 10000000b |
1 | ha | 601 | jz no_stack_event |
473 | diamond | 602 | and [eax+APPDATA.event_mask],dword 0xffffffff-10000000b |
1 | ha | 603 | popad |
21 | poddubny | 604 | mov eax,8 |
1 | ha | 605 | ret |
465 | serge | 606 | no_stack_event: |
1 | ha | 607 | |
115 | poddubny | 608 | test byte [edi+TASKDATA.event_mask+1], 1 ; DEBUG |
354 | serge | 609 | jz .test_IRQ |
473 | diamond | 610 | test byte [eax+APPDATA.event_mask+1], byte 1 |
354 | serge | 611 | jz .test_IRQ |
473 | diamond | 612 | and byte [eax+APPDATA.event_mask+1], not 1 |
40 | halyavin | 613 | popad |
614 | mov eax, 9 |
||
615 | ret |
||
616 | |||
354 | serge | 617 | ;.test_ext: |
379 | serge | 618 | ; mov eax, [CURRENT_TASK] |
354 | serge | 619 | ; shl eax, 8 |
380 | serge | 620 | ; test dword [eax+SLOT_BASE+APPDATA.event_mask], EVENT_EXTENDED |
354 | serge | 621 | ; jz .test_IRQ |
622 | ; popad |
||
623 | ; mov eax, 10 |
||
624 | ; ret |
||
227 | serge | 625 | |
626 | .test_IRQ: |
||
115 | poddubny | 627 | cmp dword [edi+TASKDATA.event_mask], 0xFFFF |
21 | poddubny | 628 | jbe no_events |
1 | ha | 629 | |
381 | serge | 630 | mov esi,IRQ_SAVE ; IRQ'S AND DATA |
1 | ha | 631 | mov ebx,0x00010000 |
632 | xor ecx, ecx |
||
633 | irq_event_test: |
||
379 | serge | 634 | mov edi,[TASK_BASE] |
115 | poddubny | 635 | test [edi+TASKDATA.event_mask],ebx |
1 | ha | 636 | jz no_irq_event |
637 | mov edi,ecx |
||
638 | shl edi,2 |
||
639 | add edi,irq_owner |
||
640 | mov edx,[edi] |
||
379 | serge | 641 | mov eax,[TASK_BASE] |
115 | poddubny | 642 | mov eax,[eax+TASKDATA.pid] |
1 | ha | 643 | cmp edx,eax |
644 | jne no_irq_event |
||
645 | cmp [esi],dword 0 |
||
646 | jz no_irq_event |
||
647 | mov eax,ecx |
||
648 | add eax,16 |
||
649 | mov [esp+28],eax |
||
650 | popad |
||
651 | ret |
||
652 | no_irq_event: |
||
653 | add esi,0x1000 |
||
654 | shl ebx,1 |
||
655 | inc ecx |
||
656 | cmp ecx,16 |
||
657 | jb irq_event_test |
||
658 | |||
21 | poddubny | 659 | no_events: |
1 | ha | 660 | popad |
661 | xor eax, eax |
||
662 | ret |
||
663 |