Rev 21 | Rev 115 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | ha | 1 | sys_getevent: |
2 | |||
3 | call get_event_for_app |
||
4 | mov [esp+36],eax |
||
5 | ret |
||
6 | |||
7 | |||
8 | align 4 |
||
9 | |||
10 | sys_wait_event_timeout: |
||
11 | |||
21 | poddubny | 12 | mov ebx,[timer_ticks] |
1 | ha | 13 | add ebx,eax |
21 | poddubny | 14 | cmp ebx,[timer_ticks] |
1 | ha | 15 | jna .swfet2 |
16 | .swfet1: |
||
17 | call get_event_for_app |
||
18 | test eax,eax |
||
19 | jne .eventoccur_time |
||
20 | call change_task |
||
21 | poddubny | 21 | cmp ebx,[timer_ticks] |
1 | ha | 22 | jg .swfet1 |
23 | .swfet2: |
||
24 | xor eax,eax |
||
25 | .eventoccur_time: |
||
26 | mov [esp+36],eax |
||
27 | ret |
||
28 | |||
29 | |||
30 | align 4 |
||
31 | |||
32 | sys_waitforevent: |
||
33 | |||
34 | call get_event_for_app |
||
35 | test eax,eax |
||
36 | jne eventoccur |
||
37 | newwait: |
||
38 | |||
21 | poddubny | 39 | mov eax, [0x3010] |
40 | mov [eax+0xA], byte 5 |
||
1 | ha | 41 | call change_task |
42 | |||
21 | poddubny | 43 | mov eax, [event_sched] |
44 | |||
1 | ha | 45 | eventoccur: |
46 | mov [esp+36],eax |
||
47 | ret |
||
48 | |||
49 | |||
50 | get_event_for_app: |
||
51 | |||
52 | pushad |
||
53 | |||
54 | mov edi,[0x3010] ; WINDOW REDRAW |
||
55 | test [edi],dword 1 |
||
56 | jz no_eventoccur1 |
||
21 | poddubny | 57 | ;mov edi,[0x3010] |
1 | ha | 58 | cmp [edi-twdw+31],byte 0 |
59 | je no_eventoccur1 |
||
60 | popad |
||
61 | mov eax,1 |
||
62 | ret |
||
63 | no_eventoccur1: |
||
64 | |||
21 | poddubny | 65 | ;mov edi,[0x3010] ; KEY IN BUFFER |
1 | ha | 66 | test [edi],dword 2 |
67 | jz no_eventoccur2 |
||
68 | mov ecx, [0x3000] |
||
69 | movzx edx,word [0xC000+ecx*2] |
||
70 | mov eax, [0x3004] |
||
71 | cmp eax,edx |
||
72 | jne no_eventoccur2 |
||
73 | cmp [0xf400],byte 0 |
||
74 | je no_eventoccur2 |
||
75 | popad |
||
76 | mov eax,2 |
||
77 | ret |
||
78 | no_eventoccur2: |
||
79 | |||
21 | poddubny | 80 | ;mov edi,[0x3010] ; BUTTON IN BUFFER |
1 | ha | 81 | test [edi],dword 4 |
82 | jz no_eventoccur3 |
||
21 | poddubny | 83 | cmp [0xf500],byte 0 |
84 | je no_eventoccur3 |
||
1 | ha | 85 | mov ecx, [0x3000] |
86 | movzx edx, word [0xC000+ecx*2] |
||
87 | mov eax, [0x3004] |
||
88 | cmp eax,edx |
||
89 | jnz no_eventoccur3 |
||
90 | popad |
||
91 | mov eax,[0xf501] |
||
92 | cmp eax,65535 |
||
93 | je no_event_1 |
||
94 | mov eax,3 |
||
95 | ret |
||
96 | |||
97 | no_event_1: |
||
98 | mov [window_minimize],1 |
||
99 | mov [0xf500],byte 0 |
||
100 | xor eax, eax |
||
101 | ret |
||
102 | |||
103 | no_eventoccur3: |
||
21 | poddubny | 104 | |
105 | |||
106 | ;mov edi,[0x3010] ; mouse event |
||
107 | test [edi],dword 00100000b |
||
108 | jz no_mouse_event |
||
109 | mov eax,[0x3000] |
||
110 | shl eax,8 |
||
111 | test [eax+0x80000+0xA8],dword 00100000b |
||
112 | jz no_mouse_event |
||
113 | and [eax+0x80000+0xA8],dword 0xffffffff-00100000b |
||
114 | popad |
||
115 | mov eax,6 |
||
116 | ret |
||
117 | no_mouse_event: |
||
118 | |||
1 | ha | 119 | |
21 | poddubny | 120 | ;mov edi,[0x3010] ; DESKTOP BACKGROUND REDRAW |
1 | ha | 121 | test [edi],dword 16 |
122 | jz no_eventoccur5 |
||
123 | cmp [0xfff0],byte 2 |
||
124 | jnz no_eventoccur5 |
||
125 | popad |
||
126 | mov eax,5 |
||
127 | ret |
||
128 | no_eventoccur5: |
||
129 | |||
21 | poddubny | 130 | ;mov edi,[0x3010] ; IPC |
1 | ha | 131 | test [edi],dword 01000000b |
132 | jz no_ipc |
||
21 | poddubny | 133 | mov eax,[0x3000] |
134 | shl eax,8 |
||
135 | test [eax+0x80000+0xA8],dword 01000000b |
||
1 | ha | 136 | jz no_ipc |
21 | poddubny | 137 | and [eax+0x80000+0xA8],dword 0xffffffff-01000000b |
1 | ha | 138 | popad |
139 | mov eax,7 |
||
140 | ret |
||
141 | no_ipc: |
||
142 | |||
143 | |||
21 | poddubny | 144 | ;mov edi,[0x3010] ; STACK |
1 | ha | 145 | test [edi],dword 10000000b |
146 | jz no_stack_event |
||
21 | poddubny | 147 | mov eax,[0x3000] |
148 | shl eax,8 |
||
149 | test [eax+0x80000+0xA8],dword 10000000b |
||
1 | ha | 150 | jz no_stack_event |
21 | poddubny | 151 | and [eax+0x80000+0xA8],dword 0xffffffff-10000000b |
1 | ha | 152 | popad |
21 | poddubny | 153 | mov eax,8 |
1 | ha | 154 | ret |
155 | no_stack_event: |
||
156 | |||
40 | halyavin | 157 | test byte [edi+1], 1 ; DEBUG |
158 | jz no_debug_event |
||
159 | mov eax, [0x3000] |
||
160 | shl eax, 8 |
||
161 | test [eax+0x80000+0xA8+1], byte 1 |
||
162 | jz no_debug_event |
||
163 | and byte [eax+0x80000+0xA8+1], not 1 |
||
164 | popad |
||
165 | mov eax, 9 |
||
166 | ret |
||
167 | no_debug_event: |
||
168 | |||
21 | poddubny | 169 | cmp dword [edi], 0xFFFF |
170 | jbe no_events |
||
1 | ha | 171 | |
172 | mov esi,0x2e0000 ; IRQ'S AND DATA |
||
173 | mov ebx,0x00010000 |
||
174 | xor ecx, ecx |
||
175 | irq_event_test: |
||
176 | mov edi,[0x3010] |
||
177 | test [edi],ebx |
||
178 | jz no_irq_event |
||
179 | mov edi,ecx |
||
180 | shl edi,2 |
||
181 | add edi,irq_owner |
||
182 | mov edx,[edi] |
||
183 | mov eax,[0x3010] |
||
184 | mov eax,[eax+0x4] |
||
185 | cmp edx,eax |
||
186 | jne no_irq_event |
||
187 | cmp [esi],dword 0 |
||
188 | jz no_irq_event |
||
189 | mov eax,ecx |
||
190 | add eax,16 |
||
191 | mov [esp+28],eax |
||
192 | popad |
||
193 | ret |
||
194 | no_irq_event: |
||
195 | add esi,0x1000 |
||
196 | shl ebx,1 |
||
197 | inc ecx |
||
198 | cmp ecx,16 |
||
199 | jb irq_event_test |
||
200 | |||
21 | poddubny | 201 | no_events: |
1 | ha | 202 | popad |
203 | xor eax, eax |
||
204 | ret |
||
205 |