Rev 8236 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
8140 | IgorA | 1 | ;const int |
2 | KOLIBRI_BORDER_SIZE = 4; |
||
3 | ;const int |
||
4 | KOLIBRI_HEADER_SIZE = 20; |
||
5 | |||
6 | ;const int |
||
7 | KOLIBRI_THREAD_DATA_USER = 0; // Thread data begin from the user dword |
||
8 | ;const int |
||
9 | KOLIBRI_THREAD_DATA_ST_BEGIN = 1; // Stack beginning follows after the user dword |
||
10 | ;const int |
||
11 | KOLIBRI_THREAD_DATA_NEXT = 2; |
||
12 | ;const int |
||
13 | KOLIBRI_THREAD_DATA_PID = 3; |
||
14 | ;const int |
||
15 | KOLIBRI_THREAD_DATA_FLAG = 4; |
||
16 | ;const int |
||
17 | KOLIBRI_THREAD_DATA_X = 5; |
||
18 | ;const int |
||
19 | KOLIBRI_THREAD_DATA_Y = 6; |
||
20 | ;const int |
||
21 | KOLIBRI_THREAD_DATA_C_WINDOW = 7; |
||
22 | ;const int |
||
23 | KOLIBRI_THREAD_DATA_C_HEADER = 8; |
||
24 | ;const int |
||
25 | KOLIBRI_THREAD_DATA_C_BORDER = 9; |
||
26 | ;const int |
||
27 | KOLIBRI_THREAD_DATA_C_TITLE = 10; |
||
28 | ;const int |
||
29 | KOLIBRI_THREAD_DATA_TITLE = 11; |
||
30 | ;const int |
||
31 | KOLIBRI_THREAD_DATA_PICTURE = 12; |
||
32 | ;const int |
||
33 | KOLIBRI_THREAD_DATA_SZ_PICT = 13; |
||
34 | ;const int |
||
35 | KOLIBRI_THREAD_DATA_LAST_SX = 14; |
||
36 | ;const int |
||
37 | KOLIBRI_THREAD_DATA_LAST_SY = 15; |
||
38 | ;const int |
||
39 | KOLIBRI_THREAD_DATA_LEN = 16; |
||
40 | |||
41 | ;const int |
||
42 | KOLIBRI_MUTEX_MAX_TIME_WAIT = 20; |
||
43 | |||
44 | ;/*** |
||
45 | |||
46 | macro segment name |
||
47 | { |
||
48 | segment name |
||
49 | if name eq _init_ | name eq _INIT_ |
||
50 | Kolibri_SegmentInit: |
||
51 | else if name eq _exit_ | name eq _EXIT_ |
||
52 | Kolibri_SegmentExit: |
||
53 | end if |
||
54 | } |
||
55 | |||
56 | macro endseg name |
||
57 | { |
||
58 | if name eq _init_ | name eq _INIT_ |
||
59 | Kolibri_SegmentInitEnd: |
||
60 | else if name eq _exit_ | name eq _EXIT_ |
||
61 | Kolibri_SegmentExitEnd: |
||
62 | end if |
||
63 | endseg name |
||
64 | } |
||
65 | |||
66 | macro Kolibri_Put_MovEaxVal_Ret address,val |
||
67 | { |
||
68 | mov byte [address],0xB8 |
||
69 | mov dword [address+4],0xC089C300 |
||
70 | mov dword [address+1],val |
||
71 | } |
||
72 | |||
8283 | IgorA | 73 | align 4 |
8140 | IgorA | 74 | proc @Kolibri@Main$qv |
75 | and esp,not 3 |
||
76 | sub esp,1024 |
||
8165 | IgorA | 77 | mov eax,SF_THREAD_INFO |
8140 | IgorA | 78 | mov ebx,esp |
79 | mov ecx,-1 |
||
80 | int 0x40 |
||
8236 | IgorA | 81 | mov ebx,[esp+process_information.used_memory] |
82 | mov edx,[esp+process_information.PID] |
||
8140 | IgorA | 83 | lea eax,[ebx-0x20] |
84 | add esp,1024 |
||
85 | cmp esp,eax |
||
86 | cmova esp,eax |
||
87 | and esp,not 3 |
||
88 | xor eax,eax |
||
89 | cld |
||
90 | mov edi,@Kolibri@_ThreadTable |
||
91 | mov ecx,256 |
||
8165 | IgorA | 92 | rep stosd |
8140 | IgorA | 93 | mov esi,@Kolibri@GetPid$qv |
94 | mov edi,@Kolibri@_ThreadSavedBegProc |
||
8165 | IgorA | 95 | movsd |
96 | movsd |
||
8140 | IgorA | 97 | mov esi,@Kolibri@GetThreadData$qv |
8165 | IgorA | 98 | movsd |
99 | movsd |
||
8140 | IgorA | 100 | Kolibri_Put_MovEaxVal_Ret @Kolibri@GetPid$qv,edx |
101 | if defined KolibriHeapInit |
||
8196 | IgorA | 102 | call KolibriHeapInit ; Initialize a dynamic heap |
103 | end if |
||
8140 | IgorA | 104 | xor eax,eax |
105 | push eax |
||
106 | push eax |
||
107 | call @Kolibri@ThreadMain$qpvt1 |
||
108 | .ThreadFinish: |
||
109 | add esp,8 |
||
110 | if defined KolibriHeapFreeAndThreadFinish |
||
111 | test eax,eax |
||
112 | jz .ThreadFinish_end |
||
113 | push dword @Kolibri@_ExitProcessNow |
||
114 | push eax |
||
115 | call KolibriHeapFreeAndThreadFinish ; Free the given memory and finish the thread, |
||
116 | end if ; should exit process if second argument points to not zero. |
||
117 | .ThreadFinish_end: |
||
118 | or eax,-1 |
||
119 | int 0x40 |
||
120 | endp |
||
121 | |||
8283 | IgorA | 122 | align 4 |
8140 | IgorA | 123 | proc @Kolibri@ThreadMain$qpvt1 |
124 | xchg ebx,[esp+4] |
||
125 | xchg ebp,[esp+8] |
||
126 | push esi edi |
||
127 | sub esp,KOLIBRI_THREAD_DATA_LEN*4 |
||
128 | mov [esp],ebx |
||
129 | mov [esp+4],ebp |
||
8165 | IgorA | 130 | mov eax,SF_SET_EVENTS_MASK |
8140 | IgorA | 131 | mov ebx,0x27 |
132 | int 0x40 |
||
133 | mov ebx,esp |
||
134 | cmp byte [@Kolibri@_ThreadSavedBegProc],0x90 |
||
135 | jz .main_else_first_check |
||
136 | Kolibri_Put_MovEaxVal_Ret @Kolibri@GetThreadData$qv,esp |
||
137 | if defined Kolibri_SegmentInit & defined Kolibri_SegmentInitEnd |
||
138 | push Kolibri_SegmentInitEnd |
||
139 | push Kolibri_SegmentInit |
||
140 | jmp .main_after_first_check |
||
141 | end if |
||
142 | .main_else_first_check: |
||
143 | xor eax,eax |
||
144 | push eax eax |
||
145 | .main_after_first_check: |
||
146 | push ebx |
||
147 | call @@Kolibri@_CallStart$qppvpvt2 |
||
148 | add esp,12 |
||
149 | test al,al |
||
150 | jnz .main_test_close_first |
||
151 | jmp .main_end |
||
152 | .main_close_first: |
||
153 | btr dword [esp+KOLIBRI_THREAD_DATA_FLAG*4],31 |
||
8165 | IgorA | 154 | if defined @@KolibriOnClose$qppv |
8140 | IgorA | 155 | push esp |
156 | call @@KolibriOnClose$qppv |
||
157 | pop ecx |
||
158 | test al,al |
||
159 | jnz .main_end |
||
8165 | IgorA | 160 | end if |
8140 | IgorA | 161 | .main_test_close_first: |
162 | cmp dword [esp+KOLIBRI_THREAD_DATA_FLAG*4],0 |
||
163 | jl .main_close_first |
||
164 | ; push esp |
||
165 | ; push dword 1 |
||
166 | ; call @Kolibri@Redraw$qippv |
||
167 | ; add esp,8 |
||
168 | .main_paint_msg: |
||
169 | or dword [esp+KOLIBRI_THREAD_DATA_FLAG*4],3 |
||
170 | sub esp,1024 |
||
8165 | IgorA | 171 | mov eax,SF_THREAD_INFO |
8140 | IgorA | 172 | mov ebx,esp |
173 | mov ecx,-1 |
||
174 | int 0x40 |
||
8236 | IgorA | 175 | mov eax,[esp+process_information.box.left] |
176 | mov ebx,[esp+process_information.box.top] |
||
177 | mov ecx,[esp+process_information.box.width] |
||
178 | mov edx,[esp+process_information.box.height] |
||
8140 | IgorA | 179 | add esp,1024 |
180 | cmp ecx,[esp+KOLIBRI_THREAD_DATA_LAST_SX*4] |
||
181 | jnz .main_size |
||
182 | cmp edx,[esp+KOLIBRI_THREAD_DATA_LAST_SY*4] |
||
183 | jz .main_paint |
||
184 | .main_size: |
||
185 | mov [esp+KOLIBRI_THREAD_DATA_LAST_SX*4],ecx |
||
186 | mov [esp+KOLIBRI_THREAD_DATA_LAST_SY*4],edx |
||
8165 | IgorA | 187 | if defined @@KolibriOnSize$qpippv |
8140 | IgorA | 188 | push edx |
189 | push ecx |
||
190 | push ebx |
||
191 | push eax |
||
192 | lea ecx,[esp+16] |
||
193 | mov edx,esp |
||
194 | push ecx |
||
195 | push edx |
||
196 | call @@KolibriOnSize$qpippv |
||
197 | add esp,24 |
||
8165 | IgorA | 198 | end if |
8140 | IgorA | 199 | test dword [esp+KOLIBRI_THREAD_DATA_FLAG*4],3 |
200 | jz .main_cycle |
||
201 | .main_paint: |
||
202 | cmp dword [esp+KOLIBRI_THREAD_DATA_FLAG*4],0 |
||
203 | jl .main_close |
||
204 | push esp |
||
205 | push dword 0 |
||
206 | call @Kolibri@Redraw$qippv |
||
207 | add esp,8 |
||
208 | .main_cycle: |
||
8165 | IgorA | 209 | mov eax,SF_CHECK_EVENT |
8140 | IgorA | 210 | .main_message: |
211 | cmp dword [esp+KOLIBRI_THREAD_DATA_FLAG*4],0 |
||
212 | jl .main_close |
||
213 | int 0x40 |
||
214 | test eax,eax |
||
215 | jnz .main_on_message |
||
216 | cmp dword [esp+KOLIBRI_THREAD_DATA_FLAG*4],0 |
||
217 | jne .main_paint |
||
8165 | IgorA | 218 | if defined @@KolibriOnIdle$qppv |
8140 | IgorA | 219 | push esp |
220 | call @@KolibriOnIdle$qppv |
||
221 | pop ecx |
||
8165 | IgorA | 222 | else |
223 | or eax,-1 |
||
224 | end if |
||
8140 | IgorA | 225 | test eax,eax |
226 | jz .main_cycle |
||
227 | jl .main_wait_message |
||
228 | mov ebx,eax |
||
8165 | IgorA | 229 | mov eax,SF_WAIT_EVENT_TIMEOUT |
8140 | IgorA | 230 | jmp .main_message |
231 | .main_wait_message: |
||
8165 | IgorA | 232 | mov eax,SF_WAIT_EVENT |
8140 | IgorA | 233 | jmp .main_message |
8165 | IgorA | 234 | if defined @@KolibriOnKeyPress$qppv |
8140 | IgorA | 235 | .main_key_press: |
236 | push esp |
||
237 | call @@KolibriOnKeyPress$qppv |
||
238 | pop ecx |
||
239 | jmp .main_cycle |
||
8165 | IgorA | 240 | end if |
241 | if defined @@KolibriOnMouse$qppv |
||
8140 | IgorA | 242 | .main_mouse: |
243 | push esp |
||
244 | call @@KolibriOnMouse$qppv |
||
245 | pop ecx |
||
246 | jmp .main_cycle |
||
8165 | IgorA | 247 | end if |
248 | |||
249 | align 4 |
||
8140 | IgorA | 250 | .main_on_message: |
251 | dec eax |
||
252 | jz .main_paint_msg |
||
253 | dec eax |
||
8165 | IgorA | 254 | if defined @@KolibriOnKeyPress$qppv |
8140 | IgorA | 255 | jz .main_key_press |
8165 | IgorA | 256 | else |
257 | jz .main_cycle |
||
258 | end if |
||
8140 | IgorA | 259 | cmp eax,4 |
8165 | IgorA | 260 | if defined @@KolibriOnMouse$qppv |
8140 | IgorA | 261 | jz .main_mouse |
8165 | IgorA | 262 | else |
263 | jz .main_cycle |
||
264 | end if |
||
8140 | IgorA | 265 | dec eax |
266 | jnz .main_cycle |
||
8165 | IgorA | 267 | |
268 | align 4 |
||
8140 | IgorA | 269 | .main_button: |
8165 | IgorA | 270 | mov eax,SF_GET_BUTTON |
8140 | IgorA | 271 | int 0x40 |
8165 | IgorA | 272 | shr eax,8 |
273 | cmp eax,1 |
||
274 | je .main_close |
||
275 | if defined @@KolibriOnButton$qlppv |
||
276 | push esp |
||
277 | push eax |
||
278 | call @@KolibriOnButton$qlppv |
||
279 | add esp,8 |
||
280 | end if |
||
281 | jmp .main_cycle |
||
8140 | IgorA | 282 | .main_close: |
283 | btr dword [esp+KOLIBRI_THREAD_DATA_FLAG*4],31 |
||
8165 | IgorA | 284 | if defined @@KolibriOnClose$qppv |
8140 | IgorA | 285 | push esp |
286 | call @@KolibriOnClose$qppv |
||
287 | pop ecx |
||
288 | test al,al |
||
289 | jz .main_button |
||
8165 | IgorA | 290 | end if |
8140 | IgorA | 291 | .main_end: |
292 | mov ebx,esp |
||
293 | lock dec dword [@Kolibri@_ThreadNumber] |
||
294 | if defined Kolibri_SegmentExit & defined Kolibri_SegmentExitEnd |
||
295 | jnz .main_else_last_check |
||
296 | push Kolibri_SegmentExitEnd |
||
297 | push Kolibri_SegmentExit |
||
298 | jmp .main_after_last_check |
||
299 | end if |
||
300 | .main_else_last_check: |
||
301 | xor eax,eax |
||
302 | push eax |
||
303 | push eax |
||
304 | .main_after_last_check: |
||
305 | push ebx |
||
306 | call @@Kolibri@_RemoveThreadData$qppvpvt2 |
||
307 | add esp,12 |
||
308 | lock inc dword [@Kolibri@_ThreadScanCount+4] |
||
309 | mov ebx,1 |
||
310 | jmp .main_end_wait |
||
311 | .main_end_wait_loop: |
||
8165 | IgorA | 312 | mov eax,SF_SLEEP |
8140 | IgorA | 313 | int 0x40 |
314 | shl ebx,1 |
||
315 | cmp ebx,KOLIBRI_MUTEX_MAX_TIME_WAIT |
||
316 | jna .main_end_wait |
||
317 | mov ebx,KOLIBRI_MUTEX_MAX_TIME_WAIT |
||
318 | .main_end_wait: |
||
319 | cmp dword [@Kolibri@_ExitProcessNow],0 |
||
320 | jnz @Kolibri@ExitProcess$qv |
||
321 | cmp dword [@Kolibri@_ThreadScanCount],0 |
||
322 | jnz .main_end_wait_loop |
||
323 | lock dec dword [@Kolibri@_ThreadScanCount+4] |
||
324 | mov ebp,[esp+4] |
||
325 | mov ebx,[esp] |
||
326 | add esp,KOLIBRI_THREAD_DATA_LEN*4 |
||
327 | mov eax,ebp |
||
328 | pop edi esi |
||
329 | xchg ebp,[esp+8] |
||
330 | xchg ebx,[esp+4] |
||
331 | ret |
||
332 | endp |
||
333 | |||
8283 | IgorA | 334 | align 4 |
8140 | IgorA | 335 | proc @Kolibri@Redraw$qippv |
336 | push ebp |
||
337 | mov ebp,[esp+12] |
||
338 | mov edx,[ebp+KOLIBRI_THREAD_DATA_FLAG*4] |
||
339 | cmp dword [esp+8],0 |
||
340 | jl .redraw_only_inv |
||
341 | jz .redraw_no_frame |
||
342 | or dl,2 |
||
343 | .redraw_no_frame: |
||
344 | bt edx,30 |
||
345 | jnc .redraw_begin |
||
346 | or dl,1 |
||
347 | mov [ebp+KOLIBRI_THREAD_DATA_FLAG*4],edx |
||
348 | jmp .redraw_end |
||
349 | .redraw_only_inv: |
||
350 | test dl,3 |
||
351 | jnz .redraw_no_frame |
||
352 | .redraw_end: |
||
353 | pop ebp |
||
354 | ret |
||
355 | .redraw_begin: |
||
356 | push ebx esi edi |
||
357 | and dword [ebp+KOLIBRI_THREAD_DATA_FLAG*4],0xFFFFFFFC |
||
8165 | IgorA | 358 | mov eax,SF_REDRAW |
359 | mov ebx,SSF_BEGIN_DRAW |
||
8140 | IgorA | 360 | int 0x40 |
361 | test dl,2 |
||
362 | jz .redraw_picture |
||
8165 | IgorA | 363 | mov eax,SF_STYLE_SETTINGS |
364 | mov ebx,SSF_GET_SKIN_HEIGHT |
||
8140 | IgorA | 365 | int 0x40 |
366 | mov ebx,[ebp+KOLIBRI_THREAD_DATA_X*4] |
||
367 | add ebx,2*5-1 |
||
368 | mov ecx,[ebp+KOLIBRI_THREAD_DATA_Y*4] |
||
369 | add cx,ax |
||
370 | add ecx,5-1 |
||
371 | mov edx,[ebp+KOLIBRI_THREAD_DATA_C_WINDOW*4] |
||
372 | mov edi,[ebp+KOLIBRI_THREAD_DATA_TITLE*4] |
||
8236 | IgorA | 373 | xor eax,eax ;SF_CREATE_WINDOW |
8140 | IgorA | 374 | int 0x40 |
375 | .redraw_picture: |
||
376 | call @@KolibriOnPaint$qv |
||
377 | .redraw_end_draw: |
||
8165 | IgorA | 378 | mov eax,SF_REDRAW |
379 | mov ebx,SSF_END_DRAW |
||
8140 | IgorA | 380 | int 0x40 |
381 | pop edi esi ebx ebp |
||
382 | ret |
||
383 | endp |
||
384 | |||
8283 | IgorA | 385 | align 4 |
8140 | IgorA | 386 | proc @Kolibri@MoveWindow$qxpxi uses ebx esi |
387 | mov eax,[esp+12] |
||
388 | mov ebx,[eax] |
||
389 | mov ecx,[eax+4] |
||
390 | mov edx,[eax+8] |
||
391 | mov esi,[eax+12] |
||
8165 | IgorA | 392 | mov eax,SF_CHANGE_WINDOW |
8140 | IgorA | 393 | int 0x40 |
394 | ret |
||
395 | endp |
||
396 | |||
8283 | IgorA | 397 | align 4 |
8165 | IgorA | 398 | proc @Kolibri@ExitDebug$qv |
399 | push dword [@Kolibri@DebugPrefix] |
||
400 | call @Kolibri@DebugPutString$qpxc |
||
401 | mov dword [esp],Kolibri_debug_string |
||
402 | call @Kolibri@DebugPutString$qpxc |
||
403 | pop ecx |
||
404 | jmp @Kolibri@ExitProcess$qv |
||
405 | endp |
||
406 | |||
8283 | IgorA | 407 | align 4 |
8140 | IgorA | 408 | proc @Kolibri@ExitProcess$qv |
409 | lock bts dword [@Kolibri@_ExitProcessNow],0 |
||
410 | jc .exit_process_wait |
||
411 | sub esp,1024 |
||
8165 | IgorA | 412 | mov eax,SF_THREAD_INFO |
8140 | IgorA | 413 | mov ebx,esp |
414 | mov ecx,-1 |
||
415 | int 0x40 |
||
416 | mov esi,eax |
||
8236 | IgorA | 417 | mov edi,[esp+process_information.PID] |
8140 | IgorA | 418 | .exit_process_loop: |
8165 | IgorA | 419 | mov eax,SF_THREAD_INFO |
8140 | IgorA | 420 | mov ebx,esp |
421 | mov ecx,esi |
||
422 | int 0x40 |
||
8236 | IgorA | 423 | mov eax,[esp+process_information.PID] |
8140 | IgorA | 424 | cmp eax,edi |
425 | jz .exit_process_continue |
||
426 | mov ebx,eax |
||
427 | or bl,15 |
||
428 | inc ebx |
||
429 | jz .exit_process_continue |
||
430 | mov ebx,eax |
||
431 | call Kolibri_HashInt |
||
432 | movzx eax,al |
||
433 | mov eax,dword [@Kolibri@_ThreadTable+eax*4] |
||
434 | jmp .exit_process_test |
||
435 | .exit_process_next: |
||
436 | mov eax,dword [eax+KOLIBRI_THREAD_DATA_NEXT*4] |
||
437 | .exit_process_test: |
||
438 | test eax,eax |
||
439 | jz .exit_process_continue |
||
440 | cmp ebx,[eax+KOLIBRI_THREAD_DATA_PID*4] |
||
441 | jnz .exit_process_next |
||
8165 | IgorA | 442 | mov eax,SF_SYSTEM |
443 | mov ebx,SSF_TERMINATE_THREAD |
||
8140 | IgorA | 444 | mov ecx,esi |
445 | int 0x40 |
||
446 | .exit_process_continue: |
||
447 | dec esi |
||
448 | jnl .exit_process_loop |
||
449 | add esp,1024 |
||
450 | mov dword [@Kolibri@_ExitProcessNow],-1 |
||
451 | if defined EMULATOR |
||
452 | int3 |
||
453 | call 0x76543210 |
||
454 | end if |
||
455 | .exit_process_end: |
||
456 | mov dword [@Kolibri@_ThreadMutex],0 |
||
457 | or eax,-1 |
||
458 | int 0x40 |
||
459 | .exit_process_wait: |
||
8165 | IgorA | 460 | mov eax,SF_SLEEP |
8140 | IgorA | 461 | mov ebx,1 |
462 | .exit_process_wait_loop: |
||
463 | cmp dword [@Kolibri@_ExitProcessNow],0 |
||
464 | jl .exit_process_end |
||
465 | int 0x40 |
||
466 | shl ebx,1 |
||
467 | cmp ebx,KOLIBRI_MUTEX_MAX_TIME_WAIT |
||
468 | jna .exit_process_wait_loop |
||
469 | mov ebx,KOLIBRI_MUTEX_MAX_TIME_WAIT |
||
470 | jmp .exit_process_wait_loop |
||
471 | endp |
||
472 | |||
8283 | IgorA | 473 | align 4 |
8236 | IgorA | 474 | proc @Kolibri@ExitThread$qppv |
8140 | IgorA | 475 | mov esp,[esp+4] |
8236 | IgorA | 476 | jmp @Kolibri@ThreadMain$qpvt1.main_end |
8140 | IgorA | 477 | endp |
478 | |||
8283 | IgorA | 479 | align 4 |
8236 | IgorA | 480 | proc @Kolibri@ReturnMessageLoop$qppv |
8140 | IgorA | 481 | mov esp,[esp+4] |
482 | bt dword [esp+KOLIBRI_THREAD_DATA_FLAG*4],30 |
||
8236 | IgorA | 483 | jc @Kolibri@ThreadMain$qpvt1.main_end |
484 | jmp @Kolibri@ThreadMain$qpvt1.main_cycle |
||
8140 | IgorA | 485 | endp |
486 | |||
8283 | IgorA | 487 | align 4 |
8140 | IgorA | 488 | proc @Kolibri@Delay$qui uses ebx |
8165 | IgorA | 489 | mov eax,SF_SLEEP |
8140 | IgorA | 490 | mov ebx,[esp+8] |
491 | int 0x40 |
||
492 | ret |
||
493 | endp |
||
494 | |||
8283 | IgorA | 495 | align 4 |
8140 | IgorA | 496 | proc @Kolibri@Clock$qv uses ebx |
8165 | IgorA | 497 | mov eax,SF_SYSTEM_GET |
498 | mov ebx,SSF_TIME_COUNT |
||
8140 | IgorA | 499 | int 0x40 |
500 | ret |
||
501 | endp |
||
502 | |||
8283 | IgorA | 503 | align 4 |
8153 | maxcodehac | 504 | proc @Kolibri@DrawButton$qllllll uses ebx esi |
8165 | IgorA | 505 | mov eax,SF_DEFINE_BUTTON |
506 | mov ebx,[esp+12-2+8] |
||
8153 | maxcodehac | 507 | mov bx,[esp+20+8] |
8165 | IgorA | 508 | mov ecx,[esp+16-2+8] |
8153 | maxcodehac | 509 | mov cx,[esp+24+8] |
510 | mov edx,[esp+4+8] |
||
511 | mov esi,[esp+8+8] |
||
512 | int 0x40 |
||
513 | ret |
||
514 | endp |
||
515 | |||
8283 | IgorA | 516 | align 4 |
8165 | IgorA | 517 | proc @Kolibri@GetPackedTime$qv |
518 | mov eax,SF_GET_SYS_TIME |
||
519 | int 0x40 |
||
520 | ret |
||
521 | endp |
||
522 | |||
8283 | IgorA | 523 | align 4 |
8140 | IgorA | 524 | proc @Kolibri@GetTime$qpi |
8165 | IgorA | 525 | mov eax,SF_GET_SYS_TIME |
8140 | IgorA | 526 | int 0x40 |
527 | mov edx,[esp+4] |
||
528 | movzx ecx,al |
||
529 | shr ecx,4 |
||
530 | and al,0x0F |
||
531 | imul ecx,10 |
||
532 | add cl,al |
||
533 | mov dword [edx+8],ecx |
||
534 | mov cl,ah |
||
535 | shr ecx,4 |
||
536 | and ah,0x0F |
||
537 | imul ecx,10 |
||
538 | add cl,ah |
||
539 | mov dword [edx+4],ecx |
||
540 | bswap eax |
||
541 | mov cl,ah |
||
542 | shr ecx,4 |
||
543 | and ah,0x0F |
||
544 | imul ecx,10 |
||
545 | add cl,ah |
||
546 | mov dword [edx],ecx |
||
547 | ret |
||
548 | endp |
||
549 | |||
8283 | IgorA | 550 | align 4 |
8140 | IgorA | 551 | proc @Kolibri@GetPackedDate$qv |
8165 | IgorA | 552 | mov eax,SF_GET_SYS_DATE |
8140 | IgorA | 553 | int 0x40 |
554 | ret |
||
555 | endp |
||
556 | |||
8283 | IgorA | 557 | align 4 |
8140 | IgorA | 558 | proc @Kolibri@GetDate$qpi |
8165 | IgorA | 559 | mov eax,SF_GET_SYS_DATE |
8140 | IgorA | 560 | int 0x40 |
561 | mov edx,[esp+4] |
||
562 | movzx ecx,al |
||
563 | shr ecx,4 |
||
564 | and al,0x0F |
||
565 | imul ecx,10 |
||
566 | add cl,al |
||
567 | mov dword [edx+4],ecx |
||
568 | mov cl,ah |
||
569 | shr ecx,4 |
||
570 | and ah,0x0F |
||
571 | imul ecx,10 |
||
572 | add cl,ah |
||
573 | mov dword [edx],ecx |
||
574 | bswap eax |
||
575 | mov cl,ah |
||
576 | shr ecx,4 |
||
577 | and ah,0x0F |
||
578 | imul ecx,10 |
||
579 | add cl,ah |
||
580 | mov dword [edx+8],ecx |
||
581 | ret |
||
582 | endp |
||
583 | |||
8283 | IgorA | 584 | align 4 |
8140 | IgorA | 585 | proc @Kolibri@ReadCommonColors$qpui uses ebx |
8165 | IgorA | 586 | mov eax,SF_STYLE_SETTINGS |
587 | mov ebx,SSF_GET_COLORS |
||
8140 | IgorA | 588 | mov ecx,[esp+8] |
589 | mov edx,40 |
||
590 | int 0x40 |
||
591 | ret |
||
592 | endp |
||
593 | |||
8283 | IgorA | 594 | align 4 |
8140 | IgorA | 595 | proc @Kolibri@DrawText$qssipxc uses ebx |
8165 | IgorA | 596 | mov eax,SF_DRAW_TEXT |
8140 | IgorA | 597 | mov ebx,[esp+8-2] |
598 | mov bx,[esp+12] |
||
599 | mov ecx,[esp+16] |
||
600 | or ecx,0x80000000 |
||
601 | mov edx,[esp+20] |
||
602 | int 0x40 |
||
603 | ret |
||
604 | endp |
||
605 | |||
8283 | IgorA | 606 | align 4 |
607 | proc @Kolibri@DrawRect$qlllll uses ebx |
||
608 | mov eax,SF_DRAW_RECT |
||
609 | mov ebx,[esp+8-2] |
||
610 | mov bx,[esp+16] |
||
611 | mov ecx,[esp+12-2] |
||
612 | mov cx,[esp+20] |
||
613 | mov edx,[esp+24] |
||
614 | int 0x40 |
||
615 | ret |
||
616 | endp |
||
617 | |||
618 | align 4 |
||
8236 | IgorA | 619 | proc @Kolibri@PutImage$qpucllll uses ebx |
620 | mov eax,SF_PUT_IMAGE |
||
621 | mov ebx,[esp+8] |
||
622 | mov ecx,[esp+20-2] |
||
623 | mov cx,[esp+24] |
||
624 | mov edx,[esp+12-2] |
||
625 | mov dx,[esp+16] |
||
626 | int 0x40 |
||
627 | ret |
||
628 | endp |
||
629 | |||
8283 | IgorA | 630 | align 4 |
8165 | IgorA | 631 | proc @Kolibri@SetWindowCaption$qpxc uses ebx |
632 | mov eax,SF_SET_CAPTION |
||
633 | mov ebx,2 |
||
634 | mov ecx,[esp+8] |
||
635 | int 0x40 |
||
636 | ret |
||
637 | endp |
||
638 | |||
8283 | IgorA | 639 | align 4 |
8140 | IgorA | 640 | proc @Kolibri@GetProcessInfo$qpuipct1t1piui uses ebx esi edi |
641 | sub esp,1024 |
||
8165 | IgorA | 642 | mov eax,SF_THREAD_INFO |
8140 | IgorA | 643 | mov ebx,esp |
644 | mov ecx,[1024+12+24+esp] |
||
645 | int 0x40 |
||
646 | xor edi,edi |
||
647 | or edi,[1024+12+4+esp] |
||
648 | jz .get_proc_info_no_usecpu |
||
649 | mov ecx,[esp] |
||
650 | mov [edi],ecx |
||
651 | xor edi,edi |
||
652 | .get_proc_info_no_usecpu: |
||
653 | or edi,[1024+12+8+esp] |
||
654 | jz .get_proc_info_no_name |
||
8236 | IgorA | 655 | lea esi,[esp+process_information.process_name] |
8140 | IgorA | 656 | cld |
8165 | IgorA | 657 | movsd |
658 | movsd |
||
659 | movsd |
||
8140 | IgorA | 660 | mov byte [edi],0 |
661 | xor edi,edi |
||
662 | .get_proc_info_no_name: |
||
663 | or edi,[1024+12+12+esp] |
||
664 | jz .get_proc_info_no_mem |
||
8236 | IgorA | 665 | mov ecx,[esp+process_information.used_memory] |
8140 | IgorA | 666 | mov [edi],ecx |
667 | xor edi,edi |
||
668 | .get_proc_info_no_mem: |
||
669 | or edi,[1024+12+16+esp] |
||
670 | jz .get_proc_info_no_pid |
||
8236 | IgorA | 671 | mov ecx,[esp+process_information.PID] |
8140 | IgorA | 672 | mov [edi],ecx |
673 | xor edi,edi |
||
674 | .get_proc_info_no_pid: |
||
675 | or edi,[1024+12+20+esp] |
||
676 | jz .get_proc_info_no_rect |
||
8236 | IgorA | 677 | lea esi,[esp+process_information.box] |
8140 | IgorA | 678 | cld |
8165 | IgorA | 679 | movsd |
680 | movsd |
||
681 | movsd |
||
682 | movsd |
||
8140 | IgorA | 683 | xor edi,edi |
684 | .get_proc_info_no_rect: |
||
685 | add esp,1024 |
||
686 | ret |
||
687 | endp |
||
688 | |||
8283 | IgorA | 689 | align 4 |
8140 | IgorA | 690 | proc @Kolibri@GetPid$qv uses ebx |
691 | sub esp,1024 |
||
8165 | IgorA | 692 | mov eax,SF_THREAD_INFO |
8140 | IgorA | 693 | mov ebx,esp |
694 | mov ecx,-1 |
||
695 | int 0x40 |
||
8283 | IgorA | 696 | mov eax,[esp+process_information.PID] |
8140 | IgorA | 697 | add esp,1024 |
698 | ret |
||
699 | endp |
||
700 | |||
8283 | IgorA | 701 | align 4 |
8140 | IgorA | 702 | proc @Kolibri@GetPid$qppv |
703 | mov ecx,[esp+4] |
||
704 | mov eax,[ecx+KOLIBRI_THREAD_DATA_PID*4] |
||
705 | ret |
||
706 | endp |
||
707 | |||
8283 | IgorA | 708 | align 4 |
8140 | IgorA | 709 | proc @Kolibri@_HashByte$qui |
710 | @Kolibri@_HashWord$qui: |
||
711 | @Kolibri@_HashDword$qui: |
||
712 | mov eax,[esp+4] |
||
713 | Kolibri_HashInt: |
||
714 | mul dword [Kolibri_hash_int_val0] |
||
715 | xor eax,edx |
||
716 | bswap eax |
||
717 | mul dword [Kolibri_hash_int_val1] |
||
718 | shrd eax,edx,14 |
||
719 | bswap eax |
||
720 | lea eax,[eax+4*eax] |
||
721 | ror eax,9 |
||
722 | ret |
||
723 | endp |
||
724 | |||
8165 | IgorA | 725 | if defined @Kolibri@_HashByte$qui | defined @Kolibri@_HashWord$qui | defined @Kolibri@_HashDword$qui |
8140 | IgorA | 726 | Kolibri_hash_int_val0: |
727 | dd 0xA82F94C5 |
||
728 | Kolibri_hash_int_val1: |
||
729 | dd 0x9193780B |
||
8165 | IgorA | 730 | end if |
8140 | IgorA | 731 | |
8283 | IgorA | 732 | align 4 |
8140 | IgorA | 733 | proc @Kolibri@GetThreadData$qv |
734 | call @Kolibri@GetPid$qv |
||
735 | push eax |
||
736 | call @Kolibri@GetThreadData$qui |
||
737 | pop ecx |
||
738 | ret |
||
739 | endp |
||
740 | |||
8283 | IgorA | 741 | align 4 |
8140 | IgorA | 742 | proc @Kolibri@GetThreadData$qui |
743 | mov eax,[esp+4] |
||
744 | call Kolibri_HashInt |
||
745 | movzx eax,al |
||
746 | cmp dword [@Kolibri@_ThreadScanCount+4],0 |
||
747 | jnz .get_thread_data_wait |
||
748 | .get_thread_data_nowait: |
||
749 | lock inc dword [@Kolibri@_ThreadScanCount] |
||
750 | mov eax,dword [@Kolibri@_ThreadTable+eax*4] |
||
751 | mov ecx,[esp+4] |
||
752 | jmp .get_thread_data_test |
||
753 | .get_thread_data_loop: |
||
754 | mov eax,dword [eax+KOLIBRI_THREAD_DATA_NEXT*4] |
||
755 | .get_thread_data_test: |
||
756 | test eax,eax |
||
757 | jz .get_thread_data_end |
||
758 | cmp ecx,[eax+KOLIBRI_THREAD_DATA_PID*4] |
||
759 | jnz .get_thread_data_loop |
||
760 | .get_thread_data_end: |
||
761 | lock dec dword [@Kolibri@_ThreadScanCount] |
||
762 | ret |
||
763 | .get_thread_data_wait: |
||
764 | push eax ebx |
||
8165 | IgorA | 765 | mov eax,SF_SLEEP |
8140 | IgorA | 766 | mov ebx,1 |
767 | .get_thread_data_wait_loop: |
||
768 | int 0x40 |
||
769 | cmp dword [@Kolibri@_ThreadScanCount+4],0 |
||
770 | jz .get_thread_data_wait_end |
||
771 | shl ebx,1 |
||
772 | cmp ebx,KOLIBRI_MUTEX_MAX_TIME_WAIT |
||
773 | jna .get_thread_data_wait_loop |
||
774 | mov ebx,KOLIBRI_MUTEX_MAX_TIME_WAIT |
||
775 | jmp .get_thread_data_wait_loop |
||
776 | .get_thread_data_wait_end: |
||
777 | pop ebx eax |
||
778 | jmp .get_thread_data_nowait |
||
779 | endp |
||
780 | |||
8283 | IgorA | 781 | align 4 |
8140 | IgorA | 782 | proc @Kolibri@_GetSkinHeader$qv uses ebx |
8165 | IgorA | 783 | mov eax,SF_STYLE_SETTINGS |
784 | mov ebx,SSF_GET_SKIN_HEIGHT |
||
8140 | IgorA | 785 | int 0x40 |
786 | ret |
||
787 | endp |
||
788 | |||
8283 | IgorA | 789 | align 4 |
8140 | IgorA | 790 | proc @Kolibri@GetScreenSize$qrust1 |
8165 | IgorA | 791 | mov eax,SF_GET_SCREEN_SIZE |
8140 | IgorA | 792 | int 0x40 |
793 | mov ecx,[esp+8] |
||
794 | mov word [ecx],ax |
||
795 | mov ecx,[esp+4] |
||
796 | shr eax,16 |
||
797 | mov word [ecx],ax |
||
798 | ret |
||
799 | endp |
||
800 | |||
8283 | IgorA | 801 | align 4 |
8140 | IgorA | 802 | proc Kolibri_MutexLockNoWait |
803 | pop eax |
||
804 | xor al,al |
||
805 | ret |
||
806 | endp |
||
807 | |||
8283 | IgorA | 808 | align 4 |
8140 | IgorA | 809 | proc Kolibri_MutexLockWait uses ebx |
8165 | IgorA | 810 | mov eax,SF_SLEEP |
8140 | IgorA | 811 | xor ebx,ebx |
812 | .lock_wait_cycle: |
||
813 | int 0x40 |
||
814 | shl byte [ecx],1 |
||
815 | jz .lock_wait_cycle |
||
816 | mov al,1 |
||
817 | ret |
||
818 | endp |
||
819 | |||
8283 | IgorA | 820 | align 4 |
8140 | IgorA | 821 | proc Kolibri_MutexLockWaitTime |
822 | cmp dword [esp+12],0 |
||
823 | jng .MutexLockWait |
||
824 | push ebx edx |
||
825 | mov edx,[esp+20] |
||
8165 | IgorA | 826 | mov eax,SF_SYSTEM_GET |
827 | mov ebx,SSF_TIME_COUNT |
||
8140 | IgorA | 828 | int 0x40 |
829 | add edx,eax |
||
830 | .lock_wait_time_cycle: |
||
8165 | IgorA | 831 | mov eax,SF_SLEEP |
8140 | IgorA | 832 | xor ebx,ebx |
833 | int 0x40 |
||
834 | shl byte [ecx],1 |
||
835 | jnz .lock_wait_time_ret_true |
||
8165 | IgorA | 836 | mov eax,SF_SYSTEM_GET |
837 | mov ebx,SSF_TIME_COUNT |
||
8140 | IgorA | 838 | int 0x40 |
839 | cmp eax,edx |
||
840 | js .lock_wait_time_cycle |
||
841 | pop edx ebx eax |
||
842 | xor al,al |
||
843 | ret |
||
844 | .lock_wait_time_ret_true: |
||
845 | pop edx ebx |
||
846 | mov al,1 |
||
847 | ret |
||
848 | endp |
||
849 | |||
8283 | IgorA | 850 | align 4 |
8140 | IgorA | 851 | proc Kolibri_MutexLock |
852 | shl byte [ecx],1 |
||
853 | jnz .lock_first |
||
854 | call eax |
||
855 | .lock_first: |
||
856 | mov al,1 |
||
857 | ret |
||
858 | endp |
||
859 | |||
8283 | IgorA | 860 | align 4 |
8140 | IgorA | 861 | proc @Kolibri@TryLock$qp14Kolibri@TMutex |
862 | mov eax,Kolibri_MutexLockNoWait |
||
863 | mov ecx,[esp+4] |
||
864 | jmp Kolibri_MutexLock |
||
865 | endp |
||
866 | |||
8283 | IgorA | 867 | align 4 |
8140 | IgorA | 868 | proc @Kolibri@Lock$qp14Kolibri@TMutex |
869 | mov eax,Kolibri_MutexLockWait |
||
870 | mov ecx,[esp+4] |
||
871 | jmp Kolibri_MutexLock |
||
872 | endp |
||
873 | |||
8283 | IgorA | 874 | align 4 |
8140 | IgorA | 875 | proc @Kolibri@LockTime$qp14Kolibri@TMutexi |
876 | mov eax,Kolibri_MutexLockWaitTime |
||
877 | mov ecx,[esp+4] |
||
878 | jmp Kolibri_MutexLock |
||
879 | endp |
||
880 | |||
8283 | IgorA | 881 | align 4 |
8140 | IgorA | 882 | proc @Kolibri@UnLock$qp14Kolibri@TMutex |
883 | mov ecx,[esp+4] |
||
884 | shr byte [ecx],1 |
||
885 | jz .unlock_pause |
||
886 | ret |
||
887 | .unlock_pause: |
||
888 | mov byte [ecx],0x40 |
||
889 | push ebx |
||
8165 | IgorA | 890 | mov eax,SF_SLEEP |
8140 | IgorA | 891 | xor ebx,ebx |
892 | int 0x40 |
||
893 | pop ebx |
||
894 | ret |
||
895 | endp |
||
896 | |||
8283 | IgorA | 897 | align 4 |
8140 | IgorA | 898 | proc Kolibri_MutexLockRec |
899 | shl byte [ecx],1 |
||
900 | jng .lock_first |
||
901 | cmp dword [ecx+4],edx |
||
902 | jz .lock_rec_self |
||
903 | call eax |
||
904 | .lock_rec_first: |
||
905 | mov al,1 |
||
906 | mov dword [ecx+4],edx |
||
907 | ret |
||
908 | .lock_rec_self: |
||
909 | mov al,1 |
||
910 | add dword [ecx],0x100 |
||
911 | jc .lock_rec_overflow |
||
912 | ret |
||
913 | .lock_rec_overflow: |
||
914 | push dword [@Kolibri@DebugPrefix] |
||
915 | call @Kolibri@DebugPutString$qpxc |
||
916 | mov dword [esp],Kolibri_try_lock_rec_overflow_string |
||
917 | call @Kolibri@DebugPutString$qpxc |
||
918 | pop ecx |
||
8165 | IgorA | 919 | jmp @Kolibri@ExitDebug$qv |
8140 | IgorA | 920 | endp |
921 | |||
8283 | IgorA | 922 | align 4 |
8140 | IgorA | 923 | proc @Kolibri@TryLock$qp16Kolibri@TRecMutexui |
924 | mov eax,Kolibri_MutexLockNoWait |
||
925 | mov ecx,[esp+4] |
||
926 | mov edx,[esp+8] |
||
927 | jmp Kolibri_MutexLockRec |
||
928 | endp |
||
929 | |||
8283 | IgorA | 930 | align 4 |
8140 | IgorA | 931 | proc @Kolibri@Lock$qp16Kolibri@TRecMutexui |
932 | mov eax,Kolibri_MutexLockWait |
||
933 | mov ecx,[esp+4] |
||
934 | mov edx,[esp+8] |
||
935 | jmp Kolibri_MutexLockRec |
||
936 | endp |
||
937 | |||
8283 | IgorA | 938 | align 4 |
8140 | IgorA | 939 | proc @Kolibri@LockTime$qp16Kolibri@TRecMutexiui |
940 | mov eax,Kolibri_MutexLockWaitTime |
||
941 | mov ecx,[esp+4] |
||
942 | mov edx,[esp+12] |
||
943 | jmp Kolibri_MutexLockRec |
||
944 | endp |
||
945 | |||
8283 | IgorA | 946 | align 4 |
8140 | IgorA | 947 | proc @Kolibri@UnLock$qp16Kolibri@TRecMutexui |
948 | mov ecx,[esp+4] |
||
949 | mov edx,[esp+8] |
||
950 | cmp dword [ecx+4],edx |
||
951 | jnz .unlock_rec_notlocked |
||
952 | sub dword [ecx],0x100 |
||
953 | jnc .unlock_rec_end |
||
954 | add dword [ecx],0x100 |
||
955 | shl byte [ecx],1 |
||
956 | shr byte [ecx],2 |
||
957 | jng .unlock_rec_pause |
||
958 | .unlock_rec_end: |
||
959 | ret |
||
960 | .unlock_rec_pause: |
||
961 | mov byte [ecx],0x20 |
||
962 | push ebx |
||
8165 | IgorA | 963 | mov eax,SF_SLEEP |
8140 | IgorA | 964 | xor ebx,ebx |
965 | int 0x40 |
||
966 | pop ebx |
||
967 | ret |
||
968 | .unlock_rec_notlocked: |
||
969 | push dword [@Kolibri@DebugPrefix] |
||
970 | call @Kolibri@DebugPutString$qpxc |
||
971 | mov dword [esp],Kolibri_unlock_rec_notlocked_string |
||
972 | call @Kolibri@DebugPutString$qpxc |
||
973 | pop ecx |
||
8165 | IgorA | 974 | jmp @Kolibri@ExitDebug$qv |
8140 | IgorA | 975 | endp |
976 | |||
8283 | IgorA | 977 | align 4 |
8140 | IgorA | 978 | proc @Kolibri@DebugPutChar$qc |
979 | mov cl,byte [esp+4] |
||
980 | cmp cl,13 |
||
981 | jz .debug_put_char_ret |
||
982 | push ebx |
||
983 | cmp cl,10 |
||
984 | jz .debug_put_char_enter |
||
985 | .debug_put_char_after_cmp: |
||
8165 | IgorA | 986 | mov eax,SF_BOARD |
987 | mov ebx,SSF_DEBUG_WRITE |
||
8140 | IgorA | 988 | int 0x40 |
989 | pop ebx |
||
990 | .debug_put_char_ret: |
||
991 | ret |
||
992 | .debug_put_char_enter: |
||
993 | mov cl,13 |
||
8165 | IgorA | 994 | mov eax,SF_BOARD |
995 | mov ebx,SSF_DEBUG_WRITE |
||
8140 | IgorA | 996 | int 0x40 |
997 | mov cl,10 |
||
998 | jmp .debug_put_char_after_cmp |
||
999 | endp |
||
1000 | |||
8283 | IgorA | 1001 | align 4 |
8165 | IgorA | 1002 | proc @Kolibri@DebugPutString$qpxc uses esi |
8140 | IgorA | 1003 | push dword 0 |
1004 | mov esi,dword [esp+12] |
||
1005 | jmp .debug_put_string_test |
||
1006 | .debug_put_string_loop: |
||
1007 | mov dword [esp],eax |
||
1008 | call @Kolibri@DebugPutChar$qc |
||
1009 | inc esi |
||
1010 | .debug_put_string_test: |
||
1011 | xor eax,eax |
||
1012 | or al,[esi] |
||
1013 | test al,al |
||
1014 | jnz .debug_put_string_loop |
||
8165 | IgorA | 1015 | pop ecx |
8140 | IgorA | 1016 | ret |
1017 | endp |
||
1018 | |||
8283 | IgorA | 1019 | align 4 |
8140 | IgorA | 1020 | proc @Kolibri@GetKey$qv |
8165 | IgorA | 1021 | mov eax,SF_GET_KEY |
8140 | IgorA | 1022 | int 0x40 |
1023 | test al,al |
||
1024 | jnz .get_key_eof |
||
1025 | movzx eax,ah |
||
1026 | ret |
||
1027 | .get_key_eof: |
||
8165 | IgorA | 1028 | mov eax,SF_TERMINATE_PROCESS |
8140 | IgorA | 1029 | ret |
1030 | endp |
||
1031 | |||
8283 | IgorA | 1032 | align 4 |
8140 | IgorA | 1033 | proc @Kolibri@GetMouseButton$qv uses ebx |
8165 | IgorA | 1034 | mov eax,SF_MOUSE_GET |
1035 | mov ebx,SSF_BUTTON |
||
8140 | IgorA | 1036 | int 0x40 |
1037 | ret |
||
1038 | endp |
||
1039 | |||
8283 | IgorA | 1040 | align 4 |
8140 | IgorA | 1041 | proc @Kolibri@GetMousePosition$qrst1o uses ebx |
8165 | IgorA | 1042 | mov eax,SF_MOUSE_GET |
1043 | xor ebx,ebx ;SSF_SCREEN_POSITION |
||
8140 | IgorA | 1044 | cmp byte [esp+16],0 |
1045 | jnz .get_mouse_pos_absolute |
||
1046 | inc ebx |
||
1047 | .get_mouse_pos_absolute: |
||
1048 | int 0x40 |
||
1049 | mov ecx,[esp+12] |
||
1050 | mov word [ecx],ax |
||
1051 | mov ecx,[esp+8] |
||
1052 | shr eax,16 |
||
1053 | mov word [ecx],ax |
||
1054 | ret |
||
1055 | endp |
||
1056 | |||
8283 | IgorA | 1057 | align 4 |
8140 | IgorA | 1058 | proc @Kolibri@WasThreadCreated$qv |
1059 | cmp byte [@Kolibri@_ThreadSavedBegProc],0x90 |
||
1060 | setz al |
||
1061 | ret |
||
1062 | endp |
||
1063 | |||
8283 | IgorA | 1064 | align 4 |
8140 | IgorA | 1065 | proc @Kolibri@CreateThread$qpvuit1 |
1066 | push ebx |
||
1067 | mov edx,[esp+16] |
||
1068 | mov ebx,[esp+12] |
||
1069 | test edx,edx |
||
1070 | jnz .create_thread_after_new |
||
1071 | if defined KolibriHeapAlloc |
||
1072 | cmp ebx,4096 |
||
1073 | jnb .create_thread_alloc |
||
1074 | mov ebx,STACKSIZE |
||
1075 | .create_thread_alloc: |
||
1076 | push ebx |
||
1077 | call KolibriHeapAlloc ; Create new dynamic memory of the given size |
||
1078 | pop ecx |
||
1079 | test eax,eax |
||
1080 | jnz .create_thread_mem_created |
||
1081 | end if |
||
1082 | or eax,-1 |
||
1083 | jmp .create_thread_end |
||
1084 | .create_thread_mem_created: |
||
1085 | lea edx,[eax+ebx] |
||
1086 | .create_thread_after_new: |
||
1087 | neg ebx |
||
1088 | jz .create_thread_test_first |
||
1089 | add ebx,edx |
||
1090 | .create_thread_test_first: |
||
1091 | cmp byte [@Kolibri@_ThreadSavedBegProc],0x90 |
||
1092 | jnz .create_thread_init |
||
1093 | .create_thread_fill_stack: |
||
1094 | lock inc dword [@Kolibri@_ThreadNumber] |
||
1095 | and edx,not 3 |
||
1096 | sub edx,12 |
||
1097 | mov ecx,[esp+8] |
||
1098 | mov dword [edx+8],ebx |
||
1099 | mov dword [edx+4],ecx |
||
1100 | mov dword [edx],Kolibri_ThreadFinish |
||
8165 | IgorA | 1101 | mov eax,SF_CREATE_THREAD |
8140 | IgorA | 1102 | mov ebx,1 |
1103 | mov ecx,@Kolibri@ThreadMain$qpvt1 |
||
1104 | int 0x40 |
||
1105 | mov ebx,eax |
||
1106 | or bl,15 |
||
1107 | inc ebx |
||
1108 | jnz .create_thread_end |
||
1109 | lock dec dword [@Kolibri@_ThreadNumber] |
||
1110 | if defined KolibriHeapFree |
||
1111 | or ebx,[edx+8] |
||
1112 | jz .create_thread_end |
||
1113 | push ebx |
||
1114 | call KolibriHeapFree ; Delete the given dynamic memory |
||
1115 | pop ecx |
||
1116 | end if |
||
1117 | .create_thread_end: |
||
1118 | pop ebx |
||
1119 | ret |
||
1120 | .create_thread_init: |
||
1121 | push esi edi |
||
1122 | cld |
||
1123 | mov esi,@Kolibri@_ThreadSavedBegProc |
||
1124 | mov edi,@Kolibri@GetPid$qv |
||
8165 | IgorA | 1125 | movsd |
1126 | movsd |
||
8140 | IgorA | 1127 | mov edi,@Kolibri@GetThreadData$qv |
8165 | IgorA | 1128 | movsd |
1129 | movsd |
||
8140 | IgorA | 1130 | mov eax,0x90909090 |
1131 | mov edi,@Kolibri@_ThreadSavedBegProc |
||
8165 | IgorA | 1132 | stosd |
1133 | stosd |
||
1134 | stosd |
||
1135 | stosd |
||
8140 | IgorA | 1136 | pop edi esi |
1137 | jmp .create_thread_fill_stack |
||
1138 | endp |
||
1139 | |||
8283 | IgorA | 1140 | align 4 |
8179 | IgorA | 1141 | proc @Kolibri@_FileAccess$qp21Kolibri@FileInfoBlock uses ebx |
8165 | IgorA | 1142 | mov eax,SF_FILE |
8140 | IgorA | 1143 | mov ebx,[esp+8] |
1144 | int 0x40 |
||
1145 | mov ecx,[esp+8] |
||
1146 | mov [ecx],ebx |
||
1147 | ret |
||
1148 | endp |
||
1149 | |||
8165 | IgorA | 1150 | if defined Kolibri_debug_string |
1151 | Kolibri_debug_string: |
||
8140 | IgorA | 1152 | db 'Abnormal program termination.',10,0 |
8165 | IgorA | 1153 | end if |
1154 | |||
1155 | if defined Kolibri_MutexLockRec |
||
8140 | IgorA | 1156 | Kolibri_try_lock_rec_overflow_string: |
1157 | db 'Recursive mutex lock count overflow.',10,0 |
||
8165 | IgorA | 1158 | end if |
1159 | |||
1160 | if defined @Kolibri@UnLock$qp16Kolibri@TRecMutexui |
||
8140 | IgorA | 1161 | Kolibri_unlock_rec_notlocked_string: |
1162 | db 'Recursive mutex unlock error.',10,0 |
||
8165 | IgorA | 1163 | end if |
8140 | IgorA | 1164 | |
1165 | include "kos_lib.inc" |
||
1166 | |||
1167 | ;/**/ |
||
1168 |