Rev 2 | Go to most recent revision | Details | 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 | |||
12 | mov ebx,[timer_ticks];[0xfdf0] |
||
13 | add ebx,eax |
||
14 | cmp ebx,[timer_ticks];[0xfdf0] |
||
15 | jna .swfet2 |
||
16 | .swfet1: |
||
17 | call get_event_for_app |
||
18 | test eax,eax |
||
19 | jne .eventoccur_time |
||
20 | call change_task |
||
21 | cmp ebx,[timer_ticks];[0xfdf0] |
||
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 | |||
39 | call change_task |
||
40 | call get_event_for_app |
||
41 | test eax,eax |
||
42 | je newwait |
||
43 | |||
44 | eventoccur: |
||
45 | mov [esp+36],eax |
||
46 | ret |
||
47 | |||
48 | |||
49 | get_event_for_app: |
||
50 | |||
51 | pushad |
||
52 | |||
53 | mov edi,[0x3010] ; WINDOW REDRAW |
||
54 | test [edi],dword 1 |
||
55 | jz no_eventoccur1 |
||
56 | mov edi,[0x3010] |
||
57 | cmp [edi-twdw+31],byte 0 |
||
58 | je no_eventoccur1 |
||
59 | popad |
||
60 | mov eax,1 |
||
61 | ret |
||
62 | no_eventoccur1: |
||
63 | |||
64 | mov edi,[0x3010] ; KEY IN BUFFER |
||
65 | test [edi],dword 2 |
||
66 | jz no_eventoccur2 |
||
67 | mov ecx, [0x3000] |
||
68 | movzx edx,word [0xC000+ecx*2] |
||
69 | mov eax, [0x3004] |
||
70 | cmp eax,edx |
||
71 | jne no_eventoccur2 |
||
72 | cmp [0xf400],byte 0 |
||
73 | je no_eventoccur2 |
||
74 | popad |
||
75 | mov eax,2 |
||
76 | ret |
||
77 | no_eventoccur2: |
||
78 | |||
79 | mov edi,[0x3010] ; BUTTON IN BUFFER |
||
80 | test [edi],dword 4 |
||
81 | jz no_eventoccur3 |
||
82 | mov ecx, [0x3000] |
||
83 | movzx edx, word [0xC000+ecx*2] |
||
84 | mov eax, [0x3004] |
||
85 | cmp eax,edx |
||
86 | jnz no_eventoccur3 |
||
87 | cmp [0xf500],byte 0 |
||
88 | je no_eventoccur3 |
||
89 | popad |
||
90 | mov eax,[0xf501] |
||
91 | cmp eax,65535 |
||
92 | je no_event_1 |
||
93 | mov eax,3 |
||
94 | ret |
||
95 | |||
96 | no_event_1: |
||
97 | mov [window_minimize],1 |
||
98 | mov [0xf500],byte 0 |
||
99 | xor eax, eax |
||
100 | ret |
||
101 | |||
102 | no_eventoccur3: |
||
103 | |||
104 | mov edi,[0x3010] ; DESKTOP BACKGROUND REDRAW |
||
105 | test [edi],dword 16 |
||
106 | jz no_eventoccur5 |
||
107 | cmp [0xfff0],byte 2 |
||
108 | jnz no_eventoccur5 |
||
109 | popad |
||
110 | mov eax,5 |
||
111 | ret |
||
112 | no_eventoccur5: |
||
113 | |||
114 | mov edi,[0x3010] ; mouse event |
||
115 | test [edi],dword 00100000b |
||
116 | jz no_mouse_event |
||
117 | mov edi,[0x3000] |
||
118 | shl edi,8 |
||
119 | test [edi+0x80000+0xA8],dword 00100000b |
||
120 | jz no_mouse_event |
||
121 | and [edi+0x80000+0xA8],dword 0xffffffff-00100000b |
||
122 | popad |
||
123 | mov eax,6 |
||
124 | ret |
||
125 | no_mouse_event: |
||
126 | |||
127 | mov edi,[0x3010] ; IPC |
||
128 | test [edi],dword 01000000b |
||
129 | jz no_ipc |
||
130 | mov edi,[0x3000] |
||
131 | shl edi,8 |
||
132 | test [edi+0x80000+0xA8],dword 01000000b |
||
133 | jz no_ipc |
||
134 | and [edi+0x80000+0xA8],dword 0xffffffff-01000000b |
||
135 | popad |
||
136 | mov eax,7 |
||
137 | ret |
||
138 | no_ipc: |
||
139 | |||
140 | |||
141 | mov edi,[0x3010] ; STACK |
||
142 | test [edi],dword 10000000b |
||
143 | jz no_stack_event |
||
144 | mov edi,[0x3000] |
||
145 | shl edi,8 |
||
146 | test [edi+0x80000+0xA8],dword 10000000b |
||
147 | jz no_stack_event |
||
148 | and [edi+0x80000+0xA8],dword 0xffffffff-10000000b |
||
149 | popad |
||
150 | mov eax,7 |
||
151 | ret |
||
152 | no_stack_event: |
||
153 | |||
154 | |||
155 | mov esi,0x2e0000 ; IRQ'S AND DATA |
||
156 | mov ebx,0x00010000 |
||
157 | xor ecx, ecx |
||
158 | irq_event_test: |
||
159 | mov edi,[0x3010] |
||
160 | test [edi],ebx |
||
161 | jz no_irq_event |
||
162 | mov edi,ecx |
||
163 | shl edi,2 |
||
164 | add edi,irq_owner |
||
165 | mov edx,[edi] |
||
166 | mov eax,[0x3010] |
||
167 | mov eax,[eax+0x4] |
||
168 | cmp edx,eax |
||
169 | jne no_irq_event |
||
170 | cmp [esi],dword 0 |
||
171 | jz no_irq_event |
||
172 | mov eax,ecx |
||
173 | add eax,16 |
||
174 | mov [esp+28],eax |
||
175 | popad |
||
176 | ret |
||
177 | no_irq_event: |
||
178 | add esi,0x1000 |
||
179 | shl ebx,1 |
||
180 | inc ecx |
||
181 | cmp ecx,16 |
||
182 | jb irq_event_test |
||
183 | |||
184 | popad |
||
185 | xor eax, eax |
||
186 | ret |
||
187 |