Rev 914 | Rev 996 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
849 | serge | 1 | |
2 | |||
3 | |||
1 | ha | 4 | ;; |
5 | ;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. |
||
709 | diamond | 6 | ;; PROGRAMMING: |
431 | serge | 7 | ;; Ivan Poddubny |
8 | ;; Marat Zakiyanov (Mario79) |
||
9 | ;; VaStaNi |
||
10 | ;; Trans |
||
11 | ;; Mihail Semenyako (mike.dld) |
||
12 | ;; Sergey Kuzmin (Wildwest) |
||
13 | ;; Andrey Halyavin (halyavin) |
||
14 | ;; Mihail Lisovin (Mihasik) |
||
15 | ;; Andrey Ignatiev (andrew_programmer) |
||
16 | ;; NoName |
||
17 | ;; Evgeny Grechnikov (Diamond) |
||
18 | ;; Iliya Mihailov (Ghost) |
||
19 | ;; Sergey Semyonov (Serge) |
||
20 | ;; Johnny_B |
||
21 | ;; SPraid (simba) |
||
543 | spraid | 22 | ;; |
1 | ha | 23 | ;; Data in this file was originally part of MenuetOS project which is |
431 | serge | 24 | ;; distributed under the terms of GNU GPL. It is modified and redistributed as |
25 | ;; part of KolibriOS project under the terms of GNU GPL. |
||
26 | ;; |
||
1 | ha | 27 | ;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa |
431 | serge | 28 | ;; PROGRAMMING: |
29 | ;; |
||
1 | ha | 30 | ;; Ville Mikael Turjanmaa, villemt@itu.jyu.fi |
431 | serge | 31 | ;; - main os coding/design |
32 | ;; Jan-Michael Brummer, BUZZ2@gmx.de |
||
33 | ;; Felix Kaiser, info@felix-kaiser.de |
||
34 | ;; Paolo Minazzi, paolo.minazzi@inwind.it |
||
35 | ;; quickcode@mail.ru |
||
36 | ;; Alexey, kgaz@crosswinds.net |
||
37 | ;; Juan M. Caravaca, bitrider@wanadoo.es |
||
38 | ;; kristol@nic.fi |
||
39 | ;; Mike Hibbett, mikeh@oceanfree.net |
||
40 | ;; Lasse Kuusijarvi, kuusijar@lut.fi |
||
41 | ;; Jarek Pelczar, jarekp3@wp.pl |
||
42 | ;; |
||
1 | ha | 43 | ;; KolibriOS is distributed in the hope that it will be useful, but WITHOUT ANY |
431 | serge | 44 | ;; WARRANTY. No author or distributor accepts responsibility to anyone for the |
45 | ;; consequences of using it or for whether it serves any particular purpose or |
||
46 | ;; works at all, unless he says so in writing. Refer to the GNU General Public |
||
47 | ;; License (the "GPL") for full details. |
||
48 | ; |
||
49 | ;; Everyone is granted permission to copy, modify and redistribute KolibriOS, |
||
50 | ;; but only under the conditions described in the GPL. A copy of this license |
||
51 | ;; is supposed to have been given to you along with KolibriOS so you can know |
||
52 | ;; your rights and responsibilities. It should be in a file named COPYING. |
||
53 | ;; Among other things, the copyright notice and this notice must be preserved |
||
54 | ;; on all copies. |
||
55 | ;; |
||
56 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
1 | ha | 57 | |
426 | mikedld | 58 | |
59 | |||
60 | |||
425 | victor | 61 | |
426 | mikedld | 62 | |
593 | mikedld | 63 | |
841 | serge | 64 | |
65 | |||
769 | Rus | 66 | |
566 | serge | 67 | |
164 | serge | 68 | include "kglobals.inc" |
7 | me_root | 69 | include "lang.inc" |
1 | ha | 70 | |
71 | |||
164 | serge | 72 | max_processes equ 255 |
742 | Rus | 73 | tss_step equ (128+8192) ; tss & i/o - 65535 ports, * 256=557056*4 |
74 | |||
1 | ha | 75 | |
928 | serge | 76 | |
164 | serge | 77 | |
928 | serge | 78 | sel_os_stack equ (os_stacK_l - _gdts) ;0x18 |
79 | |||
1 | ha | 80 | |
928 | serge | 81 | sel_app_data equ (app_data_l - _gdts +3) ;0x2B |
82 | |||
1 | ha | 83 | |
928 | serge | 84 | sel_srv_stack equ (srv_stack_l- _gdts +1) ;0x39 |
85 | |||
86 | |||
87 | sel_pci_data equ (pci_data_32-_gdts) ;0x48 |
||
88 | |||
89 | |||
90 | |||
91 | |||
92 | |||
93 | |||
1 | ha | 94 | ;; |
95 | ;; Included files: |
||
96 | ;; |
||
97 | ;; Kernel16.inc |
||
98 | ;; - Booteng.inc English text for bootup |
||
99 | ;; - Bootcode.inc Hardware setup |
||
100 | ;; - Pci16.inc PCI functions |
||
101 | ;; |
||
102 | ;; Kernel32.inc |
||
103 | ;; - Sys32.inc Process management |
||
104 | ;; - Shutdown.inc Shutdown and restart |
||
105 | ;; - Fat32.inc Read / write hd |
||
106 | ;; - Vesa12.inc Vesa 1.2 driver |
||
107 | ;; - Vesa20.inc Vesa 2.0 driver |
||
108 | ;; - Vga.inc VGA driver |
||
109 | ;; - Stack.inc Network interface |
||
110 | ;; - Mouse.inc Mouse pointer |
||
111 | ;; - Scincode.inc Window skinning |
||
112 | ;; - Pci32.inc PCI functions |
||
113 | ;; |
||
114 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
115 | |||
116 | |||
117 | |||
851 | serge | 118 | public _sys_pdbr |
119 | public _gdts |
||
120 | |||
849 | serge | 121 | |
854 | serge | 122 | public _panic_printf |
123 | public _printf |
||
124 | public _pg_balloc |
||
125 | public _mem_amount |
||
126 | public @balloc@4 |
||
127 | |||
128 | |||
928 | serge | 129 | |
849 | serge | 130 | |
859 | serge | 131 | public _rd_fat |
132 | public _rd_fat_end |
||
133 | public _rd_root |
||
134 | public _rd_root_end |
||
135 | |||
136 | |||
908 | serge | 137 | public _current_thread |
928 | serge | 138 | public _k_reenter |
139 | |||
908 | serge | 140 | |
889 | serge | 141 | |
863 | serge | 142 | |
897 | serge | 143 | |
144 | |||
908 | serge | 145 | public pe_app_param |
897 | serge | 146 | public _init_user_heap |
908 | serge | 147 | |
897 | serge | 148 | |
908 | serge | 149 | public user_free |
150 | |||
928 | serge | 151 | |
889 | serge | 152 | |
153 | |||
890 | serge | 154 | |
155 | |||
156 | public _DestroyObject ; export |
||
157 | |||
158 | |||
159 | public _CommitPages ; export |
||
160 | public _GetPgAddr ; export |
||
161 | public _MapIoMem ; stdcall export |
||
162 | public _UnmapPages ; export |
||
163 | |||
164 | |||
165 | public _Kfree ; export |
||
166 | public _UserAlloc ; stdcall export |
||
167 | public _UserFree ; stdcall export |
||
168 | |||
169 | |||
170 | public _SysMsgBoardStr ; export |
||
171 | public _SetScreen ; export FIXME make fastcall |
||
172 | |||
173 | |||
174 | public _PciRead8 ; stdcall export |
||
175 | public _PciRead16 ; stdcall export |
||
176 | public _PciRead32 ; stdcall export |
||
177 | public _PciWrite8 ; stdcall export |
||
178 | public _PciWrite16 ; stdcall export |
||
179 | public _PciWrite32 ; stdcall export |
||
180 | |||
181 | |||
182 | public _SetHwCursor ; stdcall export |
||
183 | public _HwCursorRestore ; export |
||
184 | public _HwCursorCreate ; export |
||
185 | |||
186 | |||
928 | serge | 187 | public init_fpu |
188 | public init_malloc |
||
189 | public init_mtrr |
||
190 | |||
890 | serge | 191 | |
928 | serge | 192 | public syscall_entry |
193 | |||
194 | |||
195 | public LFBAddress |
||
196 | public LFBSize |
||
197 | |||
198 | |||
199 | |||
863 | serge | 200 | |
201 | |||
928 | serge | 202 | |
203 | |||
204 | |||
205 | |||
855 | serge | 206 | extrn _16bit_end |
207 | |||
208 | |||
928 | serge | 209 | |
863 | serge | 210 | |
1 | ha | 211 | |
864 | serge | 212 | extrn @core_free@4 |
887 | serge | 213 | |
864 | serge | 214 | |
859 | serge | 215 | |
886 | serge | 216 | |
890 | serge | 217 | extrn _MemFree |
218 | |||
854 | serge | 219 | |
890 | serge | 220 | @mem_free@4 equ _MemFree |
221 | |||
222 | |||
928 | serge | 223 | extrn _sys_exec |
897 | serge | 224 | |
225 | |||
226 | extrn @load_pe_driver@4 |
||
889 | serge | 227 | |
228 | |||
854 | serge | 229 | |
230 | |||
859 | serge | 231 | |
232 | |||
851 | serge | 233 | |
849 | serge | 234 | |
897 | serge | 235 | |
864 | serge | 236 | |
928 | serge | 237 | |
238 | |||
239 | |||
240 | |||
241 | extrn cpu_sign |
||
242 | extrn cpu_info |
||
243 | extrn cpu_caps:dword |
||
244 | |||
245 | |||
246 | |||
247 | |||
854 | serge | 248 | |
1 | ha | 249 | |
851 | serge | 250 | |
1 | ha | 251 | |
848 | serge | 252 | |
847 | serge | 253 | |
848 | serge | 254 | |
255 | |||
847 | serge | 256 | ; bts [cpu_caps-OS_BASE], CAPS_TSC ;force use rdtsc |
854 | serge | 257 | |
424 | spraid | 258 | |
847 | serge | 259 | |
837 | serge | 260 | |
848 | serge | 261 | |
1 | ha | 262 | |
513 | serge | 263 | ;bios32_entry dd ? |
854 | serge | 264 | ;tmp_page_tabs dd ? |
265 | |||
586 | serge | 266 | |
498 | diamond | 267 | |
465 | serge | 268 | __DEBUG_LEVEL__ fix 1 |
269 | |||
380 | serge | 270 | |
848 | serge | 271 | |
839 | serge | 272 | MEM_WC equ 1 ;write combined memory |
273 | MEM_UC equ 0 ;uncached memory |
||
274 | |||
275 | |||
276 | |||
854 | serge | 277 | cli |
278 | @@: |
||
279 | hlt |
||
280 | jmp @B |
||
281 | |||
839 | serge | 282 | |
854 | serge | 283 | _panic_printf: |
284 | |||
839 | serge | 285 | |
854 | serge | 286 | jmp _printf |
287 | |||
288 | |||
839 | serge | 289 | include 'printf.inc' |
854 | serge | 290 | |
291 | |||
928 | serge | 292 | |
847 | serge | 293 | |
294 | init_apm: |
||
928 | serge | 295 | ; init selectors |
465 | serge | 296 | mov ebx, [BOOT_VAR +0x9040] ; offset of APM entry point |
859 | serge | 297 | movzx eax, word [BOOT_VAR+0x9050] ; real-mode segment base address of |
465 | serge | 298 | ; protected-mode 32-bit code segment |
742 | Rus | 299 | movzx ecx, word [BOOT_VAR+0x9052] ; real-mode segment base address of |
465 | serge | 300 | ; protected-mode 16-bit code segment |
742 | Rus | 301 | movzx edx, word [BOOT_VAR+0x9054] ; real-mode segment base address of |
465 | serge | 302 | ; protected-mode 16-bit data segment |
742 | Rus | 303 | |
465 | serge | 304 | |
305 | mov [dword apm_code_32 + 2], ax |
||
306 | shr eax, 16 |
||
307 | mov [dword apm_code_32 + 4], al |
||
308 | |||
309 | |||
310 | mov [dword apm_code_16 + 2], cx |
||
311 | shr ecx, 16 |
||
312 | mov [dword apm_code_16 + 4], cl |
||
313 | |||
314 | |||
315 | mov [dword apm_data_16 + 2], dx |
||
316 | shr edx, 16 |
||
317 | mov [dword apm_data_16 + 4], dl |
||
318 | |||
319 | |||
320 | mov word [apm_entry + 4], apm_code_32 - _gdts |
||
851 | serge | 321 | |
76 | mario79 | 322 | |
465 | serge | 323 | mov [apm_vf], eax |
76 | mario79 | 324 | ret |
928 | serge | 325 | |
753 | serge | 326 | |
928 | serge | 327 | system_init: |
328 | |||
848 | serge | 329 | |
928 | serge | 330 | |
331 | |||
332 | |||
333 | |||
334 | mov ax, [BOOT_VAR + 0x9031] |
||
335 | mov [IDEContrRegsBaseAddr], ax |
||
336 | |||
337 | |||
338 | mov [allow_dma_access], al |
||
339 | |||
340 | |||
341 | mov [ScreenBPP], eax |
||
342 | |||
343 | |||
344 | dec eax |
||
345 | mov [Screen_Max_X],eax |
||
346 | mov [screen_workarea.right],eax |
||
347 | movzx eax,word [BOOT_VAR+0x900C] ; Y max |
||
348 | dec eax |
||
349 | mov [Screen_Max_Y],eax |
||
350 | mov [screen_workarea.bottom],eax |
||
351 | mov [BytesPerScanLine], 640*4 |
||
352 | cmp [scr_mode], 0x13 ; 320x200 |
||
353 | je @f |
||
354 | cmp [scr_mode], 0x12 ; VGA 640x480 |
||
355 | je @f |
||
356 | |||
357 | |||
358 | mov [BytesPerScanLine], eax |
||
359 | @@: |
||
465 | serge | 360 | mov esi, BOOT_VAR+0x9080 |
928 | serge | 361 | movzx ecx, byte [esi-1] |
362 | mov [NumBiosDisks], ecx |
||
363 | mov edi, BiosDisksData |
||
364 | rep movsd |
||
365 | |||
1 | ha | 366 | |
367 | |||
368 | |||
928 | serge | 369 | |
1 | ha | 370 | |
928 | serge | 371 | jge setvesa20 |
372 | cmp [scr_mode], 0x13 |
||
373 | je v20ga32 |
||
374 | mov [put_pixel], Vesa12_putpixel24 ; Vesa 1.2 |
||
375 | mov [get_pixel],dword Vesa12_getpixel24 |
||
376 | cmp byte [ScreenBPP], 24 |
||
377 | jz ga24 |
||
378 | mov [put_pixel], Vesa12_putpixel32 |
||
379 | mov [get_pixel],dword Vesa12_getpixel32 |
||
380 | ga24: |
||
381 | jmp v20ga24 |
||
382 | setvesa20: |
||
383 | mov [put_pixel], Vesa20_putpixel24 ; Vesa 2.0 |
||
384 | mov [get_pixel],dword Vesa20_getpixel24 |
||
385 | cmp byte [ScreenBPP], 24 |
||
386 | jz v20ga24 |
||
387 | v20ga32: |
||
388 | mov [put_pixel], Vesa20_putpixel32 |
||
389 | mov [get_pixel],dword Vesa20_getpixel32 |
||
390 | v20ga24: |
||
391 | cmp [scr_mode], 0x12 ; 16 C VGA 640x480 |
||
392 | jne no_mode_0x12 |
||
393 | mov [put_pixel], VGA_putpixel |
||
394 | mov [get_pixel],dword Vesa20_getpixel32 |
||
395 | no_mode_0x12: |
||
396 | |||
1 | ha | 397 | |
928 | serge | 398 | mov edx, PG_SW |
399 | call @mem_alloc@8 |
||
400 | mov [_display_data], eax |
||
401 | |||
164 | serge | 402 | |
928 | serge | 403 | (unpack.lc+unpack.lp)))*4 |
404 | mov edx, PG_SW |
||
405 | call @mem_alloc@8 |
||
406 | mov [unpack.p], eax |
||
407 | |||
375 | Ghost | 408 | |
928 | serge | 409 | |
375 | Ghost | 410 | |
928 | serge | 411 | mov [graph_data_l+2],ax |
412 | shr eax,16 |
||
413 | mov [graph_data_l+4],al |
||
414 | mov [graph_data_l+7],ah |
||
415 | |||
378 | serge | 416 | |
864 | serge | 417 | xor edx, edx |
418 | call @mem_alloc@8 |
||
419 | mov [default_io_map], eax |
||
928 | serge | 420 | |
465 | serge | 421 | |
928 | serge | 422 | mov [ipc_tmp], eax |
423 | mov ebx, 0x1000 |
||
424 | |||
164 | serge | 425 | |
928 | serge | 426 | mov [proc_mem_map], eax |
427 | |||
164 | serge | 428 | |
928 | serge | 429 | mov [proc_mem_pdir], eax |
430 | |||
164 | serge | 431 | |
928 | serge | 432 | mov [proc_mem_tab], eax |
433 | |||
164 | serge | 434 | |
928 | serge | 435 | mov [tmp_task_pdir], eax |
436 | |||
164 | serge | 437 | |
928 | serge | 438 | mov [tmp_task_ptab], eax |
439 | |||
164 | serge | 440 | |
928 | serge | 441 | mov [ipc_pdir], eax |
442 | |||
164 | serge | 443 | |
928 | serge | 444 | mov [ipc_ptab], eax |
445 | |||
164 | serge | 446 | |
928 | serge | 447 | mov eax, srv.fd-SRV_FD_OFFSET |
448 | mov [srv.fd], eax |
||
449 | mov [srv.bk], eax |
||
450 | |||
278 | serge | 451 | |
928 | serge | 452 | xor eax, eax |
453 | mov ecx, 16 |
||
454 | rep stosd |
||
455 | |||
164 | serge | 456 | |
928 | serge | 457 | mov [TASK_COUNT],dword 1 |
458 | mov [TASK_BASE],dword TASK_DATA |
||
459 | mov [current_slot], SLOT_BASE+256 |
||
460 | |||
1 | ha | 461 | |
469 | serge | 462 | xor eax,eax |
928 | serge | 463 | inc eax |
464 | mov [BgrDrawMode],eax |
||
465 | mov [BgrDataWidth],eax |
||
466 | mov [BgrDataHeight],eax |
||
467 | mov ecx, 4095 |
||
468 | mov edx, PG_SW |
||
469 | mov [mem_BACKGROUND],4095 |
||
470 | call @mem_alloc@8 |
||
471 | mov [img_background], eax |
||
472 | |||
469 | serge | 473 | |
928 | serge | 474 | |
469 | serge | 475 | |
709 | diamond | 476 | |
477 | |||
928 | serge | 478 | |
709 | diamond | 479 | |
480 | call init_sys_v86 |
||
928 | serge | 481 | |
709 | diamond | 482 | |
725 | diamond | 483 | |
484 | |||
742 | Rus | 485 | out 0x43,al |
486 | mov al,0x9b ; lsb 1193180 / 1193 |
||
487 | out 0x40,al |
||
488 | mov al,0x2e ; msb |
||
489 | out 0x40,al |
||
490 | |||
725 | diamond | 491 | |
492 | ; they are used: when partitions are scanned, hd_read relies on timer |
||
493 | mov al, 0xFE |
||
742 | Rus | 494 | out 0x21, al |
495 | mov al, 0x3F |
||
496 | out 0xA1, al |
||
497 | |||
725 | diamond | 498 | |
256 | diamond | 499 | include 'detect/disks.inc' |
500 | ;!!!!!!!!!!!!!!!!!!!!!!!!!! |
||
501 | |||
502 | |||
521 | diamond | 503 | |
504 | |||
1 | ha | 505 | |
506 | |||
507 | ;include 'boot/rdload.inc' |
||
846 | serge | 508 | ;!!!!!!!!!!!!!!!!!!!!!!! |
1 | ha | 509 | ; mov [dma_hdd],1 |
510 | ; CALCULATE FAT CHAIN FOR RAMDISK |
||
511 | |||
512 | |||
742 | Rus | 513 | |
1 | ha | 514 | |
515 | |||
847 | serge | 516 | ; cmp ax,'r1' ; if using not ram disk, then load librares and parameters {SPraid.simba} |
517 | ; je no_lib_load |
||
518 | ; LOADING LIBRARES |
||
488 | spraid | 519 | ; stdcall dll.Load,@IMPORT ; loading librares for kernel (.obj files) |
847 | serge | 520 | ; call load_file_parse_table ; prepare file parse table |
521 | ; call set_kernel_conf ; configure devices and gui |
||
522 | ;no_lib_load: |
||
523 | |||
488 | spraid | 524 | |
1 | ha | 525 | |
526 | |||
742 | Rus | 527 | stdcall read_file, char2, FONT_II, 0, 2560 |
848 | serge | 528 | |
490 | serge | 529 | |
742 | Rus | 530 | call boot_log |
531 | |||
1 | ha | 532 | |
533 | mov esi, boot_memdetect |
||
742 | Rus | 534 | call boot_log |
535 | |||
1 | ha | 536 | |
742 | Rus | 537 | or ecx, (10+29*6) shl 16 ; "Determining amount of memory" |
538 | sub ecx, 10 |
||
539 | mov edx, 0xFFFFFF |
||
540 | mov ebx, [_mem_amount] |
||
846 | serge | 541 | shr ebx, 20 |
742 | Rus | 542 | mov edi, 1 |
543 | mov eax, 0x00040000 |
||
544 | call display_number_force |
||
545 | |||
41 | mikedld | 546 | |
465 | serge | 547 | |
548 | |||
742 | Rus | 549 | |
465 | serge | 550 | |
742 | Rus | 551 | call boot_log |
552 | |||
567 | serge | 553 | |
742 | Rus | 554 | |
567 | serge | 555 | |
1 | ha | 556 | |
557 | |||
558 | |||
742 | Rus | 559 | call boot_log |
560 | call setwindowdefaults |
||
561 | |||
1 | ha | 562 | |
563 | |||
564 | |||
742 | Rus | 565 | call boot_log |
566 | call init_background |
||
567 | call calculatebackground |
||
568 | |||
1 | ha | 569 | |
570 | |||
571 | |||
742 | Rus | 572 | call boot_log |
573 | call reserve_irqs_ports |
||
574 | |||
1 | ha | 575 | |
576 | |||
577 | |||
742 | Rus | 578 | call boot_log |
579 | ;call setirqreadports |
||
769 | Rus | 580 | |
1 | ha | 581 | |
582 | |||
583 | |||
742 | Rus | 584 | call boot_log |
585 | |||
214 | serge | 586 | |
742 | Rus | 587 | mov dword [SLOT_BASE+APPDATA.fpu_state], fpu_data |
588 | mov dword [SLOT_BASE+APPDATA.fpu_handler], eax |
||
589 | mov dword [SLOT_BASE+APPDATA.sse_handler], eax |
||
590 | |||
164 | serge | 591 | |
742 | Rus | 592 | |
281 | serge | 593 | |
742 | Rus | 594 | mov dword [SLOT_BASE+256+APPDATA.app_name+4], dword 'DLE ' |
595 | mov edi, __os_stack-8192+512 |
||
847 | serge | 596 | mov dword [SLOT_BASE+256+APPDATA.pl0_stack], edi |
742 | Rus | 597 | add edi, 0x2000-512 |
598 | mov dword [SLOT_BASE+256+APPDATA.fpu_state], edi |
||
599 | mov dword [SLOT_BASE+256+APPDATA.saved_esp0], edi ; just for case |
||
600 | mov dword [SLOT_BASE+256+APPDATA.io_map],\ |
||
601 | (tss._io_map_0-OS_BASE+PG_MAP) |
||
602 | mov dword [SLOT_BASE+256+APPDATA.io_map+4],\ |
||
603 | (tss._io_map_1-OS_BASE+PG_MAP) |
||
604 | |||
357 | serge | 605 | |
742 | Rus | 606 | mov ecx, 512/4 |
607 | cld |
||
608 | rep movsd |
||
609 | |||
357 | serge | 610 | |
843 | serge | 611 | mov dword [SLOT_BASE+256+APPDATA.sse_handler], eax |
742 | Rus | 612 | |
214 | serge | 613 | |
742 | Rus | 614 | mov dword [SLOT_BASE+256+APPDATA.fd_obj], ebx |
615 | mov dword [SLOT_BASE+256+APPDATA.bk_obj], ebx |
||
616 | |||
281 | serge | 617 | |
742 | Rus | 618 | |
521 | diamond | 619 | |
742 | Rus | 620 | mov [CURRENT_TASK],dword 1 |
621 | mov [TASK_COUNT],dword 1 |
||
622 | mov [current_slot], SLOT_BASE+256 |
||
623 | mov [TASK_BASE],dword TASK_DATA |
||
624 | mov [TASK_DATA+TASKDATA.wnd_number], 1 ; on screen number |
||
625 | mov [TASK_DATA+TASKDATA.pid], 1 ; process id number |
||
626 | mov [TASK_DATA+TASKDATA.mem_start], 0 ; process base address |
||
627 | |||
1 | ha | 628 | |
843 | serge | 629 | mov eax, [def_cursor] |
802 | serge | 630 | mov [SLOT_BASE+APPDATA.cursor],eax |
742 | Rus | 631 | mov [SLOT_BASE+APPDATA.cursor+256],eax |
632 | |||
281 | serge | 633 | |
897 | serge | 634 | ; call @load_pe_driver@4 |
635 | |||
837 | serge | 636 | |
465 | serge | 637 | |
281 | serge | 638 | |
742 | Rus | 639 | call boot_log |
640 | |||
848 | serge | 641 | |
742 | Rus | 642 | mov ecx,eax |
643 | mov esi,250 ; wait 1/4 a second |
||
644 | call delay_ms |
||
645 | call _rdtsc |
||
646 | |||
848 | serge | 647 | |
742 | Rus | 648 | shl eax,2 |
649 | mov [CPU_FREQ],eax ; save tsc / sec |
||
650 | mov ebx, 1000000 |
||
651 | div ebx |
||
652 | mov [stall_mcs], eax |
||
653 | |||
1 | ha | 654 | |
655 | |||
656 | |||
742 | Rus | 657 | |
1 | ha | 658 | |
774 | Rus | 659 | |
660 | |||
661 | ; stdcall load_driver, szCOM_MDriver |
||
839 | serge | 662 | |
774 | Rus | 663 | |
1 | ha | 664 | |
665 | |||
839 | serge | 666 | call fdc_init |
742 | Rus | 667 | |
1 | ha | 668 | |
669 | |||
670 | |||
928 | serge | 671 | jne no_pal_vga |
742 | Rus | 672 | mov esi,boot_pal_vga |
673 | call boot_log |
||
674 | call paletteVGA |
||
675 | no_pal_vga: |
||
1 | ha | 676 | |
677 | |||
928 | serge | 678 | jne no_pal_ega |
742 | Rus | 679 | mov esi,boot_pal_ega |
680 | call boot_log |
||
681 | call palette320x200 |
||
682 | no_pal_ega: |
||
1 | ha | 683 | |
684 | |||
685 | |||
686 | |||
742 | Rus | 687 | |
1 | ha | 688 | |
465 | serge | 689 | |
690 | |||
897 | serge | 691 | ; stdcall map_page,esi,(tss._io_map_0-OS_BASE), PG_MAP |
861 | serge | 692 | ; add esi, 0x1000 |
693 | ; stdcall map_page,esi,(tss._io_map_1-OS_BASE), PG_MAP |
||
694 | |||
465 | serge | 695 | |
859 | serge | 696 | ; (tss._io_map_0-OS_BASE), PG_MAP |
697 | ; stdcall map_page,tss._io_map_1,\ |
||
698 | ; (tss._io_map_1-OS_BASE), PG_MAP |
||
699 | |||
465 | serge | 700 | |
847 | serge | 701 | ; cmp ax,'r1' ; if not rused ram disk - load network configuration from files {SPraid.simba} |
702 | ; je no_st_network |
||
703 | ; call set_network_conf |
||
704 | ; no_st_network: |
||
705 | |||
512 | spraid | 706 | |
1 | ha | 707 | |
501 | serge | 708 | |
897 | serge | 709 | push 0 |
710 | push read_firstapp |
||
711 | call _sys_exec |
||
712 | add esp, 12 |
||
713 | |||
488 | spraid | 714 | |
742 | Rus | 715 | je first_app_found |
716 | |||
501 | serge | 717 | |
742 | Rus | 718 | call boot_log |
719 | |||
653 | diamond | 720 | |
742 | Rus | 721 | hlt |
722 | |||
501 | serge | 723 | |
237 | serge | 724 | |
501 | serge | 725 | |
742 | Rus | 726 | |
1 | ha | 727 | |
742 | Rus | 728 | mov [CURRENT_TASK],dword 1 ; set OS task fisrt |
729 | |||
1 | ha | 730 | |
21 | poddubny | 731 | mov al, 0xf6 ; reset keyboard, scan enabled |
742 | Rus | 732 | call kb_write |
733 | |||
1 | ha | 734 | |
742 | Rus | 735 | xor ecx,ecx |
736 | @@: |
||
841 | serge | 737 | in al,64h |
742 | Rus | 738 | and al,00000010b |
739 | loopnz @b |
||
740 | |||
1 | ha | 741 | |
742 | Rus | 742 | call kb_write |
743 | ; call kb_read |
||
265 | diamond | 744 | mov al, 0 ; 30 250 ;00100010b ; 24 500 ;00100100b ; 20 500 |
742 | Rus | 745 | call kb_write |
746 | ; call kb_read |
||
265 | diamond | 747 | ;// mike.dld [ |
1 | ha | 748 | call set_lights |
742 | Rus | 749 | ;// mike.dld ] |
1 | ha | 750 | |
751 | |||
21 | poddubny | 752 | |
1 | ha | 753 | |
847 | serge | 754 | ; mov esi, boot_tasking |
755 | ; call boot_log |
||
756 | ;.bll1: in al, 0x60 ; wait for ESC key press |
||
757 | ; cmp al, 129 |
||
758 | ; jne .bll1 |
||
759 | ;end if |
||
760 | |||
767 | diamond | 761 | |
1 | ha | 762 | |
763 | |||
742 | Rus | 764 | call boot_log |
765 | |||
41 | mikedld | 766 | |
848 | serge | 767 | out 0xA1,al |
742 | Rus | 768 | out 0x21,al |
769 | |||
1 | ha | 770 | |
742 | Rus | 771 | |
1 | ha | 772 | |
773 | |||
774 | |||
742 | Rus | 775 | out 0x20,al |
776 | out 0xa0,al |
||
777 | |||
1 | ha | 778 | |
742 | Rus | 779 | |
1 | ha | 780 | |
774 | Rus | 781 | |
164 | serge | 782 | |
1 | ha | 783 | cmp [IDEContrRegsBaseAddr], 0 |
742 | Rus | 784 | setnz [dma_hdd] |
785 | mov [timer_ticks_enable],1 ; for cd driver |
||
786 | |||
1 | ha | 787 | |
742 | Rus | 788 | call change_task |
789 | |||
465 | serge | 790 | |
742 | Rus | 791 | |
465 | serge | 792 | |
725 | diamond | 793 | |
1 | ha | 794 | |
742 | Rus | 795 | |
1 | ha | 796 | |
465 | serge | 797 | include 'fdo.inc' |
798 | |||
799 | |||
800 | boot_log: |
||
801 | pushad |
||
742 | Rus | 802 | |
465 | serge | 803 | |
742 | Rus | 804 | mov bx,word [boot_y] |
805 | add [boot_y],dword 10 |
||
806 | mov ecx,0x80ffffff ; ASCIIZ string with white color |
||
807 | mov edx,esi |
||
808 | mov edi,1 |
||
809 | |||
465 | serge | 810 | |
848 | serge | 811 | |
812 | |||
742 | Rus | 813 | call checkVga_N13 |
814 | |||
465 | serge | 815 | |
764 | Rus | 816 | |
465 | serge | 817 | |
742 | Rus | 818 | |
465 | serge | 819 | |
820 | |||
1 | ha | 821 | ; ; |
822 | ; MAIN OS LOOP START ; |
||
33 | mario79 | 823 | ; ; |
1 | ha | 824 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
825 | align 32 |
||
826 | osloop: |
||
827 | call [draw_pointer] |
||
742 | Rus | 828 | call checkbuttons |
829 | call checkwindows |
||
830 | ; call check_window_move_request |
||
49 | mikedld | 831 | call checkmisc |
742 | Rus | 832 | call checkVga_N13 |
833 | call stack_handler |
||
839 | serge | 834 | call checkidle |
742 | Rus | 835 | call check_fdd_motor_status |
836 | call check_ATAPI_device_event |
||
837 | jmp osloop |
||
838 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
33 | mario79 | 839 | ; ; |
840 | ; MAIN OS LOOP END ; |
||
841 | ; ; |
||
842 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
843 | |||
1 | ha | 844 | |
845 | pushad |
||
742 | Rus | 846 | |
1 | ha | 847 | |
742 | Rus | 848 | jne no_idle_state |
849 | |||
1 | ha | 850 | |
742 | Rus | 851 | mov eax,[idlemem] |
852 | mov ebx,[timer_ticks] ;[0xfdf0] |
||
853 | cmp eax,ebx |
||
854 | jnz idle_exit |
||
855 | call _rdtsc |
||
856 | mov ecx,eax |
||
857 | idle_loop: |
||
1 | ha | 858 | hlt |
742 | Rus | 859 | cmp [check_idle_semaphore],0 |
860 | jne idle_loop_exit |
||
861 | mov eax,[timer_ticks] ;[0xfdf0] |
||
862 | cmp ebx,eax |
||
863 | jz idle_loop |
||
864 | idle_loop_exit: |
||
1 | ha | 865 | mov [idlemem],eax |
742 | Rus | 866 | call _rdtsc |
867 | sub eax,ecx |
||
868 | mov ebx,[idleuse] |
||
869 | add ebx,eax |
||
870 | mov [idleuse],ebx |
||
871 | |||
1 | ha | 872 | |
742 | Rus | 873 | ret |
874 | |||
1 | ha | 875 | |
876 | |||
877 | |||
742 | Rus | 878 | mov [idlemem],ebx |
879 | call change_task |
||
880 | |||
1 | ha | 881 | |
742 | Rus | 882 | ret |
883 | |||
1 | ha | 884 | |
885 | |||
886 | |||
742 | Rus | 887 | |
1 | ha | 888 | |
742 | Rus | 889 | mov [idlemem],ebx |
890 | call change_task |
||
891 | |||
1 | ha | 892 | |
742 | Rus | 893 | ret |
894 | |||
1 | ha | 895 | |
896 | idlemem dd 0x0 |
||
742 | Rus | 897 | idleuse dd 0x0 |
898 | idleusesec dd 0x0 |
||
899 | check_idle_semaphore dd 0x0 |
||
900 | endg |
||
1 | ha | 901 | |
902 | |||
903 | |||
904 | |||
905 | ; ; |
||
906 | ; INCLUDED SYSTEM FILES ; |
||
907 | ; ; |
||
908 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
909 | |||
910 | |||
911 | |||
7 | me_root | 912 | |
1 | ha | 913 | |
914 | |||
915 | ; ; |
||
916 | ; KERNEL FUNCTIONS ; |
||
917 | ; ; |
||
918 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
919 | |||
920 | |||
921 | |||
922 | |||
742 | Rus | 923 | |
1 | ha | 924 | |
742 | Rus | 925 | ;mov [irq_owner+4*1], 1 ; keyboard |
769 | Rus | 926 | mov [irq_owner+4*6], 1 ; floppy diskette |
742 | Rus | 927 | mov [irq_owner+4*13], 1 ; math co-pros |
928 | mov [irq_owner+4*14], 1 ; ide I |
||
929 | mov [irq_owner+4*15], 1 ; ide II |
||
930 | |||
465 | serge | 931 | |
671 | Ghost | 932 | mov edi,1 ; 0x00-0x2d |
742 | Rus | 933 | mov [RESERVED_PORTS],edi |
934 | shl edi,4 |
||
935 | mov [RESERVED_PORTS+edi+0],dword 1 |
||
936 | mov [RESERVED_PORTS+edi+4],dword 0x0 |
||
937 | mov [RESERVED_PORTS+edi+8],dword 0x2d |
||
938 | |||
269 | serge | 939 | |
742 | Rus | 940 | mov edi,[RESERVED_PORTS] |
941 | shl edi,4 |
||
942 | mov [RESERVED_PORTS+edi+0],dword 1 |
||
943 | mov [RESERVED_PORTS+edi+4],dword 0x30 |
||
944 | mov [RESERVED_PORTS+edi+8],dword 0x4d |
||
945 | |||
269 | serge | 946 | |
742 | Rus | 947 | mov edi,[RESERVED_PORTS] |
948 | shl edi,4 |
||
949 | mov [RESERVED_PORTS+edi+0],dword 1 |
||
950 | mov [RESERVED_PORTS+edi+4],dword 0x50 |
||
951 | mov [RESERVED_PORTS+edi+8],dword 0xdf |
||
952 | |||
233 | serge | 953 | |
742 | Rus | 954 | mov edi,[RESERVED_PORTS] |
955 | shl edi,4 |
||
956 | mov [RESERVED_PORTS+edi+0],dword 1 |
||
957 | mov [RESERVED_PORTS+edi+4],dword 0xe5 |
||
958 | mov [RESERVED_PORTS+edi+8],dword 0xff |
||
959 | |||
233 | serge | 960 | |
742 | Rus | 961 | ret |
962 | |||
1 | ha | 963 | |
964 | |||
965 | |||
742 | Rus | 966 | mov [irq12read+4],dword 0 ; end of port list |
967 | ;mov [irq04read+0],dword 0x3f8 + 0x01000000 ; read port 0x3f8 , byte |
||
769 | Rus | 968 | ;mov [irq04read+4],dword 0 ; end of port list |
969 | ;mov [irq03read+0],dword 0x2f8 + 0x01000000 ; read port 0x2f8 , byte |
||
970 | ;mov [irq03read+4],dword 0 ; end of port list |
||
971 | |||
1 | ha | 972 | |
742 | Rus | 973 | |
1 | ha | 974 | |
975 | process_number dd 0x1 |
||
976 | endg |
||
977 | |||
978 | |||
979 | |||
980 | |||
859 | serge | 981 | .fl60: |
928 | serge | 982 | in al,0x60 |
983 | loop .fl60 |
||
984 | |||
1 | ha | 985 | |
928 | serge | 986 | mov [BTN_COUNT], 0 ; button buffer |
987 | |||
41 | mikedld | 988 | |
928 | serge | 989 | mov ax,[BOOT_VAR+0x900c] |
990 | shr ax,1 |
||
991 | shl eax,16 |
||
992 | mov ax,[BOOT_VAR+0x900A] |
||
993 | shr ax,1 |
||
994 | mov dword [MOUSE_X], eax |
||
995 | pop eax |
||
996 | |||
1 | ha | 997 | |
928 | serge | 998 | |
999 | |||
1 | ha | 1000 | mov [next_usage_update], 100 |
928 | serge | 1001 | mov [dont_switch], 0 ; change task if possible |
1002 | |||
1 | ha | 1003 | |
742 | Rus | 1004 | |
1 | ha | 1005 | |
1006 | mouse_centered: |
||
1007 | push eax |
||
742 | Rus | 1008 | mov eax,[Screen_Max_X] |
759 | Rus | 1009 | shr eax,1 |
742 | Rus | 1010 | mov [MOUSE_X],ax |
1011 | mov eax,[Screen_Max_Y] |
||
759 | Rus | 1012 | shr eax,1 |
742 | Rus | 1013 | mov [MOUSE_Y],ax |
1014 | pop eax |
||
1015 | ret |
||
1016 | ;* mouse centered - end code- Mario79 |
||
1 | ha | 1017 | |
1018 | |||
1019 | |||
1020 | |||
1021 | |||
1022 | |||
742 | Rus | 1023 | and ebx,65535 |
1 | ha | 1024 | |
1025 | |||
381 | serge | 1026 | test ecx,ecx |
1 | ha | 1027 | jne sopl8 |
1028 | mov [esp+36],dword 1 |
||
1029 | ret |
||
1030 | |||
1031 | |||
1032 | mov edx,[TASK_BASE] |
||
379 | serge | 1033 | mov edx,[edx+0x4] |
1 | ha | 1034 | and ebx,65535 |
1035 | cld |
||
1036 | sopl1: |
||
1037 | |||
1038 | |||
1039 | shl esi,4 |
||
1040 | add esi,RESERVED_PORTS |
||
381 | serge | 1041 | cmp edx,[esi+0] |
1 | ha | 1042 | jne sopl2 |
1043 | cmp ebx,[esi+4] |
||
1044 | jb sopl2 |
||
742 | Rus | 1045 | cmp ebx,[esi+8] |
1 | ha | 1046 | jg sopl2 |
742 | Rus | 1047 | jmp sopl3 |
1 | ha | 1048 | |
1049 | |||
1050 | |||
1051 | |||
1052 | jnz sopl1 |
||
1053 | mov [esp+36],dword 1 |
||
1054 | ret |
||
1055 | |||
1056 | |||
1057 | |||
1058 | |||
1059 | jnz sopl4 |
||
1060 | |||
1061 | |||
742 | Rus | 1062 | out dx,al |
1 | ha | 1063 | mov [esp+36],dword 0 |
1064 | ret |
||
1065 | |||
1066 | |||
1067 | |||
1068 | |||
742 | Rus | 1069 | in al,dx |
1070 | and eax,0xff |
||
1 | ha | 1071 | mov [esp+36],dword 0 |
1072 | mov [esp+24],eax |
||
1073 | ret |
||
1074 | |||
1075 | |||
1076 | |||
1077 | |||
1078 | ; al=1 -> ebx is pointer |
||
1079 | ; ah=0 -> display decimal |
||
1080 | ; ah=1 -> display hexadecimal |
||
1081 | ; ah=2 -> display binary |
||
1082 | ; eax bits 16-21 = number of digits to display (0-32) |
||
1083 | ; eax bits 22-31 = reserved |
||
1084 | ; |
||
1085 | ; ebx = number or pointer |
||
1086 | ; ecx = x shl 16 + y |
||
1087 | ; edx = color |
||
1088 | xor edi, edi |
||
655 | mario79 | 1089 | display_number_force: |
211 | serge | 1090 | push eax |
652 | mario79 | 1091 | and eax,0x3fffffff |
655 | mario79 | 1092 | cmp eax,0xffff ; length > 0 ? |
1093 | pop eax |
||
1094 | jge cont_displ |
||
1 | ha | 1095 | ret |
1096 | cont_displ: |
||
1097 | push eax |
||
652 | mario79 | 1098 | and eax,0x3fffffff |
655 | mario79 | 1099 | cmp eax,61*0x10000 ; length <= 60 ? |
1100 | pop eax |
||
1101 | jb cont_displ2 |
||
75 | diamond | 1102 | ret |
1 | ha | 1103 | cont_displ2: |
1104 | |||
1105 | |||
1106 | |||
1107 | |||
655 | mario79 | 1108 | jne displnl1 |
1 | ha | 1109 | mov ebp,ebx |
655 | mario79 | 1110 | add ebp,4 |
1111 | mov ebp,[ebp] |
||
840 | serge | 1112 | mov ebx,[ebx] |
1113 | displnl1: |
||
1 | ha | 1114 | sub esp,64 |
1115 | |||
1116 | |||
655 | mario79 | 1117 | jne no_display_desnum |
1 | ha | 1118 | shr eax,16 |
1119 | and eax,0xC03f |
||
655 | mario79 | 1120 | ; and eax,0x3f |
652 | mario79 | 1121 | push eax |
1122 | and eax,0x3f |
||
75 | diamond | 1123 | mov edi,esp |
1 | ha | 1124 | add edi,4+64-1 |
194 | diamond | 1125 | mov ecx,eax |
1 | ha | 1126 | mov eax,ebx |
1127 | mov ebx,10 |
||
1128 | d_desnum: |
||
1129 | xor edx,edx |
||
1130 | call division_64_bits |
||
655 | mario79 | 1131 | div ebx |
1 | ha | 1132 | add dl,48 |
1133 | mov [edi],dl |
||
1134 | dec edi |
||
1135 | loop d_desnum |
||
1136 | pop eax |
||
1137 | call normalize_number |
||
652 | mario79 | 1138 | call draw_num_text |
1 | ha | 1139 | add esp,64 |
1140 | popad |
||
1141 | ret |
||
1142 | no_display_desnum: |
||
1143 | |||
1144 | |||
655 | mario79 | 1145 | jne no_display_hexnum |
1 | ha | 1146 | shr eax,16 |
1147 | and eax,0xC03f |
||
655 | mario79 | 1148 | ; and eax,0x3f |
652 | mario79 | 1149 | push eax |
1150 | and eax,0x3f |
||
75 | diamond | 1151 | mov edi,esp |
1 | ha | 1152 | add edi,4+64-1 |
194 | diamond | 1153 | mov ecx,eax |
1 | ha | 1154 | mov eax,ebx |
1155 | mov ebx,16 |
||
1156 | d_hexnum: |
||
1157 | xor edx,edx |
||
1158 | call division_64_bits |
||
655 | mario79 | 1159 | div ebx |
1 | ha | 1160 | add edx,hexletters |
1161 | mov dl,[edx] |
||
1162 | mov [edi],dl |
||
1163 | dec edi |
||
1164 | loop d_hexnum |
||
1165 | pop eax |
||
1166 | call normalize_number |
||
652 | mario79 | 1167 | call draw_num_text |
1 | ha | 1168 | add esp,64 |
1169 | popad |
||
1170 | ret |
||
1171 | no_display_hexnum: |
||
1172 | |||
1173 | |||
655 | mario79 | 1174 | jne no_display_binnum |
1 | ha | 1175 | shr eax,16 |
1176 | and eax,0xC03f |
||
655 | mario79 | 1177 | ; and eax,0x3f |
652 | mario79 | 1178 | push eax |
1179 | and eax,0x3f |
||
75 | diamond | 1180 | mov edi,esp |
1 | ha | 1181 | add edi,4+64-1 |
194 | diamond | 1182 | mov ecx,eax |
1 | ha | 1183 | mov eax,ebx |
1184 | mov ebx,2 |
||
1185 | d_binnum: |
||
1186 | xor edx,edx |
||
1187 | call division_64_bits |
||
655 | mario79 | 1188 | div ebx |
1 | ha | 1189 | add dl,48 |
1190 | mov [edi],dl |
||
1191 | dec edi |
||
1192 | loop d_binnum |
||
1193 | pop eax |
||
1194 | call normalize_number |
||
652 | mario79 | 1195 | call draw_num_text |
1 | ha | 1196 | add esp,64 |
1197 | popad |
||
1198 | ret |
||
1199 | no_display_binnum: |
||
1200 | |||
1201 | |||
1202 | popad |
||
1203 | ret |
||
1204 | |||
1205 | |||
652 | mario79 | 1206 | test ah,0x80 |
1207 | jz .continue |
||
1208 | mov ecx,48 |
||
1209 | and eax,0x3f |
||
1210 | @@: |
||
1211 | inc edi |
||
1212 | cmp [edi],cl |
||
1213 | jne .continue |
||
1214 | dec eax |
||
1215 | cmp eax,1 |
||
1216 | ja @r |
||
665 | diamond | 1217 | mov al,1 |
1218 | .continue: |
||
652 | mario79 | 1219 | and eax,0x3f |
1220 | ret |
||
1221 | |||
1 | ha | 1222 | |
655 | mario79 | 1223 | test [esp+1+4],byte 0x40 |
1224 | jz .continue |
||
1225 | push eax |
||
1226 | mov eax,ebp |
||
1227 | div ebx |
||
1228 | mov ebp,eax |
||
1229 | pop eax |
||
1230 | .continue: |
||
1231 | ret |
||
1232 | |||
652 | mario79 | 1233 | |
1 | ha | 1234 | mov esi,eax |
684 | diamond | 1235 | mov edx,64+4 |
1236 | sub edx,eax |
||
1237 | add edx,esp |
||
1238 | mov ebx,[esp+64+32-8+4] |
||
1239 | ; add window start x & y |
||
1240 | mov ecx,[TASK_BASE] |
||
1241 | |||
465 | serge | 1242 | |
1243 | shl edi,8 |
||
1244 | |||
1245 | |||
684 | diamond | 1246 | add eax,[edi+SLOT_BASE+APPDATA.wnd_clientbox.left] |
1247 | shl eax,16 |
||
1248 | add eax,[ecx-twdw+WDATA.box.top] |
||
1249 | add eax,[edi+SLOT_BASE+APPDATA.wnd_clientbox.top] |
||
1250 | add ebx,eax |
||
1251 | mov ecx,[esp+64+32-12+4] |
||
1252 | and ecx, not 0x80000000 ; force counted string |
||
742 | Rus | 1253 | mov eax, [esp+64+8] ; background color (if given) |
1254 | mov edi, [esp+64+4] |
||
1255 | jmp dtext |
||
139 | diamond | 1256 | |
1 | ha | 1257 | |
1258 | |||
1259 | |||
1260 | |||
1261 | |||
1262 | ; 2=keyboard 1, base kaybap 2, shift keymap, 9 country 1eng 2fi 3ger 4rus |
||
1263 | ; 3=cd base 1, pri.master 2, pri slave 3 sec master, 4 sec slave |
||
1264 | ; 5=system language, 1eng 2fi 3ger 4rus |
||
1265 | ; 7=hd base 1, pri.master 2, pri slave 3 sec master, 4 sec slave |
||
1266 | ; 8=fat32 partition in hd |
||
1267 | ; 9 |
||
1268 | ; 10 = sound dma channel |
||
1269 | ; 11 = enable lba read |
||
1270 | ; 12 = enable pci access |
||
1271 | |||
1272 | |||
1273 | |||
1274 | cmp eax,1 ; MIDI |
||
742 | Rus | 1275 | jnz nsyse1 |
1 | ha | 1276 | cmp ebx,0x100 |
1277 | jb nsyse1 |
||
1278 | mov edx,65535 |
||
1279 | cmp edx,ebx |
||
1280 | jb nsyse1 |
||
1281 | mov [midi_base],bx |
||
1282 | mov word [mididp],bx |
||
1283 | inc bx |
||
1284 | mov word [midisp],bx |
||
1285 | ret |
||
1286 | |||
1287 | |||
283 | diamond | 1288 | midi_base dw 0 |
1 | ha | 1289 | endg |
283 | diamond | 1290 | |
1 | ha | 1291 | |
1292 | |||
1293 | |||
742 | Rus | 1294 | jnz nsyse2 |
1 | ha | 1295 | cmp ebx,1 |
1296 | jnz kbnobase |
||
1297 | mov edi,[TASK_BASE] |
||
379 | serge | 1298 | add ecx,[edi+TASKDATA.mem_start] |
115 | poddubny | 1299 | mov eax,ecx |
1 | ha | 1300 | mov ebx,keymap |
1301 | mov ecx,128 |
||
1302 | call memmove |
||
1303 | ret |
||
1304 | kbnobase: |
||
1305 | cmp ebx,2 |
||
1306 | jnz kbnoshift |
||
1307 | mov edi,[TASK_BASE] |
||
379 | serge | 1308 | add ecx,[edi+TASKDATA.mem_start] |
115 | poddubny | 1309 | mov eax,ecx |
1 | ha | 1310 | mov ebx,keymap_shift |
1311 | mov ecx,128 |
||
1312 | call memmove |
||
1313 | ret |
||
1314 | kbnoshift: |
||
1315 | cmp ebx,3 |
||
1316 | jne kbnoalt |
||
1317 | mov edi,[TASK_BASE] |
||
379 | serge | 1318 | add ecx,[edi+TASKDATA.mem_start] |
115 | poddubny | 1319 | mov eax,ecx |
1 | ha | 1320 | mov ebx,keymap_alt |
1321 | mov ecx,128 |
||
1322 | call memmove |
||
1323 | ret |
||
1324 | kbnoalt: |
||
1325 | cmp ebx,9 |
||
1326 | jnz kbnocountry |
||
1327 | mov word [keyboard],cx |
||
1328 | ret |
||
1329 | kbnocountry: |
||
1330 | mov [esp+36],dword 1 |
||
1331 | ret |
||
1332 | nsyse2: |
||
1333 | cmp eax,3 ; CD |
||
742 | Rus | 1334 | jnz nsyse4 |
802 | serge | 1335 | test ebx,ebx |
75 | diamond | 1336 | jz nosesl |
1337 | cmp ebx, 4 |
||
1338 | ja nosesl |
||
1339 | mov [cd_base],bl |
||
1 | ha | 1340 | cmp ebx,1 |
1341 | jnz noprma |
||
1342 | mov [cdbase],0x1f0 |
||
1343 | mov [cdid],0xa0 |
||
1344 | noprma: |
||
1345 | cmp ebx,2 |
||
1346 | jnz noprsl |
||
1347 | mov [cdbase],0x1f0 |
||
1348 | mov [cdid],0xb0 |
||
1349 | noprsl: |
||
1350 | cmp ebx,3 |
||
1351 | jnz nosema |
||
1352 | mov [cdbase],0x170 |
||
1353 | mov [cdid],0xa0 |
||
1354 | nosema: |
||
1355 | cmp ebx,4 |
||
1356 | jnz nosesl |
||
1357 | mov [cdbase],0x170 |
||
1358 | mov [cdid],0xb0 |
||
1359 | nosesl: |
||
1360 | ret |
||
1361 | |||
1362 | |||
1363 | |||
1364 | |||
1365 | |||
1366 | |||
742 | Rus | 1367 | jnz nsyse5 |
1 | ha | 1368 | mov [syslang],ebx |
1369 | ret |
||
1370 | nsyse5: |
||
1371 | |||
1372 | |||
742 | Rus | 1373 | jne nsyse7 |
1 | ha | 1374 | test ebx,ebx |
75 | diamond | 1375 | jz nosethd |
1376 | cmp ebx,4 |
||
1377 | ja nosethd |
||
1378 | mov [hd_base],bl |
||
1 | ha | 1379 | cmp ebx,1 |
1380 | jnz noprmahd |
||
1381 | mov [hdbase],0x1f0 |
||
1382 | mov [hdid],0x0 |
||
1383 | mov [hdpos],1 |
||
1384 | ; call set_FAT32_variables |
||
1385 | noprmahd: |
||
1386 | cmp ebx,2 |
||
1387 | jnz noprslhd |
||
1388 | mov [hdbase],0x1f0 |
||
1389 | mov [hdid],0x10 |
||
1390 | mov [hdpos],2 |
||
1391 | ; call set_FAT32_variables |
||
1392 | noprslhd: |
||
1393 | cmp ebx,3 |
||
1394 | jnz nosemahd |
||
1395 | mov [hdbase],0x170 |
||
1396 | mov [hdid],0x0 |
||
1397 | mov [hdpos],3 |
||
1398 | ; call set_FAT32_variables |
||
1399 | nosemahd: |
||
1400 | cmp ebx,4 |
||
1401 | jnz noseslhd |
||
1402 | mov [hdbase],0x170 |
||
1403 | mov [hdid],0x10 |
||
1404 | mov [hdpos],4 |
||
1405 | ; call set_FAT32_variables |
||
1406 | noseslhd: |
||
1407 | call reserve_hd1 |
||
1408 | call reserve_hd_channel |
||
321 | diamond | 1409 | call free_hd_channel |
1410 | mov [hd1_status],0 ; free |
||
742 | Rus | 1411 | nosethd: |
75 | diamond | 1412 | ret |
1 | ha | 1413 | |
1414 | |||
283 | diamond | 1415 | hd_base db 0 |
1 | ha | 1416 | endg |
283 | diamond | 1417 | |
1 | ha | 1418 | |
802 | serge | 1419 | |
1 | ha | 1420 | |
742 | Rus | 1421 | jne nsyse8 |
1 | ha | 1422 | mov [fat32part],ebx |
1423 | ; call set_FAT32_variables |
||
1424 | call reserve_hd1 |
||
1425 | call reserve_hd_channel |
||
321 | diamond | 1426 | call free_hd_channel |
1427 | pusha |
||
1 | ha | 1428 | call choice_necessity_partition_1 |
1429 | popa |
||
1430 | mov [hd1_status],0 ; free |
||
742 | Rus | 1431 | ret |
1 | ha | 1432 | |
1433 | |||
802 | serge | 1434 | cmp eax,11 ; ENABLE LBA READ |
742 | Rus | 1435 | jne no_set_lba_read |
1 | ha | 1436 | and ebx,1 |
1437 | mov [lba_read_enabled],ebx |
||
1438 | ret |
||
1439 | |||
1440 | |||
802 | serge | 1441 | cmp eax,12 ; ENABLE PCI ACCESS |
1442 | jne no_set_pci_access |
||
1 | ha | 1443 | and ebx,1 |
1444 | mov [pci_access_enabled],ebx |
||
1445 | ret |
||
1446 | no_set_pci_access: |
||
1447 | |||
1448 | |||
1449 | include 'vmodeint.inc' |
||
1450 | ;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
||
1451 | |||
1452 | |||
75 | diamond | 1453 | mov [esp+36],dword -1 |
1 | ha | 1454 | ret |
1455 | |||
1456 | |||
1457 | |||
1458 | |||
1459 | |||
1460 | |||
1461 | ; 2=keyboard 1, base kaybap 2, shift keymap, 9 country 1eng 2fi 3ger 4rus |
||
1462 | ; 3=cd base 1, pri.master 2, pri slave 3 sec master, 4 sec slave |
||
1463 | ; 5=system language, 1eng 2fi 3ger 4rus |
||
1464 | ; 7=hd base 1, pri.master 2, pri slave 3 sec master, 4 sec slave |
||
1465 | ; 8=fat32 partition in hd |
||
1466 | ; 9=get hs timer tic |
||
1467 | |||
1468 | |||
1469 | jne ngsyse1 |
||
1470 | movzx eax,[midi_base] |
||
1471 | mov [esp+36],eax |
||
1472 | ret |
||
1473 | ngsyse1: |
||
802 | serge | 1474 | |
1 | ha | 1475 | |
1476 | jne ngsyse2 |
||
1477 | cmp ebx,1 |
||
1478 | jnz kbnobaseret |
||
1479 | mov edi,[TASK_BASE] |
||
379 | serge | 1480 | add ecx,[edi+TASKDATA.mem_start] |
115 | poddubny | 1481 | mov ebx,ecx |
1 | ha | 1482 | mov eax,keymap |
1483 | mov ecx,128 |
||
1484 | call memmove |
||
1485 | ret |
||
1486 | kbnobaseret: |
||
802 | serge | 1487 | cmp ebx,2 |
1 | ha | 1488 | jnz kbnoshiftret |
1489 | mov edi,[TASK_BASE] |
||
379 | serge | 1490 | add ecx,[edi+TASKDATA.mem_start] |
115 | poddubny | 1491 | mov ebx,ecx |
1 | ha | 1492 | mov eax,keymap_shift |
1493 | mov ecx,128 |
||
1494 | call memmove |
||
1495 | ret |
||
1496 | kbnoshiftret: |
||
802 | serge | 1497 | cmp ebx,3 |
1 | ha | 1498 | jne kbnoaltret |
1499 | mov edi,[TASK_BASE] |
||
379 | serge | 1500 | add ecx,[edi+TASKDATA.mem_start] |
115 | poddubny | 1501 | mov ebx,ecx |
1 | ha | 1502 | mov eax,keymap_alt |
1503 | mov ecx,128 |
||
1504 | call memmove |
||
1505 | ret |
||
1506 | kbnoaltret: |
||
802 | serge | 1507 | cmp ebx,9 |
1 | ha | 1508 | jnz ngsyse2 |
1509 | movzx eax,word [keyboard] |
||
1510 | mov [esp+36],eax |
||
1511 | ret |
||
1512 | ngsyse2: |
||
802 | serge | 1513 | |
1 | ha | 1514 | |
802 | serge | 1515 | jnz ngsyse3 |
1516 | movzx eax,[cd_base] |
||
1517 | mov [esp+36],eax |
||
1518 | ret |
||
1519 | ngsyse3: |
||
1520 | cmp eax,5 |
||
1521 | jnz ngsyse5 |
||
1522 | mov eax,[syslang] |
||
1523 | mov [esp+36],eax |
||
1524 | ret |
||
1525 | ngsyse5: |
||
1526 | cmp eax,7 |
||
1 | ha | 1527 | jnz ngsyse7 |
1528 | movzx eax,[hd_base] |
||
1529 | mov [esp+36],eax |
||
1530 | ret |
||
1531 | ngsyse7: |
||
802 | serge | 1532 | cmp eax,8 |
1 | ha | 1533 | jnz ngsyse8 |
1534 | mov eax,[fat32part] |
||
1535 | mov [esp+36],eax |
||
1536 | ret |
||
1537 | ngsyse8: |
||
802 | serge | 1538 | cmp eax,9 |
1 | ha | 1539 | jne ngsyse9 |
1540 | mov eax,[timer_ticks] ;[0xfdf0] |
||
1541 | mov [esp+36],eax |
||
1542 | ret |
||
1543 | ngsyse9: |
||
802 | serge | 1544 | cmp eax,11 |
1 | ha | 1545 | jnz ngsyse11 |
1546 | mov eax,[lba_read_enabled] |
||
1547 | mov [esp+36],eax |
||
1548 | ret |
||
1549 | ngsyse11: |
||
802 | serge | 1550 | cmp eax,12 |
1 | ha | 1551 | jnz ngsyse12 |
1552 | mov eax,[pci_access_enabled] |
||
1553 | mov [esp+36],eax |
||
1554 | ret |
||
1555 | ngsyse12: |
||
802 | serge | 1556 | mov [esp+36],dword 1 |
1 | ha | 1557 | ret |
1558 | |||
1559 | |||
479 | kastigar | 1560 | mov eax,[timer_ticks] |
1561 | ret |
||
1562 | |||
1563 | |||
283 | diamond | 1564 | align 4 |
1 | ha | 1565 | mousefn dd msscreen, mswin, msbutton, msset |
221 | serge | 1566 | dd app_load_cursor |
742 | Rus | 1567 | dd app_set_cursor |
1568 | dd app_delete_cursor |
||
1569 | dd msz |
||
1570 | endg |
||
283 | diamond | 1571 | |
1 | ha | 1572 | |
1573 | |||
1574 | |||
1575 | ; eax=1 window relative |
||
1576 | ; eax=2 buttons pressed |
||
1577 | ; eax=3 set mouse pos ; reserved |
||
221 | serge | 1578 | ; eax=4 load cursor |
1579 | ; eax=5 set cursor |
||
1580 | ; eax=6 delete cursor ; reserved |
||
1581 | ; eax=7 get mouse_z |
||
479 | kastigar | 1582 | |
1 | ha | 1583 | |
742 | Rus | 1584 | ja msset |
1585 | jmp [mousefn+eax*4] |
||
1586 | msscreen: |
||
221 | serge | 1587 | mov eax, dword [MOUSE_X] |
928 | serge | 1588 | shl eax,16 |
742 | Rus | 1589 | mov ax,[MOUSE_Y] |
1590 | mov [esp+36],eax |
||
1591 | ret |
||
1592 | mswin: |
||
221 | serge | 1593 | mov eax, dword [MOUSE_X] |
928 | serge | 1594 | shl eax,16 |
742 | Rus | 1595 | mov ax,[MOUSE_Y] |
1596 | mov esi,[TASK_BASE] |
||
1597 | mov bx, word [esi-twdw+WDATA.box.left] |
||
1598 | shl ebx,16 |
||
1599 | mov bx, word [esi-twdw+WDATA.box.top] |
||
1600 | sub eax,ebx |
||
1601 | |||
1 | ha | 1602 | |
742 | Rus | 1603 | shl edi,8 |
1604 | sub ax,word[edi+SLOT_BASE+APPDATA.wnd_clientbox.top] |
||
1605 | rol eax,16 |
||
1606 | sub ax,word[edi+SLOT_BASE+APPDATA.wnd_clientbox.left] |
||
1607 | rol eax,16 |
||
1608 | mov [esp+36],eax |
||
1609 | ret |
||
1610 | msbutton: |
||
221 | serge | 1611 | movzx eax,byte [btn_down] |
928 | serge | 1612 | mov [esp+36],eax |
742 | Rus | 1613 | ret |
1614 | msz: |
||
479 | kastigar | 1615 | mov edi, [TASK_COUNT] |
742 | Rus | 1616 | movzx edi, word [WIN_POS + edi*2] |
1617 | cmp edi, [CURRENT_TASK] |
||
1618 | jne @f |
||
1619 | mov eax,[mouse_scroll_h] |
||
928 | serge | 1620 | shl eax,16 |
742 | Rus | 1621 | mov ax, word [mouse_scroll_v] |
928 | serge | 1622 | mov [esp+36],eax |
742 | Rus | 1623 | mov [mouse_scroll_h], 0 |
928 | serge | 1624 | mov [mouse_scroll_v], 0 |
1625 | ret |
||
742 | Rus | 1626 | @@: |
479 | kastigar | 1627 | mov [esp+36],dword 0 |
742 | Rus | 1628 | ret |
1629 | msset: |
||
221 | serge | 1630 | ret |
742 | Rus | 1631 | |
164 | serge | 1632 | |
221 | serge | 1633 | ; add ebx, new_app_base |
465 | serge | 1634 | cmp ebx, OS_BASE |
742 | Rus | 1635 | jae msset |
1636 | stdcall load_cursor, ebx, ecx |
||
1637 | mov [esp+36], eax |
||
1638 | ret |
||
1639 | |||
164 | serge | 1640 | |
221 | serge | 1641 | stdcall set_cursor, ebx |
742 | Rus | 1642 | mov [esp+36], eax |
1643 | ret |
||
1644 | |||
1 | ha | 1645 | |
233 | serge | 1646 | stdcall delete_cursor, ebx |
742 | Rus | 1647 | mov [esp+36], eax |
1648 | ret |
||
1649 | |||
1 | ha | 1650 | |
1651 | |||
1652 | |||
1653 | mov dx,word [midisp] |
||
742 | Rus | 1654 | in al,dx |
1655 | and al,0x80 |
||
1656 | pop edx |
||
1657 | ret |
||
1 | ha | 1658 | |
1659 | |||
1660 | |||
1661 | |||
1662 | mov dx,word [midisp] |
||
742 | Rus | 1663 | in al,dx |
1664 | and al,0x40 |
||
1665 | pop edx |
||
1666 | ret |
||
1 | ha | 1667 | |
1668 | |||
1669 | |||
1670 | |||
1671 | |||
1672 | mov dx,word [mididp] |
||
742 | Rus | 1673 | in al,dx |
1674 | pop edx |
||
1675 | ret |
||
1 | ha | 1676 | |
1677 | |||
1678 | |||
1679 | |||
1680 | |||
1681 | mov dx,word [mididp] |
||
742 | Rus | 1682 | out dx,al |
1683 | pop edx |
||
1684 | ret |
||
1 | ha | 1685 | |
1686 | |||
1687 | |||
1688 | |||
1689 | |||
1690 | call is_output |
||
1691 | cmp al,0 |
||
742 | Rus | 1692 | jnz su1 |
1693 | mov dx,word [midisp] |
||
1694 | mov al,0xff |
||
1695 | out dx,al |
||
1696 | su2: |
||
1 | ha | 1697 | mov dx,word [midisp] |
742 | Rus | 1698 | mov al,0xff |
1699 | out dx,al |
||
1700 | call is_input |
||
1 | ha | 1701 | cmp al,0 |
742 | Rus | 1702 | jnz su2 |
1703 | call get_mpu_in |
||
1 | ha | 1704 | cmp al,0xfe |
742 | Rus | 1705 | jnz su2 |
1706 | su3: |
||
1 | ha | 1707 | call is_output |
1708 | cmp al,0 |
||
742 | Rus | 1709 | jnz su3 |
1710 | mov dx,word [midisp] |
||
1711 | mov al,0x3f |
||
1712 | out dx,al |
||
1713 | |||
1 | ha | 1714 | |
1715 | |||
1716 | |||
1717 | |||
1718 | |||
1719 | |||
1720 | |||
1721 | |||
1722 | jnz sm0 |
||
1723 | mov [esp+36],dword 1 |
||
1724 | ret |
||
1725 | sm0: |
||
1726 | |||
1727 | |||
1728 | mov [esp+36],dword 0 |
||
1729 | jnz smn1 |
||
1730 | call setuart |
||
1731 | ret |
||
1732 | smn1: |
||
1733 | |||
1734 | |||
1735 | jnz smn2 |
||
1736 | sm10: |
||
1737 | call get_mpu_in |
||
1738 | call is_output |
||
1739 | test al,al |
||
1740 | jnz sm10 |
||
1741 | mov al,bl |
||
1742 | call put_mpu_out |
||
1743 | ret |
||
1744 | smn2: |
||
1745 | |||
1746 | |||
1747 | |||
1748 | |||
1749 | |||
1750 | |||
379 | serge | 1751 | mov [eax+TASKDATA.state], 3 ; terminate this program |
115 | poddubny | 1752 | |
41 | mikedld | 1753 | |
742 | Rus | 1754 | mov ebx,100 |
684 | diamond | 1755 | call delay_hs |
1 | ha | 1756 | jmp waitterm |
1757 | |||
1758 | |||
75 | diamond | 1759 | align 4 |
170 | serge | 1760 | sys_system_table: |
75 | diamond | 1761 | dd exit_for_anyone ; 1 = obsolete |
759 | Rus | 1762 | dd sysfn_terminate ; 2 = terminate thread |
742 | Rus | 1763 | dd sysfn_activate ; 3 = activate window |
1764 | dd sysfn_getidletime ; 4 = get idle time |
||
1765 | dd sysfn_getcpuclock ; 5 = get cpu clock |
||
1766 | dd sysfn_saveramdisk ; 6 = save ramdisk |
||
1767 | dd sysfn_getactive ; 7 = get active window |
||
1768 | dd sysfn_sound_flag ; 8 = get/set sound_flag |
||
1769 | dd sysfn_shutdown ; 9 = shutdown with parameter |
||
748 | heavyiron | 1770 | dd sysfn_minimize ; 10 = minimize window |
742 | Rus | 1771 | dd sysfn_getdiskinfo ; 11 = get disk subsystem info |
1772 | dd sysfn_lastkey ; 12 = get last pressed key |
||
1773 | dd sysfn_getversion ; 13 = get kernel version |
||
1774 | dd sysfn_waitretrace ; 14 = wait retrace |
||
1775 | dd sysfn_centermouse ; 15 = center mouse cursor |
||
1776 | dd sysfn_getfreemem ; 16 = get free memory size |
||
1777 | dd sysfn_getallmem ; 17 = get total memory size |
||
1778 | dd sysfn_terminate2 ; 18 = terminate thread using PID |
||
1779 | ; instead of slot |
||
1780 | dd sysfn_mouse_acceleration; 19 = set/get mouse acceleration |
||
1781 | dd sysfn_meminfo ; 20 = get extended memory info |
||
1782 | dd sysfn_pid_to_slot ; 21 = get slot number for pid |
||
1783 | dd sysfn_min_rest_window ; 22 = minimize and restore any window |
||
1784 | sysfn_num = ($ - sys_system_table)/4 |
||
75 | diamond | 1785 | endg |
1786 | |||
1787 | |||
1 | ha | 1788 | dec ebx |
742 | Rus | 1789 | cmp ebx, sysfn_num |
1790 | jae @f |
||
1791 | jmp dword [sys_system_table + ebx*4] |
||
1792 | @@: |
||
75 | diamond | 1793 | ret |
742 | Rus | 1794 | |
1 | ha | 1795 | |
214 | serge | 1796 | |
759 | Rus | 1797 | cmp ecx,1 |
748 | heavyiron | 1798 | jl exit_for_anyone |
1799 | cmp ecx,4 |
||
1800 | jg exit_for_anyone |
||
1801 | mov [BOOT_VAR+0x9030],cl |
||
1802 | |||
1803 | |||
379 | serge | 1804 | mov [sys_shutdown], eax |
928 | serge | 1805 | mov [shutdown_processes],eax |
1 | ha | 1806 | and dword [esp+32], 0 |
684 | diamond | 1807 | exit_for_anyone: |
748 | heavyiron | 1808 | ret |
1 | ha | 1809 | uglobal |
1810 | shutdown_processes: dd 0x0 |
||
1811 | endg |
||
1812 | |||
1813 | |||
742 | Rus | 1814 | cmp ecx,2 |
684 | diamond | 1815 | jb noprocessterminate |
1 | ha | 1816 | mov edx,[TASK_COUNT] |
379 | serge | 1817 | cmp ecx,edx |
684 | diamond | 1818 | ja noprocessterminate |
75 | diamond | 1819 | mov eax,[TASK_COUNT] |
379 | serge | 1820 | shl ecx,5 |
684 | diamond | 1821 | mov edx,[ecx+CURRENT_TASK+TASKDATA.pid] |
1822 | add ecx,CURRENT_TASK+TASKDATA.state |
||
1823 | cmp byte [ecx], 9 |
||
1824 | jz noprocessterminate |
||
75 | diamond | 1825 | |
41 | mikedld | 1826 | |
1 | ha | 1827 | mov [ecx],byte 3 ; clear possible i40's |
742 | Rus | 1828 | ;call MEM_Heap_UnLock |
1 | ha | 1829 | |
1830 | |||
1831 | jne noatsc |
||
1832 | mov [application_table_status],0 |
||
1833 | noatsc: |
||
1834 | noprocessterminate: |
||
75 | diamond | 1835 | ret |
1 | ha | 1836 | |
1837 | |||
85 | halyavin | 1838 | ;lock application_table_status mutex |
1839 | .table_status: |
||
164 | serge | 1840 | cli |
85 | halyavin | 1841 | cmp [application_table_status],0 |
1842 | je .stf |
||
742 | Rus | 1843 | sti |
85 | halyavin | 1844 | call change_task |
1845 | jmp .table_status |
||
1846 | .stf: |
||
1847 | call set_application_table_status |
||
1848 | mov eax,ecx |
||
684 | diamond | 1849 | call pid_to_slot |
85 | halyavin | 1850 | test eax,eax |
1851 | jz .not_found |
||
742 | Rus | 1852 | mov ecx,eax |
684 | diamond | 1853 | pushfd |
848 | serge | 1854 | cli |
85 | halyavin | 1855 | call sysfn_terminate |
1856 | mov [application_table_status],0 |
||
1857 | popfd |
||
848 | serge | 1858 | and dword [esp+32],0 |
684 | diamond | 1859 | ret |
85 | halyavin | 1860 | .not_found: |
1861 | mov [application_table_status],0 |
||
1862 | or dword [esp+32],-1 |
||
742 | Rus | 1863 | ret |
85 | halyavin | 1864 | |
1865 | |||
742 | Rus | 1866 | cmp ecx,2 |
684 | diamond | 1867 | jb .nowindowactivate |
105 | poddubny | 1868 | cmp ecx,[TASK_COUNT] |
684 | diamond | 1869 | ja .nowindowactivate |
105 | poddubny | 1870 | |
1871 | |||
1872 | |||
1873 | |||
684 | diamond | 1874 | cmp esi, [TASK_COUNT] |
379 | serge | 1875 | je .nowindowactivate ; already active |
105 | poddubny | 1876 | |
1877 | |||
684 | diamond | 1878 | shl edi, 5 |
105 | poddubny | 1879 | add edi, window_data |
1880 | movzx esi, word [WIN_STACK + ecx * 2] |
||
684 | diamond | 1881 | lea esi, [WIN_POS + esi * 2] |
380 | serge | 1882 | call waredraw |
105 | poddubny | 1883 | .nowindowactivate: |
1884 | ret |
||
1 | ha | 1885 | |
41 | mikedld | 1886 | |
742 | Rus | 1887 | mov eax,[idleusesec] |
1 | ha | 1888 | mov [esp+32], eax |
684 | diamond | 1889 | ret |
1 | ha | 1890 | |
1891 | |||
742 | Rus | 1892 | mov eax,[CPU_FREQ] |
381 | serge | 1893 | mov [esp+32], eax |
684 | diamond | 1894 | ret |
1 | ha | 1895 | |
1896 | |||
1897 | ;!!!!!!!!!!!!!!!!!!!!!!!! |
||
1898 | include 'blkdev/rdsave.inc' |
||
1899 | ;!!!!!!!!!!!!!!!!!!!!!!!! |
||
1900 | |||
75 | diamond | 1901 | |
742 | Rus | 1902 | mov eax, [TASK_COUNT] |
379 | serge | 1903 | movzx eax, word [WIN_POS + eax*2] |
380 | serge | 1904 | mov [esp+32],eax |
684 | diamond | 1905 | ret |
1 | ha | 1906 | |
75 | diamond | 1907 | |
742 | Rus | 1908 | cmp ecx,1 |
684 | diamond | 1909 | jne nogetsoundflag |
1 | ha | 1910 | movzx eax,byte [sound_flag] ; get sound_flag |
1911 | mov [esp+32],eax |
||
684 | diamond | 1912 | ret |
1 | ha | 1913 | nogetsoundflag: |
1914 | cmp ecx,2 |
||
684 | diamond | 1915 | jnz nosoundflag |
1 | ha | 1916 | xor byte [sound_flag], 1 |
75 | diamond | 1917 | nosoundflag: |
1918 | ret |
||
41 | mikedld | 1919 | |
75 | diamond | 1920 | |
742 | Rus | 1921 | mov [window_minimize],1 |
1 | ha | 1922 | ret |
1923 | |||
75 | diamond | 1924 | |
742 | Rus | 1925 | cmp ecx,1 |
684 | diamond | 1926 | jnz full_table |
1 | ha | 1927 | small_table: |
1928 | call for_all_tables |
||
1929 | mov ecx,10 |
||
75 | diamond | 1930 | cld |
1 | ha | 1931 | rep movsb |
1932 | ret |
||
1933 | for_all_tables: |
||
1934 | mov edi,edx |
||
684 | diamond | 1935 | mov esi,DRIVE_DATA |
381 | serge | 1936 | ret |
1 | ha | 1937 | full_table: |
1938 | cmp ecx,2 |
||
684 | diamond | 1939 | jnz exit_for_anyone |
1 | ha | 1940 | call for_all_tables |
1941 | mov ecx,16384 |
||
75 | diamond | 1942 | cld |
1 | ha | 1943 | rep movsd |
1944 | ret |
||
1945 | |||
75 | diamond | 1946 | |
742 | Rus | 1947 | and dword [esp+32], 0 |
1948 | ret |
||
1949 | |||
75 | diamond | 1950 | |
742 | Rus | 1951 | mov edi,ebx |
684 | diamond | 1952 | mov esi,version_inf |
1 | ha | 1953 | mov ecx,version_end-version_inf |
1954 | rep movsb |
||
1955 | ret |
||
1956 | |||
75 | diamond | 1957 | |
1958 | ;wait retrace functions |
||
41 | mikedld | 1959 | sys_wait_retrace: |
1960 | mov edx,0x3da |
||
1961 | WaitRetrace_loop: |
||
1962 | in al,dx |
||
1963 | test al,1000b |
||
1964 | jz WaitRetrace_loop |
||
1965 | and [esp+32],dword 0 |
||
684 | diamond | 1966 | ret |
1 | ha | 1967 | |
75 | diamond | 1968 | |
742 | Rus | 1969 | call mouse_centered |
1 | ha | 1970 | and [esp+32],dword 0 |
684 | diamond | 1971 | ret |
1 | ha | 1972 | |
75 | diamond | 1973 | |
120 | mario79 | 1974 | cmp ecx,0 ; get mouse speed factor |
684 | diamond | 1975 | jnz .set_mouse_acceleration |
120 | mario79 | 1976 | xor eax,eax |
164 | serge | 1977 | mov ax,[mouse_speed_factor] |
120 | mario79 | 1978 | mov [esp+32],eax |
684 | diamond | 1979 | ret |
120 | mario79 | 1980 | .set_mouse_acceleration: |
1981 | cmp ecx,1 ; set mouse speed factor |
||
684 | diamond | 1982 | jnz .get_mouse_delay |
120 | mario79 | 1983 | mov [mouse_speed_factor],dx |
684 | diamond | 1984 | ret |
120 | mario79 | 1985 | .get_mouse_delay: |
1986 | cmp ecx,2 ; get mouse delay |
||
684 | diamond | 1987 | jnz .set_mouse_delay |
120 | mario79 | 1988 | mov eax,[mouse_delay] |
1989 | mov [esp+32],eax |
||
684 | diamond | 1990 | ret |
120 | mario79 | 1991 | .set_mouse_delay: |
1992 | cmp ecx,3 ; set mouse delay |
||
684 | diamond | 1993 | jnz .set_pointer_position |
120 | mario79 | 1994 | mov [mouse_delay],edx |
684 | diamond | 1995 | ret |
120 | mario79 | 1996 | .set_pointer_position: |
1997 | cmp ecx,4 ; set mouse pointer position |
||
684 | diamond | 1998 | jnz .set_mouse_button |
621 | mario79 | 1999 | mov [MOUSE_Y],dx ;y |
684 | diamond | 2000 | ror edx,16 |
2001 | mov [MOUSE_X],dx ;x |
||
2002 | rol edx,16 |
||
2003 | ret |
||
621 | mario79 | 2004 | .set_mouse_button: |
2005 | cmp ecx,5 ; set mouse button features |
||
684 | diamond | 2006 | jnz .end |
621 | mario79 | 2007 | mov byte [btn_down],dl |
928 | serge | 2008 | mov [mouse_active],1 |
621 | mario79 | 2009 | .end: |
120 | mario79 | 2010 | ret |
2011 | |||
2012 | |||
75 | diamond | 2013 | call _get_free_mem |
859 | serge | 2014 | shl eax, 2 |
170 | serge | 2015 | mov [esp+32],eax |
684 | diamond | 2016 | ret |
1 | ha | 2017 | |
75 | diamond | 2018 | |
2019 | mov eax,[_mem_amount] |
||
846 | serge | 2020 | shr eax, 10 |
170 | serge | 2021 | mov [esp+32],eax |
684 | diamond | 2022 | ret |
32 | halyavin | 2023 | |
2024 | |||
608 | alver | 2025 | sysfn_pid_to_slot: |
2026 | mov eax, ecx |
||
684 | diamond | 2027 | call pid_to_slot |
608 | alver | 2028 | mov [esp+32], eax |
684 | diamond | 2029 | ret |
608 | alver | 2030 | |
2031 | |||
2032 | pushad |
||
2033 | mov eax, edx ; ebx - operating |
||
742 | Rus | 2034 | shr ecx, 1 |
684 | diamond | 2035 | jnc @f |
608 | alver | 2036 | call pid_to_slot |
2037 | @@: |
||
2038 | or eax, eax ; eax - number of slot |
||
742 | Rus | 2039 | jz .error |
608 | alver | 2040 | cmp eax, 255 ; varify maximal slot number |
742 | Rus | 2041 | ja .error |
608 | alver | 2042 | movzx eax, word [WIN_STACK + eax*2] |
684 | diamond | 2043 | shr ecx, 1 |
2044 | jc .restore |
||
608 | alver | 2045 | ; .minimize: |
2046 | call minimize_window |
||
2047 | jmp .exit |
||
2048 | .restore: |
||
2049 | call restore_minimized_window |
||
2050 | .exit: |
||
2051 | popad |
||
2052 | xor eax, eax |
||
2053 | mov [esp+32], eax |
||
684 | diamond | 2054 | ret |
608 | alver | 2055 | .error: |
2056 | popad |
||
2057 | xor eax, eax |
||
2058 | dec eax |
||
2059 | mov [esp+32], eax |
||
684 | diamond | 2060 | ret |
608 | alver | 2061 | ; } \\ Alver, 2007-22-08 \\ |
2062 | |||
2063 | |||
41 | mikedld | 2064 | ;// mike.dld, 2006-29-01 [ |
2065 | screen_workarea RECT |
||
2066 | ;// mike.dld, 2006-29-01 ] |
||
2067 | window_minimize db 0 |
||
1 | ha | 2068 | sound_flag db 0 |
742 | Rus | 2069 | endg |
41 | mikedld | 2070 | |
1 | ha | 2071 | |
41 | mikedld | 2072 | version_inf: |
2073 | db 0,7,1,0 ; version 0.7.1.0 |
||
641 | diamond | 2074 | db UID_KOLIBRI |
41 | mikedld | 2075 | dd __REV__ |
540 | victor | 2076 | version_end: |
41 | mikedld | 2077 | endg |
2078 | |||
1 | ha | 2079 | |
41 | mikedld | 2080 | UID_MENUETOS=1 ;official |
742 | Rus | 2081 | UID_KOLIBRI=2 ;russian |
2082 | |||
1 | ha | 2083 | |
2084 | cmp ebx, 1 |
||
671 | Ghost | 2085 | jne .no_floppy_a_save |
2086 | mov [flp_number], 1 |
||
2087 | jmp .save_image_on_floppy |
||
2088 | .no_floppy_a_save: |
||
2089 | cmp ebx, 2 |
||
2090 | jne .no_floppy_b_save |
||
2091 | mov [flp_number], 2 |
||
2092 | .save_image_on_floppy: |
||
2093 | call save_image |
||
2094 | mov [esp + 32], dword 0 |
||
2095 | cmp [FDC_Status], 0 |
||
2096 | je .yes_floppy_save |
||
2097 | .no_floppy_b_save: |
||
2098 | mov [esp + 32], dword 1 |
||
2099 | .yes_floppy_save: |
||
2100 | ret |
||
2101 | |||
1 | ha | 2102 | |
2103 | ; bgrchanged dd 0x0 |
||
2104 | bgrlock db 0 |
||
546 | diamond | 2105 | bgrlockpid dd 0 |
2106 | endg |
||
1 | ha | 2107 | |
2108 | |||
2109 | |||
2110 | |||
742 | Rus | 2111 | jnz nosb1 |
1 | ha | 2112 | cmp ecx,0 |
2113 | je sbgrr |
||
742 | Rus | 2114 | cmp edx,0 |
684 | diamond | 2115 | je sbgrr |
742 | Rus | 2116 | @@: |
546 | diamond | 2117 | mov al, 1 |
742 | Rus | 2118 | xchg [bgrlock], al |
2119 | test al, al |
||
2120 | jz @f |
||
2121 | call change_task |
||
2122 | jmp @b |
||
2123 | @@: |
||
546 | diamond | 2124 | mov [BgrDataWidth],ecx |
684 | diamond | 2125 | mov [BgrDataHeight],edx |
2126 | ; mov [bgrchanged],1 |
||
1 | ha | 2127 | |
469 | serge | 2128 | |
2129 | ; return memory for old background |
||
2130 | |||
887 | serge | 2131 | |
2132 | call @mem_free@4 |
||
2133 | |||
2134 | |||
469 | serge | 2135 | xor eax,eax |
2136 | inc eax |
||
2137 | cmp [BgrDataWidth],eax |
||
527 | diamond | 2138 | jae @f |
469 | serge | 2139 | mov [BgrDataWidth],eax |
527 | diamond | 2140 | @@: |
469 | serge | 2141 | cmp [BgrDataHeight],eax |
527 | diamond | 2142 | jae @f |
469 | serge | 2143 | mov [BgrDataHeight],eax |
527 | diamond | 2144 | @@: |
469 | serge | 2145 | mov eax,[BgrDataWidth] |
527 | diamond | 2146 | imul eax,[BgrDataHeight] |
2147 | lea ecx,[eax*3] |
||
864 | serge | 2148 | mov [mem_BACKGROUND],ecx |
2149 | ; get memory for new background |
||
469 | serge | 2150 | mov edx, PG_SW |
864 | serge | 2151 | stdcall @mem_alloc@8 |
2152 | test eax, eax |
||
469 | serge | 2153 | jz .exit_mem |
2154 | mov [img_background], eax |
||
2155 | .exit_mem: |
||
2156 | popad |
||
2157 | mov [bgrlock], 0 |
||
742 | Rus | 2158 | |
469 | serge | 2159 | |
1 | ha | 2160 | ret |
2161 | |||
469 | serge | 2162 | |
861 | serge | 2163 | |
1 | ha | 2164 | |
742 | Rus | 2165 | jnz nosb2 |
1 | ha | 2166 | |
862 | serge | 2167 | |
861 | serge | 2168 | add ebx, 4095 |
2169 | and ebx, -4096 |
||
2170 | sub ebx, 4 |
||
2171 | cmp ecx, ebx |
||
2172 | ja @F |
||
2173 | |||
2174 | |||
469 | serge | 2175 | mov ebx,[eax+ecx] |
684 | diamond | 2176 | and ebx,0xFF000000 ;255*256*256*256 |
2177 | and edx,0x00FFFFFF ;255*256*256+255*256+255 |
||
2178 | add edx,ebx |
||
2179 | mov [eax+ecx],edx |
||
2180 | @@: |
||
861 | serge | 2181 | ret |
1 | ha | 2182 | |
2183 | |||
861 | serge | 2184 | |
2185 | |||
742 | Rus | 2186 | jnz nosb3 |
1 | ha | 2187 | draw_background_temp: |
2188 | ; cmp [bgrchanged],1 ;0 |
||
2189 | ; je nosb31 |
||
2190 | ;draw_background_temp: |
||
2191 | ; mov [bgrchanged],1 ;0 |
||
2192 | mov [background_defined], 1 |
||
76 | mario79 | 2193 | call force_redraw_background |
709 | diamond | 2194 | mov [redraw_background], 2 |
928 | serge | 2195 | nosb31: |
1 | ha | 2196 | ret |
2197 | nosb3: |
||
2198 | |||
2199 | |||
742 | Rus | 2200 | jnz nosb4 |
1 | ha | 2201 | cmp ecx,[BgrDrawMode] |
684 | diamond | 2202 | je nosb41 |
742 | Rus | 2203 | mov [BgrDrawMode],ecx |
684 | diamond | 2204 | ; mov [bgrchanged],1 |
1 | ha | 2205 | nosb41: |
2206 | ret |
||
2207 | nosb4: |
||
2208 | |||
2209 | |||
742 | Rus | 2210 | jnz nosb5 |
1 | ha | 2211 | ; bughere |
2212 | mov eax, ecx |
||
684 | diamond | 2213 | mov ebx, edx |
2214 | add ebx, [img_background] ;IMG_BACKGROUND |
||
469 | serge | 2215 | mov ecx, esi |
684 | diamond | 2216 | call memmove |
1 | ha | 2217 | .fin: |
2218 | ret |
||
2219 | nosb5: |
||
2220 | |||
479 | kastigar | 2221 | |
742 | Rus | 2222 | jnz nosb6 |
2223 | @@: |
||
546 | diamond | 2224 | mov al, 1 |
742 | Rus | 2225 | xchg [bgrlock], al |
2226 | test al, al |
||
2227 | jz @f |
||
2228 | call change_task |
||
2229 | jmp @b |
||
2230 | @@: |
||
546 | diamond | 2231 | mov eax, [CURRENT_TASK] |
742 | Rus | 2232 | mov [bgrlockpid], eax |
2233 | stdcall user_alloc, [mem_BACKGROUND] |
||
2234 | mov [esp+32], eax |
||
2235 | test eax, eax |
||
2236 | jz .nomem |
||
2237 | mov ebx, eax |
||
2238 | shr ebx, 12 |
||
2239 | or dword [page_tabs+(ebx-1)*4], DONT_FREE_BLOCK |
||
2240 | mov esi, [img_background] |
||
2241 | shr esi, 12 |
||
2242 | mov ecx, [mem_BACKGROUND] |
||
2243 | add ecx, 0xFFF |
||
2244 | shr ecx, 12 |
||
2245 | .z: |
||
546 | diamond | 2246 | mov eax, [page_tabs+esi*4] |
742 | Rus | 2247 | or al, PG_UW |
2248 | mov [page_tabs+ebx*4], eax |
||
2249 | mov eax, ebx |
||
2250 | shl eax, 12 |
||
2251 | invlpg [eax] |
||
2252 | inc ebx |
||
2253 | inc esi |
||
2254 | loop .z |
||
2255 | ret |
||
2256 | .nomem: |
||
546 | diamond | 2257 | and [bgrlockpid], 0 |
742 | Rus | 2258 | mov [bgrlock], 0 |
2259 | nosb6: |
||
546 | diamond | 2260 | cmp ebx, 7 |
742 | Rus | 2261 | jnz nosb7 |
2262 | cmp [bgrlock], 0 |
||
2263 | jz .err |
||
2264 | mov eax, [CURRENT_TASK] |
||
2265 | cmp [bgrlockpid], eax |
||
2266 | jnz .err |
||
2267 | mov eax, ecx |
||
2268 | mov ebx, ecx |
||
2269 | shr eax, 12 |
||
2270 | mov ecx, [page_tabs+(eax-1)*4] |
||
2271 | test cl, USED_BLOCK+DONT_FREE_BLOCK |
||
2272 | jz .err |
||
2273 | jnp .err |
||
2274 | push eax |
||
2275 | shr ecx, 12 |
||
2276 | @@: |
||
546 | diamond | 2277 | and dword [page_tabs+eax*4], 0 |
742 | Rus | 2278 | mov edx, eax |
2279 | shl edx, 12 |
||
2280 | push eax |
||
802 | serge | 2281 | invlpg [edx] |
742 | Rus | 2282 | pop eax |
802 | serge | 2283 | inc eax |
742 | Rus | 2284 | loop @b |
2285 | pop eax |
||
2286 | and dword [page_tabs+(eax-1)*4], not DONT_FREE_BLOCK |
||
2287 | stdcall user_free, ebx |
||
2288 | mov [esp+32], eax |
||
2289 | and [bgrlockpid], 0 |
||
2290 | mov [bgrlock], 0 |
||
2291 | ret |
||
2292 | .err: |
||
546 | diamond | 2293 | and dword [esp+32], 0 |
742 | Rus | 2294 | ret |
2295 | |||
546 | diamond | 2296 | |
2297 | ret |
||
1 | ha | 2298 | |
2299 | |||
709 | diamond | 2300 | mov [draw_data+32 + RECT.left],dword 0 |
2301 | mov [draw_data+32 + RECT.top],dword 0 |
||
2302 | push eax ebx |
||
2303 | mov eax,[Screen_Max_X] |
||
753 | serge | 2304 | mov ebx,[Screen_Max_Y] |
2305 | mov [draw_data+32 + RECT.right],eax |
||
709 | diamond | 2306 | mov [draw_data+32 + RECT.bottom],ebx |
2307 | pop ebx eax |
||
2308 | mov [redraw_background], 1 |
||
928 | serge | 2309 | ret |
709 | diamond | 2310 | |
479 | kastigar | 2311 | |
1 | ha | 2312 | |
2313 | |||
2314 | |||
2315 | |||
742 | Rus | 2316 | jnz nogb1 |
1 | ha | 2317 | mov eax,[BgrDataWidth] |
527 | diamond | 2318 | shl eax,16 |
1 | ha | 2319 | mov ax,[BgrDataHeight] |
531 | diamond | 2320 | mov [esp+36],eax |
1 | ha | 2321 | ret |
2322 | |||
2323 | |||
861 | serge | 2324 | |
2325 | |||
742 | Rus | 2326 | jnz nogb2 |
1 | ha | 2327 | |
862 | serge | 2328 | |
861 | serge | 2329 | add ecx, 4095 |
2330 | and ecx, -4096 |
||
2331 | sub ecx, 4 |
||
2332 | cmp ebx, ecx |
||
2333 | ja @F |
||
2334 | |||
2335 | |||
469 | serge | 2336 | mov eax,[ebx+eax] |
2337 | |||
2338 | |||
1 | ha | 2339 | mov [esp+36],eax |
2340 | @@: |
||
861 | serge | 2341 | ret |
1 | ha | 2342 | |
862 | serge | 2343 | |
1 | ha | 2344 | |
2345 | |||
742 | Rus | 2346 | jnz nogb4 |
1 | ha | 2347 | mov eax,[BgrDrawMode] |
527 | diamond | 2348 | nogb4: |
1 | ha | 2349 | mov [esp+36],eax |
2350 | ret |
||
2351 | |||
2352 | |||
2353 | |||
2354 | |||
2355 | |||
2356 | mov [esp + 32],dword 1 |
||
671 | Ghost | 2357 | ; test main buffer |
2358 | mov ebx, [CURRENT_TASK] ; TOP OF WINDOW STACK |
||
742 | Rus | 2359 | movzx ecx, word [WIN_STACK + ebx * 2] |
671 | Ghost | 2360 | mov edx, [TASK_COUNT] |
2361 | cmp ecx, edx |
||
2362 | jne .finish |
||
2363 | cmp [KEY_COUNT], 0 |
||
928 | serge | 2364 | je .finish |
671 | Ghost | 2365 | movzx eax, byte [KEY_BUFF] |
2366 | shl eax, 8 |
||
2367 | push eax |
||
2368 | dec [KEY_COUNT] |
||
928 | serge | 2369 | and [KEY_COUNT], 127 |
2370 | mov ecx, [KEY_COUNT] |
||
2371 | add ecx, 2 |
||
671 | Ghost | 2372 | mov eax, KEY_BUFF + 1 |
2373 | mov ebx, KEY_BUFF |
||
2374 | call memmove |
||
2375 | pop eax |
||
2376 | .ret_eax: |
||
92 | diamond | 2377 | mov [esp + 32], eax |
671 | Ghost | 2378 | ret |
2379 | .finish: |
||
2380 | ; test hotkeys buffer |
||
92 | diamond | 2381 | mov ecx, hotkey_buffer |
671 | Ghost | 2382 | @@: |
92 | diamond | 2383 | cmp [ecx], ebx |
671 | Ghost | 2384 | jz .found |
2385 | add ecx, 8 |
||
2386 | cmp ecx, hotkey_buffer + 120 * 8 |
||
2387 | jb @b |
||
2388 | ret |
||
2389 | .found: |
||
92 | diamond | 2390 | mov ax, [ecx + 6] |
671 | Ghost | 2391 | shl eax, 16 |
2392 | mov ah, [ecx + 4] |
||
2393 | mov al, 2 |
||
2394 | and dword [ecx + 4], 0 |
||
2395 | and dword [ecx], 0 |
||
2396 | jmp .ret_eax |
||
2397 | |||
1 | ha | 2398 | |
2399 | |||
2400 | |||
2401 | |||
2402 | |||
742 | Rus | 2403 | mov [esp + 32], dword 1 |
671 | Ghost | 2404 | movzx ecx, word [WIN_STACK + ebx * 2] |
2405 | mov edx, [TASK_COUNT] ; less than 256 processes |
||
2406 | cmp ecx, edx |
||
2407 | jne .exit |
||
2408 | mov eax, [BTN_COUNT] |
||
928 | serge | 2409 | test eax, eax |
2410 | jz .exit |
||
671 | Ghost | 2411 | mov eax, [BTN_BUFF] |
2412 | shl eax, 8 |
||
2413 | ; // Alver 22.06.2008 // { |
||
803 | alver | 2414 | mov al, byte [btn_down_determ] |
2415 | and al,0xFE ; delete left button bit |
||
928 | serge | 2416 | ; } \\ Alver \\ |
803 | alver | 2417 | mov [BTN_COUNT], 0 |
928 | serge | 2418 | mov [esp + 32], eax |
671 | Ghost | 2419 | .exit: |
2420 | ret |
||
2421 | |||
1 | ha | 2422 | |
2423 | |||
2424 | |||
2425 | |||
2426 | |||
2427 | |||
2428 | ; |
||
2429 | ; +00 dword process cpu usage |
||
2430 | ; +04 word position in windowing stack |
||
2431 | ; +06 word windowing stack value at current position (cpu nro) |
||
2432 | ; +10 12 bytes name |
||
2433 | ; +22 dword start in mem |
||
2434 | ; +26 dword used mem |
||
2435 | ; +30 dword PID , process idenfification number |
||
2436 | ; |
||
2437 | |||
2438 | |||
742 | Rus | 2439 | jne .no_who_am_i |
684 | diamond | 2440 | mov ecx,[CURRENT_TASK] |
2441 | .no_who_am_i: |
||
2442 | cmp ecx, max_processes |
||
742 | Rus | 2443 | ja .nofillbuf |
2444 | |||
1 | ha | 2445 | |
684 | diamond | 2446 | mov ax, [WIN_STACK + ecx * 2] |
742 | Rus | 2447 | mov [ebx+4], ax |
2448 | ; +6: word: number of the thread slot, which window has in the window stack |
||
684 | diamond | 2449 | ; position ecx (has no relation to the specific thread) |
2450 | mov ax, [WIN_POS + ecx * 2] |
||
742 | Rus | 2451 | mov [ebx+6], ax |
2452 | |||
1 | ha | 2453 | |
742 | Rus | 2454 | |
1 | ha | 2455 | |
684 | diamond | 2456 | mov eax, [ecx+CURRENT_TASK+TASKDATA.cpu_usage] |
742 | Rus | 2457 | mov [ebx], eax |
2458 | ; +10: 11 bytes: name of the process |
||
684 | diamond | 2459 | push ecx |
742 | Rus | 2460 | lea eax, [ecx*8+SLOT_BASE+APPDATA.app_name] |
2461 | add ebx, 10 |
||
2462 | mov ecx, 11 |
||
2463 | call memmove |
||
2464 | pop ecx |
||
2465 | |||
1 | ha | 2466 | |
684 | diamond | 2467 | ; +26: size of used memory - 1 |
2468 | push edi |
||
742 | Rus | 2469 | lea edi, [ebx+12] |
2470 | xor eax, eax |
||
2471 | mov edx, 0x100000*16 |
||
2472 | cmp ecx, 1 shl 5 |
||
2473 | je .os_mem |
||
2474 | mov edx, [SLOT_BASE+ecx*8+APPDATA.mem_size] |
||
2475 | xor eax, eax |
||
840 | serge | 2476 | .os_mem: |
684 | diamond | 2477 | stosd |
742 | Rus | 2478 | lea eax, [edx-1] |
2479 | stosd |
||
2480 | |||
1 | ha | 2481 | |
684 | diamond | 2482 | mov eax, [ecx+CURRENT_TASK+TASKDATA.pid] |
742 | Rus | 2483 | stosd |
2484 | |||
1 | ha | 2485 | |
2486 | push esi |
||
742 | Rus | 2487 | lea esi, [ecx + window_data + WDATA.box] |
2488 | movsd |
||
2489 | movsd |
||
2490 | movsd |
||
2491 | movsd |
||
2492 | |||
1 | ha | 2493 | |
2494 | mov eax, dword [ecx+CURRENT_TASK+TASKDATA.state] |
||
742 | Rus | 2495 | stosd |
2496 | |||
1 | ha | 2497 | |
138 | mikedld | 2498 | lea esi, [ecx*8 + SLOT_BASE + APPDATA.wnd_clientbox] |
742 | Rus | 2499 | movsd |
2500 | movsd |
||
2501 | movsd |
||
2502 | movsd |
||
2503 | |||
1 | ha | 2504 | |
164 | serge | 2505 | mov al, [ecx+window_data+WDATA.fl_wstate] |
742 | Rus | 2506 | stosb |
2507 | |||
164 | serge | 2508 | |
742 | Rus | 2509 | pop edi |
2510 | |||
138 | mikedld | 2511 | |
684 | diamond | 2512 | ; return number of processes |
1 | ha | 2513 | |
2514 | |||
379 | serge | 2515 | mov [esp+32],eax |
684 | diamond | 2516 | ret |
1 | ha | 2517 | |
2518 | |||
2519 | sys_clock: |
||
2520 | cli |
||
742 | Rus | 2521 | ; Mikhail Lisovin xx Jan 2005 |
1 | ha | 2522 | @@: mov al, 10 |
742 | Rus | 2523 | out 0x70, al |
2524 | in al, 0x71 |
||
2525 | test al, al |
||
2526 | jns @f |
||
2527 | mov esi, 1 |
||
2528 | call delay_ms |
||
2529 | jmp @b |
||
2530 | @@: |
||
1 | ha | 2531 | ; end Lisovin's fix |
2532 | |||
2533 | |||
742 | Rus | 2534 | out 0x70,al |
2535 | in al,0x71 |
||
2536 | movzx ecx,al |
||
2537 | mov al,02 ; minutes |
||
2538 | shl ecx,16 |
||
2539 | out 0x70,al |
||
2540 | in al,0x71 |
||
2541 | movzx edx,al |
||
2542 | mov al,04 ; hours |
||
2543 | shl edx,8 |
||
2544 | out 0x70,al |
||
2545 | in al,0x71 |
||
2546 | add ecx,edx |
||
2547 | movzx edx,al |
||
2548 | add ecx,edx |
||
2549 | sti |
||
2550 | mov [esp + 32], ecx |
||
671 | Ghost | 2551 | ret |
742 | Rus | 2552 | |
1 | ha | 2553 | |
2554 | |||
2555 | |||
2556 | |||
2557 | |||
2558 | |||
742 | Rus | 2559 | @@: mov al, 10 |
2560 | out 0x70, al |
||
2561 | in al, 0x71 |
||
2562 | test al, al |
||
2563 | jns @f |
||
2564 | mov esi, 1 |
||
2565 | call delay_ms |
||
2566 | jmp @b |
||
2567 | @@: |
||
75 | diamond | 2568 | |
2569 | |||
742 | Rus | 2570 | mov al,7 ; date |
2571 | out 0x70,al |
||
2572 | in al,0x71 |
||
2573 | mov cl,al |
||
2574 | mov al,8 ; month |
||
2575 | shl ecx,16 |
||
2576 | out 0x70,al |
||
2577 | in al,0x71 |
||
2578 | mov ch,al |
||
2579 | mov al,9 ; year |
||
2580 | out 0x70,al |
||
2581 | in al,0x71 |
||
2582 | mov cl,al |
||
2583 | sti |
||
2584 | mov [esp+32], ecx |
||
2585 | ret |
||
2586 | |||
1 | ha | 2587 | |
2588 | |||
2589 | |||
2590 | |||
2591 | cmp ebx, 1 |
||
671 | Ghost | 2592 | jne no_widgets_away |
2593 | ; buttons away |
||
2594 | mov ecx,[CURRENT_TASK] |
||
2595 | sys_newba2: |
||
1 | ha | 2596 | mov edi,[btn_addr] |
928 | serge | 2597 | cmp [edi], dword 0 ; empty button list ? |
742 | Rus | 2598 | je end_of_buttons_away |
671 | Ghost | 2599 | movzx ebx, word [edi] |
2600 | inc ebx |
||
2601 | mov eax,edi |
||
2602 | sys_newba: |
||
1 | ha | 2603 | dec ebx |
671 | Ghost | 2604 | jz end_of_buttons_away |
2605 | |||
1 | ha | 2606 | |
671 | Ghost | 2607 | cmp cx, [eax] |
2608 | jnz sys_newba |
||
2609 | |||
1 | ha | 2610 | |
671 | Ghost | 2611 | mov ecx,ebx |
2612 | inc ecx |
||
2613 | shl ecx, 4 |
||
2614 | mov ebx, eax |
||
2615 | add eax, 0x10 |
||
2616 | call memmove |
||
2617 | dec dword [edi] |
||
2618 | pop ecx ebx eax |
||
2619 | |||
1 | ha | 2620 | |
671 | Ghost | 2621 | |
1 | ha | 2622 | |
2623 | |||
2624 | |||
671 | Ghost | 2625 | |
1 | ha | 2626 | |
2627 | |||
2628 | |||
671 | Ghost | 2629 | jnz srl1 |
2630 | |||
1 | ha | 2631 | |
671 | Ghost | 2632 | add edx, draw_data - CURRENT_TASK |
2633 | mov [edx + RECT.left], 0 |
||
2634 | mov [edx + RECT.top], 0 |
||
2635 | mov eax, [Screen_Max_X] |
||
759 | Rus | 2636 | mov [edx + RECT.right], eax |
671 | Ghost | 2637 | mov eax, [Screen_Max_Y] |
759 | Rus | 2638 | mov [edx + RECT.bottom], eax |
671 | Ghost | 2639 | |
1 | ha | 2640 | |
671 | Ghost | 2641 | or [edi - twdw + WDATA.fl_wdrawn], 1 ; no new position & buttons from app |
2642 | call sys_window_mouse |
||
2643 | ret |
||
2644 | |||
1 | ha | 2645 | |
2646 | ret |
||
671 | Ghost | 2647 | |
1 | ha | 2648 | |
2649 | |||
2650 | |||
2651 | |||
684 | diamond | 2652 | shr eax,16+8 |
2653 | and eax,15 |
||
2654 | |||
1 | ha | 2655 | |
684 | diamond | 2656 | jne nosyswI |
1 | ha | 2657 | inc [mouse_pause] |
33 | mario79 | 2658 | call [disable_mouse] |
36 | mario79 | 2659 | call sys_set_window |
1 | ha | 2660 | call [disable_mouse] |
36 | mario79 | 2661 | call drawwindow_I |
1 | ha | 2662 | ;dec [mouse_pause] |
114 | mikedld | 2663 | ;call [draw_pointer] |
2664 | ;ret |
||
2665 | jmp draw_window_caption.2 |
||
2666 | nosyswI: |
||
1 | ha | 2667 | |
2668 | |||
742 | Rus | 2669 | jne nosyswII |
1 | ha | 2670 | inc [mouse_pause] |
33 | mario79 | 2671 | call [disable_mouse] |
36 | mario79 | 2672 | call sys_set_window |
1 | ha | 2673 | call [disable_mouse] |
36 | mario79 | 2674 | call sys_window_mouse |
1 | ha | 2675 | dec [mouse_pause] |
33 | mario79 | 2676 | call [draw_pointer] |
36 | mario79 | 2677 | ret |
1 | ha | 2678 | nosyswII: |
2679 | |||
2680 | |||
742 | Rus | 2681 | jne nosyswIII |
1 | ha | 2682 | inc [mouse_pause] |
33 | mario79 | 2683 | call [disable_mouse] |
36 | mario79 | 2684 | call sys_set_window |
1 | ha | 2685 | call [disable_mouse] |
36 | mario79 | 2686 | call drawwindow_III |
1 | ha | 2687 | ;dec [mouse_pause] |
114 | mikedld | 2688 | ;call [draw_pointer] |
2689 | ;ret |
||
2690 | jmp draw_window_caption.2 |
||
2691 | nosyswIII: |
||
1 | ha | 2692 | |
2693 | |||
742 | Rus | 2694 | je draw_skin_window |
2695 | cmp al,4 ; type V - skinned window not sized! {not_sized_skin_window} |
||
2696 | jne nosyswV |
||
549 | spraid | 2697 | draw_skin_window: |
2698 | |||
567 | serge | 2699 | |
569 | diamond | 2700 | call [disable_mouse] |
2701 | call sys_set_window |
||
2702 | call [disable_mouse] |
||
2703 | mov eax, [TASK_COUNT] |
||
684 | diamond | 2704 | movzx eax, word [WIN_POS + eax*2] |
2705 | cmp eax, [CURRENT_TASK] |
||
2706 | setz al |
||
2707 | movzx eax, al |
||
2708 | push eax |
||
2709 | call drawwindow_IV |
||
36 | mario79 | 2710 | ;dec [mouse_pause] |
114 | mikedld | 2711 | ;call [draw_pointer] |
2712 | ;ret |
||
2713 | jmp draw_window_caption.2 |
||
2714 | nosyswV: |
||
549 | spraid | 2715 | |
1 | ha | 2716 | |
2717 | |||
2718 | |||
2719 | |||
114 | mikedld | 2720 | inc [mouse_pause] |
742 | Rus | 2721 | call [disable_mouse] |
2722 | |||
114 | mikedld | 2723 | |
742 | Rus | 2724 | mov edx,[TASK_COUNT] |
2725 | movzx edx,word[WIN_POS+edx*2] |
||
2726 | cmp edx,[CURRENT_TASK] |
||
2727 | jne @f |
||
2728 | inc eax |
||
2729 | @@: mov edx,[CURRENT_TASK] |
||
2730 | shl edx,5 |
||
2731 | add edx,window_data |
||
2732 | movzx ebx,[edx+WDATA.fl_wstyle] |
||
2733 | and bl,0x0F |
||
2734 | cmp bl,3 |
||
2735 | je .draw_caption_style_3 ;{for 3 and 4 style write caption} |
||
2736 | cmp bl,4 |
||
2737 | je .draw_caption_style_3 |
||
2738 | |||
567 | serge | 2739 | |
742 | Rus | 2740 | .draw_caption_style_3: |
549 | spraid | 2741 | |
114 | mikedld | 2742 | |
742 | Rus | 2743 | call drawwindow_IV_caption |
2744 | add esp,4 |
||
2745 | jmp .2 |
||
2746 | |||
114 | mikedld | 2747 | |
2748 | cmp bl,2 |
||
742 | Rus | 2749 | jne .not_style_2 |
2750 | |||
114 | mikedld | 2751 | |
742 | Rus | 2752 | jmp .2 |
2753 | |||
114 | mikedld | 2754 | |
2755 | cmp bl,0 |
||
742 | Rus | 2756 | jne .2 |
2757 | |||
114 | mikedld | 2758 | |
742 | Rus | 2759 | |
114 | mikedld | 2760 | |
2761 | .2: ;jmp @f |
||
742 | Rus | 2762 | mov edi,[CURRENT_TASK] |
2763 | shl edi,5 |
||
2764 | test [edi+window_data+WDATA.fl_wstyle],WSTYLE_HASCAPTION |
||
2765 | jz @f |
||
2766 | mov edx,[edi*8+SLOT_BASE+APPDATA.wnd_caption] |
||
2767 | or edx,edx |
||
2768 | jz @f |
||
2769 | |||
114 | mikedld | 2770 | |
742 | Rus | 2771 | and al,0x0F |
2772 | cmp al,3 |
||
2773 | je .skinned |
||
2774 | cmp al,4 |
||
2775 | je .skinned |
||
2776 | |||
567 | serge | 2777 | |
742 | Rus | 2778 | .skinned: |
567 | serge | 2779 | mov ebp,[edi+window_data+WDATA.box.left-2] |
742 | Rus | 2780 | mov bp,word[edi+window_data+WDATA.box.top] |
2781 | movzx eax,word[edi+window_data+WDATA.box.width] |
||
2782 | sub ax,[_skinmargins.left] |
||
2783 | sub ax,[_skinmargins.right] |
||
2784 | push edx |
||
2785 | cwde |
||
2786 | cdq |
||
2787 | mov ebx,6 |
||
2788 | idiv ebx |
||
2789 | pop edx |
||
2790 | or eax,eax |
||
2791 | js @f |
||
2792 | mov esi,eax |
||
2793 | mov ebx,dword[_skinmargins.left-2] |
||
2794 | mov bx,word[_skinh] |
||
2795 | sub bx,[_skinmargins.bottom] |
||
2796 | sub bx,[_skinmargins.top] |
||
2797 | sar bx,1 |
||
2798 | adc bx,0 |
||
2799 | add bx,[_skinmargins.top] |
||
2800 | add bx,-3 |
||
2801 | add ebx,ebp |
||
2802 | jmp .dodraw |
||
2803 | |||
114 | mikedld | 2804 | |
2805 | cmp al,1 |
||
742 | Rus | 2806 | je @f |
2807 | |||
114 | mikedld | 2808 | |
742 | Rus | 2809 | mov bp,word[edi+window_data+WDATA.box.top] |
2810 | movzx eax,word[edi+window_data+WDATA.box.width] |
||
2811 | sub eax,16 |
||
2812 | push edx |
||
2813 | cwde |
||
2814 | cdq |
||
2815 | mov ebx,6 |
||
2816 | idiv ebx |
||
2817 | pop edx |
||
2818 | or eax,eax |
||
2819 | js @f |
||
2820 | mov esi,eax |
||
2821 | mov ebx,0x00080007 |
||
2822 | add ebx,ebp |
||
2823 | .dodraw: |
||
139 | diamond | 2824 | mov ecx,[common_colours+16];0x00FFFFFF |
742 | Rus | 2825 | or ecx, 0x80000000 |
2826 | xor edi,edi |
||
2827 | ; // Alver 22.06.2008 // { |
||
803 | alver | 2828 | ; call dtext |
2829 | call dtext_asciiz_esi |
||
2830 | ; } \\ Alver \\ |
||
2831 | |||
114 | mikedld | 2832 | |
2833 | ;-------------------------------------------------------------- |
||
2834 | dec [mouse_pause] |
||
742 | Rus | 2835 | call [draw_pointer] |
2836 | ret |
||
2837 | |||
114 | mikedld | 2838 | |
2839 | align 4 |
||
2840 | window_topleft dd \ |
||
2841 | 1, 21,\ ;type 0 |
||
549 | spraid | 2842 | 0, 0,\ ;type 1 |
742 | Rus | 2843 | 5, 20,\ ;type 2 |
2844 | 5, ?,\ ;type 3 {set by skin} |
||
2845 | 5, ? ;type 4 {set by skin} |
||
2846 | endg |
||
114 | mikedld | 2847 | |
2848 | |||
2849 | push eax ecx edi |
||
742 | Rus | 2850 | |
114 | mikedld | 2851 | |
742 | Rus | 2852 | mov [window_topleft+4*7],eax |
2853 | mov [window_topleft+4*9],eax |
||
2854 | |||
114 | mikedld | 2855 | |
742 | Rus | 2856 | sub edi,window_data |
2857 | shl edi,3 |
||
2858 | test [ecx+WDATA.fl_wstyle],WSTYLE_CLIENTRELATIVE |
||
2859 | jz @f |
||
2860 | |||
114 | mikedld | 2861 | |
742 | Rus | 2862 | and eax,0x0F |
2863 | mov eax,[eax*8+window_topleft+0] |
||
2864 | mov [edi+SLOT_BASE+APPDATA.wnd_clientbox.left],eax |
||
2865 | shl eax,1 |
||
2866 | neg eax |
||
2867 | add eax,[ecx+WDATA.box.width] |
||
2868 | mov [edi+SLOT_BASE+APPDATA.wnd_clientbox.width],eax |
||
2869 | |||
114 | mikedld | 2870 | |
742 | Rus | 2871 | and eax,0x0F |
2872 | push [eax*8+window_topleft+0] |
||
2873 | mov eax,[eax*8+window_topleft+4] |
||
2874 | mov [edi+SLOT_BASE+APPDATA.wnd_clientbox.top],eax |
||
2875 | neg eax |
||
2876 | sub eax,[esp] |
||
2877 | add eax,[ecx+WDATA.box.height] |
||
2878 | mov [edi+SLOT_BASE+APPDATA.wnd_clientbox.height],eax |
||
2879 | add esp,4 |
||
2880 | |||
114 | mikedld | 2881 | |
742 | Rus | 2882 | ret |
2883 | @@: |
||
114 | mikedld | 2884 | xor eax,eax |
742 | Rus | 2885 | mov [edi+SLOT_BASE+APPDATA.wnd_clientbox.left],eax |
2886 | mov [edi+SLOT_BASE+APPDATA.wnd_clientbox.top],eax |
||
2887 | mov eax,[ecx+WDATA.box.width] |
||
2888 | mov [edi+SLOT_BASE+APPDATA.wnd_clientbox.width],eax |
||
2889 | mov eax,[ecx+WDATA.box.height] |
||
2890 | mov [edi+SLOT_BASE+APPDATA.wnd_clientbox.height],eax |
||
2891 | |||
114 | mikedld | 2892 | |
742 | Rus | 2893 | ret |
2894 | |||
114 | mikedld | 2895 | |
1 | ha | 2896 | |
2897 | |||
684 | diamond | 2898 | shl eax,5 |
2899 | add eax,window_data |
||
2900 | |||
1 | ha | 2901 | |
2902 | mov [eax+WDATA.cl_workarea],edx |
||
684 | diamond | 2903 | mov [eax+WDATA.cl_titlebar],esi |
2904 | mov [eax+WDATA.cl_frames],edi |
||
2905 | |||
1 | ha | 2906 | |
684 | diamond | 2907 | |
2908 | |||
1 | ha | 2909 | test [edi+WDATA.fl_wdrawn],1 |
186 | diamond | 2910 | jnz newd |
2911 | |||
1 | ha | 2912 | |
2913 | add eax,100 |
||
2914 | mov [new_window_starting],eax |
||
2915 | |||
2916 | |||
860 | serge | 2917 | mov [edi+WDATA.box.width],eax |
2918 | movsx eax,cx |
||
2919 | mov [edi+WDATA.box.height],eax |
||
2920 | sar ebx,16 |
||
114 | mikedld | 2921 | sar ecx,16 |
684 | diamond | 2922 | mov [edi+WDATA.box.left],ebx |
860 | serge | 2923 | mov [edi+WDATA.box.top],ecx |
2924 | |||
1 | ha | 2925 | |
2926 | |||
2927 | |||
164 | serge | 2928 | |
1 | ha | 2929 | |
742 | Rus | 2930 | ;mov esi,edi |
114 | mikedld | 2931 | |
2932 | |||
742 | Rus | 2933 | mov eax, [edi+WDATA.cl_frames] |
2934 | |||
114 | mikedld | 2935 | |
1 | ha | 2936 | shl edi,3 |
114 | mikedld | 2937 | add edi,SLOT_BASE |
380 | serge | 2938 | |
114 | mikedld | 2939 | |
742 | Rus | 2940 | mov [edi+APPDATA.wnd_caption],0 |
2941 | cmp cl,3 |
||
2942 | je set_APPDATA_wnd_caption |
||
2943 | cmp cl,4 ; {SPraid.simba} |
||
2944 | je set_APPDATA_wnd_caption |
||
2945 | |||
567 | serge | 2946 | |
742 | Rus | 2947 | set_APPDATA_wnd_caption: |
549 | spraid | 2948 | mov [edi+APPDATA.wnd_caption],eax |
742 | Rus | 2949 | @@: mov esi,[esp+0] |
2950 | |||
114 | mikedld | 2951 | |
115 | poddubny | 2952 | movsd |
742 | Rus | 2953 | movsd |
2954 | movsd |
||
2955 | movsd |
||
2956 | pop edi esi ecx |
||
1 | ha | 2957 | |
2958 | |||
742 | Rus | 2959 | movzx esi, word [WIN_STACK+esi*2] |
2960 | lea esi, [WIN_POS+esi*2] |
||
2961 | call waredraw |
||
2962 | |||
569 | diamond | 2963 | |
684 | diamond | 2964 | ;;; call delay_hs |
1 | ha | 2965 | mov eax, [edi+WDATA.box.left] |
115 | poddubny | 2966 | mov ebx, [edi+WDATA.box.top] |
2967 | mov ecx, [edi+WDATA.box.width] |
||
2968 | mov edx, [edi+WDATA.box.height] |
||
2969 | add ecx, eax |
||
1 | ha | 2970 | add edx, ebx |
2971 | call calculatescreen |
||
2972 | |||
2973 | |||
928 | serge | 2974 | mov [BTN_COUNT], 0 ; empty button buffer |
2975 | |||
1 | ha | 2976 | |
2977 | mov [edi+WDATA.fl_redraw],byte 0 ; no redraw |
||
742 | Rus | 2978 | mov edx,edi |
1 | ha | 2979 | |
2980 | |||
2981 | |||
2982 | |||
114 | mikedld | 2983 | |
1 | ha | 2984 | |
114 | mikedld | 2985 | dec eax ; subfunction #1 - set window caption |
742 | Rus | 2986 | jnz .get_window_caption |
2987 | |||
114 | mikedld | 2988 | |
742 | Rus | 2989 | ; so there's no parameter for PID/TID |
2990 | |||
114 | mikedld | 2991 | |
742 | Rus | 2992 | shl edi,5 |
2993 | |||
114 | mikedld | 2994 | |
742 | Rus | 2995 | ; check is trivial, and if application resizes its memory, |
2996 | ; caption still can become over bounds |
||
2997 | ; diamond, 31.10.2006: check removed because with new memory manager |
||
202 | diamond | 2998 | ; there can be valid data after APPDATA.mem_size bound |
2999 | ; mov ecx,[edi*8+SLOT_BASE+APPDATA.mem_size] |
||
380 | serge | 3000 | ; add ecx,255 ; max caption length |
202 | diamond | 3001 | ; cmp ebx,ecx |
3002 | ; ja .exit_fail |
||
3003 | |||
114 | mikedld | 3004 | |
742 | Rus | 3005 | or [edi+window_data+WDATA.fl_wstyle],WSTYLE_HASCAPTION |
3006 | |||
114 | mikedld | 3007 | |
742 | Rus | 3008 | |
114 | mikedld | 3009 | |
742 | Rus | 3010 | ret |
3011 | |||
114 | mikedld | 3012 | |
3013 | dec eax ; subfunction #2 - get window caption |
||
742 | Rus | 3014 | jnz .exit_fail |
3015 | |||
114 | mikedld | 3016 | |
742 | Rus | 3017 | |
114 | mikedld | 3018 | |
3019 | xor eax,eax |
||
742 | Rus | 3020 | inc eax ; eax = 1 (fail) |
3021 | ret |
||
3022 | |||
114 | mikedld | 3023 | |
3024 | |||
1 | ha | 3025 | |
3026 | |||
742 | Rus | 3027 | shl edi,5 |
3028 | add edi,window_data |
||
3029 | |||
1 | ha | 3030 | |
742 | Rus | 3031 | jnz .window_move_return |
3032 | |||
1 | ha | 3033 | |
742 | Rus | 3034 | push dword [edi + WDATA.box.top] |
3035 | push dword [edi + WDATA.box.width] |
||
3036 | push dword [edi + WDATA.box.height] |
||
3037 | |||
1 | ha | 3038 | |
742 | Rus | 3039 | je .no_x_reposition |
3040 | mov [edi + WDATA.box.left], eax |
||
3041 | .no_x_reposition: |
||
49 | mikedld | 3042 | cmp ebx,-1 |
742 | Rus | 3043 | je .no_y_reposition |
3044 | mov [edi + WDATA.box.top], ebx |
||
3045 | .no_y_reposition: |
||
49 | mikedld | 3046 | |
1 | ha | 3047 | |
742 | Rus | 3048 | jnz .no_y_resizing |
3049 | |||
1 | ha | 3050 | |
742 | Rus | 3051 | je .no_x_resizing |
3052 | mov [edi + WDATA.box.width], ecx |
||
3053 | .no_x_resizing: |
||
49 | mikedld | 3054 | cmp edx,-1 |
742 | Rus | 3055 | je .no_y_resizing |
3056 | mov [edi + WDATA.box.height], edx |
||
3057 | .no_y_resizing: |
||
49 | mikedld | 3058 | |
1 | ha | 3059 | |
742 | Rus | 3060 | call set_window_clientbox |
3061 | |||
1 | ha | 3062 | |
742 | Rus | 3063 | mov esi,edi |
3064 | sub edi,window_data |
||
3065 | shr edi,5 |
||
3066 | shl edi,8 |
||
3067 | add edi, SLOT_BASE + APPDATA.saved_box |
||
3068 | mov ecx,4 |
||
3069 | cld |
||
3070 | rep movsd |
||
3071 | popad |
||
3072 | |||
49 | mikedld | 3073 | |
742 | Rus | 3074 | mov eax, [edi + WDATA.box.left] |
3075 | mov ebx, [edi + WDATA.box.top] |
||
3076 | mov ecx, [edi + WDATA.box.width] |
||
3077 | mov edx, [edi + WDATA.box.height] |
||
3078 | add ecx,eax |
||
3079 | add edx,ebx |
||
3080 | |||
221 | serge | 3081 | |
742 | Rus | 3082 | popad |
3083 | |||
49 | mikedld | 3084 | |
742 | Rus | 3085 | pop ecx |
3086 | pop ebx |
||
3087 | pop eax |
||
3088 | add ecx,eax |
||
3089 | add edx,ebx |
||
3090 | mov [dlx],eax ; save for drawlimits |
||
3091 | mov [dly],ebx |
||
3092 | mov [dlxe],ecx |
||
3093 | mov [dlye],edx |
||
3094 | call calculatescreen |
||
3095 | |||
49 | mikedld | 3096 | |
742 | Rus | 3097 | |
49 | mikedld | 3098 | |
742 | Rus | 3099 | xor esi,esi |
3100 | call redrawscreen |
||
3101 | |||
49 | mikedld | 3102 | |
928 | serge | 3103 | mov [mouse_background], 0 ; no mouse under |
3104 | |||
49 | mikedld | 3105 | |
742 | Rus | 3106 | |
49 | mikedld | 3107 | |
742 | Rus | 3108 | |
49 | mikedld | 3109 | |
3110 | |||
3111 | |||
742 | Rus | 3112 | |
1 | ha | 3113 | |
3114 | window_move_pr dd 0x0 |
||
3115 | window_move_eax dd 0x0 |
||
3116 | window_move_ebx dd 0x0 |
||
3117 | window_move_ecx dd 0x0 |
||
3118 | window_move_edx dd 0x0 |
||
3119 | endg |
||
3120 | |||
3121 | |||
3122 | ;nt - not tested |
||
3123 | ;--------------------------------------------------------------------------------------------- |
||
3124 | ;eax |
||
3125 | ;0 - task switch counter. Ret switch counter in eax. Block. ok. |
||
3126 | ;1 - change task. Ret nothing. Block. ok. |
||
3127 | ;2 - performance control |
||
3128 | ; ebx |
||
3129 | ; 0 - enable or disable (inversion) PCE flag on CR4 for rdmpc in user mode. |
||
3130 | ; returned new cr4 in eax. Ret cr4 in eax. Block. ok. |
||
3131 | ; 1 - is cache enabled. Ret cr0 in eax if enabled else zero in eax. Block. ok. |
||
3132 | ; 2 - enable cache. Ret 1 in eax. Ret nothing. Block. ok. |
||
3133 | ; 3 - disable cache. Ret 0 in eax. Ret nothing. Block. ok. |
||
3134 | ;eax |
||
3135 | ;3 - rdmsr. Counter in edx. (edx:eax) [esi:edi, edx] => [edx:esi, ecx]. Ret in ebx:eax. Block. ok. |
||
3136 | ;4 - wrmsr. Counter in edx. (edx:eax) [esi:edi, edx] => [edx:esi, ecx]. Ret in ebx:eax. Block. ok. |
||
3137 | ;--------------------------------------------------------------------------------------------- |
||
3138 | sys_sheduler: ;noname & halyavin |
||
3139 | cmp eax,0 |
||
3140 | je shed_counter |
||
3141 | cmp eax,2 |
||
3142 | je perf_control |
||
3143 | cmp eax,3 |
||
3144 | je rdmsr_instr |
||
3145 | cmp eax,4 |
||
3146 | je wrmsr_instr |
||
3147 | cmp eax,1 |
||
3148 | jne not_supported |
||
3149 | call change_task ;delay,0 |
||
3150 | ret |
||
3151 | shed_counter: |
||
3152 | mov eax,[context_counter] |
||
3153 | mov [esp+36],eax |
||
3154 | not_supported: |
||
3155 | ret |
||
3156 | perf_control: |
||
3157 | inc eax ;now eax=3 |
||
3158 | cmp ebx,eax |
||
3159 | je cache_disable |
||
3160 | dec eax |
||
3161 | cmp ebx,eax |
||
3162 | je cache_enable |
||
3163 | dec eax |
||
3164 | cmp ebx,eax |
||
3165 | je is_cache_enabled |
||
3166 | dec eax |
||
3167 | cmp ebx,eax |
||
3168 | je modify_pce |
||
3169 | ret |
||
3170 | |||
3171 | |||
3172 | ;now counter in ecx |
||
3173 | ;(edx:eax) esi:edi => edx:esi |
||
3174 | mov eax,esi |
||
3175 | rdmsr |
||
3176 | mov [esp+36],eax |
||
3177 | mov [esp+24],edx ;ret in ebx? |
||
3178 | ret |
||
3179 | |||
3180 | |||
3181 | ;now counter in ecx |
||
3182 | ;(edx:eax) esi:edi => edx:esi |
||
3183 | ; Fast Call MSR can't be destroy |
||
482 | Ghost | 3184 | ; Íî MSR_AMD_EFER ìîæíî èçìåíÿòü, ò.ê. â ýòîì ðåãèñòðå ëèø |
3185 | ; âêëþ÷àþòñÿ/âûêëþ÷àþòñÿ ðàñøèðåííûå âîçìîæíîñòè |
||
3186 | cmp ecx, MSR_SYSENTER_CS |
||
3187 | je @f |
||
3188 | cmp ecx, MSR_SYSENTER_ESP |
||
3189 | je @f |
||
3190 | cmp ecx, MSR_SYSENTER_EIP |
||
3191 | je @f |
||
3192 | cmp ecx, MSR_AMD_STAR |
||
3193 | je @f |
||
3194 | |||
3195 | |||
3196 | wrmsr |
||
3197 | ; mov [esp + 36], eax |
||
742 | Rus | 3198 | ; mov [esp + 24], edx ;ret in ebx? |
3199 | @@: |
||
482 | Ghost | 3200 | ret |
1 | ha | 3201 | |
3202 | |||
3203 | mov eax,cr0 |
||
3204 | or eax,01100000000000000000000000000000b |
||
3205 | mov cr0,eax |
||
3206 | wbinvd ;set MESI |
||
3207 | ret |
||
3208 | |||
3209 | |||
3210 | mov eax,cr0 |
||
3211 | and eax,10011111111111111111111111111111b |
||
3212 | mov cr0,eax |
||
3213 | ret |
||
3214 | |||
3215 | |||
3216 | mov eax,cr0 |
||
3217 | mov ebx,eax |
||
3218 | and eax,01100000000000000000000000000000b |
||
3219 | jz cache_disabled |
||
3220 | mov [esp+36],ebx |
||
3221 | cache_disabled: |
||
3222 | mov dword [esp+36],eax ;0 |
||
3223 | ret |
||
3224 | |||
3225 | |||
3226 | mov eax,cr4 |
||
3227 | ; mov ebx,0 |
||
3228 | ; or bx,100000000b ;pce |
||
3229 | ; xor eax,ebx ;invert pce |
||
3230 | bts eax,8 ;pce=cr4[8] |
||
17 | me_root | 3231 | mov cr4,eax |
1 | ha | 3232 | mov [esp+36],eax |
3233 | ret |
||
3234 | ;--------------------------------------------------------------------------------------------- |
||
3235 | |||
3236 | |||
3237 | |||
3238 | |||
3239 | |||
3240 | push eax edx |
||
742 | Rus | 3241 | |
1 | ha | 3242 | |
759 | Rus | 3243 | mov ecx, [_display_data] |
840 | serge | 3244 | |
3245 | |||
3246 | imul edx, ebx |
||
742 | Rus | 3247 | |
1 | ha | 3248 | |
840 | serge | 3249 | mov dl, [eax+edx] ; lea eax, [...] |
3250 | |||
3251 | |||
742 | Rus | 3252 | mov eax, [CURRENT_TASK] |
3253 | cmp al, dl |
||
3254 | setne cl |
||
3255 | |||
1 | ha | 3256 | |
742 | Rus | 3257 | ret |
3258 | |||
1 | ha | 3259 | |
3260 | cpustring db '/sys/CPU',0 |
||
897 | serge | 3261 | endg |
1 | ha | 3262 | |
3263 | |||
67 | diamond | 3264 | background_defined db 0 ; diamond, 11.04.2006 |
742 | Rus | 3265 | endg |
67 | diamond | 3266 | |
1 | ha | 3267 | |
3268 | ; check misc |
||
3269 | |||
3270 | |||
3271 | |||
3272 | |||
928 | serge | 3273 | jne nocpustart |
3274 | |||
501 | serge | 3275 | |
897 | serge | 3276 | push 0 |
3277 | push cpustring |
||
3278 | call _sys_exec |
||
3279 | add esp, 12 |
||
3280 | |||
501 | serge | 3281 | |
928 | serge | 3282 | |
465 | serge | 3283 | |
3284 | cmp [mouse_active], 1 |
||
1 | ha | 3285 | jne mouse_not_active |
3286 | mov [mouse_active], 0 |
||
3287 | xor edi, edi |
||
3288 | mov ecx, [TASK_COUNT] |
||
742 | Rus | 3289 | set_mouse_event: |
465 | serge | 3290 | add edi, 256 |
1 | ha | 3291 | or [edi+SLOT_BASE+APPDATA.event_mask], dword 100000b |
742 | Rus | 3292 | loop set_mouse_event |
1 | ha | 3293 | |
3294 | |||
465 | serge | 3295 | cmp [redraw_background], 0 ; background update ? |
928 | serge | 3296 | jz nobackgr |
742 | Rus | 3297 | cmp [background_defined], 0 |
76 | mario79 | 3298 | jz nobackgr |
742 | Rus | 3299 | cmp [redraw_background], 2 |
928 | serge | 3300 | jnz no_set_bgr_event |
709 | diamond | 3301 | xor edi, edi |
473 | diamond | 3302 | mov ecx, [TASK_COUNT] |
742 | Rus | 3303 | set_bgr_event: |
473 | diamond | 3304 | add edi, 256 |
3305 | or [edi+SLOT_BASE+APPDATA.event_mask], 16 |
||
742 | Rus | 3306 | loop set_bgr_event |
473 | diamond | 3307 | no_set_bgr_event: |
709 | diamond | 3308 | ; mov [draw_data+32 + RECT.left],dword 0 |
3309 | ; mov [draw_data+32 + RECT.top],dword 0 |
||
3310 | ; mov eax,[Screen_Max_X] |
||
753 | serge | 3311 | ; mov ebx,[Screen_Max_Y] |
3312 | ; mov [draw_data+32 + RECT.right],eax |
||
709 | diamond | 3313 | ; mov [draw_data+32 + RECT.bottom],ebx |
3314 | call drawbackground |
||
1 | ha | 3315 | mov [redraw_background], 0 |
928 | serge | 3316 | mov [redraw_background], 0 |
3317 | |||
1 | ha | 3318 | |
465 | serge | 3319 | |
1 | ha | 3320 | |
3321 | |||
3322 | |||
928 | serge | 3323 | je noshutdown |
742 | Rus | 3324 | |
1 | ha | 3325 | |
3326 | |||
3327 | |||
928 | serge | 3328 | jne no_mark_system_shutdown |
1 | ha | 3329 | |
3330 | |||
709 | diamond | 3331 | mov edx,OS_BASE+0x3040 |
465 | serge | 3332 | jecxz @f |
709 | diamond | 3333 | markz: |
465 | serge | 3334 | mov [edx+TASKDATA.state],byte 3 |
115 | poddubny | 3335 | add edx,0x20 |
1 | ha | 3336 | loop markz |
3337 | @@: |
||
709 | diamond | 3338 | |
1 | ha | 3339 | |
3340 | |||
3341 | |||
3342 | |||
3343 | |||
928 | serge | 3344 | je system_shutdown |
742 | Rus | 3345 | |
1 | ha | 3346 | |
465 | serge | 3347 | |
1 | ha | 3348 | |
3349 | |||
742 | Rus | 3350 | mov ebx,TASK_DATA+TASKDATA.state |
379 | serge | 3351 | mov esi,1 |
1 | ha | 3352 | |
3353 | |||
465 | serge | 3354 | mov cl,[ebx] |
1 | ha | 3355 | cmp cl,byte 3 |
3356 | jz terminate |
||
742 | Rus | 3357 | cmp cl,byte 4 |
1 | ha | 3358 | jz terminate |
742 | Rus | 3359 | |
1 | ha | 3360 | |
3361 | inc esi |
||
3362 | dec eax |
||
3363 | jnz newct |
||
3364 | ret |
||
3365 | |||
3366 | |||
3367 | |||
3368 | |||
3369 | |||
3370 | |||
3371 | |||
3372 | |||
742 | Rus | 3373 | push eax |
3374 | |||
1 | ha | 3375 | |
684 | diamond | 3376 | ;;; call delay_hs |
1 | ha | 3377 | |
3378 | |||
742 | Rus | 3379 | xor ecx,ecx |
3380 | newdw2: |
||
1 | ha | 3381 | |
3382 | |||
742 | Rus | 3383 | push ecx |
3384 | |||
1 | ha | 3385 | |
742 | Rus | 3386 | shl eax,5 |
3387 | add eax,window_data |
||
3388 | |||
1 | ha | 3389 | |
742 | Rus | 3390 | je not_this_task |
3391 | ; check if window in redraw area |
||
3392 | mov edi,eax |
||
3393 | |||
1 | ha | 3394 | |
742 | Rus | 3395 | jz bgli |
3396 | |||
1 | ha | 3397 | |
742 | Rus | 3398 | mov ebx, [edi + WDATA.box.top] |
3399 | mov ecx, [edi + WDATA.box.width] |
||
3400 | mov edx, [edi + WDATA.box.height] |
||
3401 | add ecx,eax |
||
3402 | add edx,ebx |
||
3403 | |||
1 | ha | 3404 | |
742 | Rus | 3405 | cmp ecx,ebx |
3406 | jb ricino |
||
3407 | |||
1 | ha | 3408 | |
742 | Rus | 3409 | cmp ecx,eax |
3410 | jb ricino |
||
3411 | |||
1 | ha | 3412 | |
742 | Rus | 3413 | mov ebx, [edi + WDATA.box.top] |
3414 | mov ecx, [edi + WDATA.box.width] |
||
3415 | mov edx, [edi + WDATA.box.height] |
||
3416 | add ecx, eax |
||
3417 | add edx, ebx |
||
3418 | |||
164 | serge | 3419 | |
742 | Rus | 3420 | cmp edx,eax |
3421 | jb ricino |
||
3422 | |||
1 | ha | 3423 | |
742 | Rus | 3424 | cmp ecx,eax |
3425 | jb ricino |
||
3426 | |||
1 | ha | 3427 | |
742 | Rus | 3428 | |
1 | ha | 3429 | |
742 | Rus | 3430 | jnz .az |
3431 | mov al, byte [redraw_background] |
||
928 | serge | 3432 | cmp al,2 |
742 | Rus | 3433 | jz newdw8 |
3434 | test al,al |
||
3435 | jz .az |
||
3436 | lea eax,[edi+draw_data-window_data] |
||
3437 | mov ebx,[dlx] |
||
3438 | cmp ebx,[eax+RECT.left] |
||
3439 | jae @f |
||
3440 | mov [eax+RECT.left],ebx |
||
3441 | @@: |
||
3442 | mov ebx,[dly] |
||
3443 | cmp ebx,[eax+RECT.top] |
||
3444 | jae @f |
||
3445 | mov [eax+RECT.top],ebx |
||
3446 | @@: |
||
3447 | mov ebx,[dlxe] |
||
3448 | cmp ebx,[eax+RECT.right] |
||
3449 | jbe @f |
||
3450 | mov [eax+RECT.right],ebx |
||
3451 | @@: |
||
3452 | mov ebx,[dlye] |
||
3453 | cmp ebx,[eax+RECT.bottom] |
||
3454 | jbe @f |
||
3455 | mov [eax+RECT.bottom],ebx |
||
3456 | @@: |
||
3457 | jmp newdw8 |
||
3458 | .az: |
||
3459 | |||
1 | ha | 3460 | |
742 | Rus | 3461 | add eax,draw_data-window_data |
3462 | |||
1 | ha | 3463 | |
742 | Rus | 3464 | mov [eax + RECT.left], ebx |
3465 | mov ebx,[dly] |
||
3466 | mov [eax + RECT.top], ebx |
||
3467 | mov ebx,[dlxe] |
||
3468 | mov [eax + RECT.right], ebx |
||
3469 | mov ebx,[dlye] |
||
3470 | mov [eax + RECT.bottom], ebx |
||
3471 | |||
1 | ha | 3472 | |
742 | Rus | 3473 | |
1 | ha | 3474 | |
742 | Rus | 3475 | jne nobgrd |
3476 | mov [redraw_background], 1 |
||
928 | serge | 3477 | |
1 | ha | 3478 | |
3479 | nobgrd: |
||
3480 | |||
3481 | |||
742 | Rus | 3482 | |
1 | ha | 3483 | |
3484 | |||
3485 | |||
3486 | |||
3487 | |||
742 | Rus | 3488 | |
1 | ha | 3489 | |
742 | Rus | 3490 | jle newdw2 |
3491 | |||
1 | ha | 3492 | |
742 | Rus | 3493 | popad |
3494 | |||
1 | ha | 3495 | |
742 | Rus | 3496 | |
1 | ha | 3497 | |
3498 | |||
3499 | |||
742 | Rus | 3500 | |
1 | ha | 3501 | |
742 | Rus | 3502 | xor eax, eax |
3503 | mov ecx, 1023 ;0x0fff00 / 4 |
||
3504 | cld |
||
3505 | rep stosd |
||
3506 | |||
1 | ha | 3507 | |
840 | serge | 3508 | mov eax,0x01010101 |
742 | Rus | 3509 | mov ecx,1280*1024 / 4 |
3510 | rep stosd |
||
3511 | |||
1 | ha | 3512 | |
928 | serge | 3513 | |
1 | ha | 3514 | |
742 | Rus | 3515 | |
1 | ha | 3516 | |
3517 | imax dd 0x0 |
||
742 | Rus | 3518 | endg |
1 | ha | 3519 | |
3520 | |||
3521 | |||
3522 | |||
3523 | |||
3524 | |||
3525 | |||
742 | Rus | 3526 | push ecx |
3527 | |||
1 | ha | 3528 | |
742 | Rus | 3529 | ; |
3530 | imul ecx, 33941 |
||
3531 | shr ecx, 9 |
||
3532 | ; |
||
3533 | |||
1 | ha | 3534 | |
742 | Rus | 3535 | and al,0x10 |
3536 | mov ah,al |
||
3537 | cld |
||
3538 | |||
1 | ha | 3539 | |
742 | Rus | 3540 | and al,0x10 |
3541 | cmp al,ah |
||
3542 | jz cnt1 |
||
3543 | |||
1 | ha | 3544 | |
742 | Rus | 3545 | loop cnt1 |
3546 | |||
1 | ha | 3547 | |
742 | Rus | 3548 | pop eax |
3549 | |||
1 | ha | 3550 | |
742 | Rus | 3551 | |
1 | ha | 3552 | |
3553 | |||
3554 | mov edi, [TASK_BASE] |
||
742 | Rus | 3555 | mov [edi + TASKDATA.event_mask], ebx |
3556 | ret |
||
3557 | |||
1 | ha | 3558 | |
3559 | |||
3560 | |||
3561 | ; ebx = delay time |
||
684 | diamond | 3562 | push ecx |
742 | Rus | 3563 | push edx |
3564 | |||
1 | ha | 3565 | |
742 | Rus | 3566 | |
1 | ha | 3567 | |
3568 | mov ecx,[timer_ticks] |
||
742 | Rus | 3569 | sub ecx,edx |
3570 | cmp ecx,ebx |
||
3571 | jae zerodelay |
||
3572 | |||
1 | ha | 3573 | |
742 | Rus | 3574 | |
1 | ha | 3575 | |
742 | Rus | 3576 | |
1 | ha | 3577 | |
3578 | pop edx |
||
742 | Rus | 3579 | pop ecx |
3580 | |||
1 | ha | 3581 | |
742 | Rus | 3582 | |
1 | ha | 3583 | |
3584 | |||
3585 | |||
3586 | |||
3587 | ; ebx = to |
||
3588 | ; ecx = no of bytes |
||
3589 | test ecx, ecx |
||
3590 | jle .ret |
||
3591 | |||
3592 | |||
3593 | |||
3594 | |||
3595 | |||
3596 | mov esi, eax |
||
3597 | |||
3598 | |||
3599 | jz @f |
||
742 | Rus | 3600 | |
1 | ha | 3601 | |
3602 | shr ecx, 2 |
||
3603 | rep movsd |
||
3604 | pop ecx |
||
3605 | and ecx, 11b |
||
3606 | jz .finish |
||
742 | Rus | 3607 | @@: |
1 | ha | 3608 | rep movsb |
3609 | |||
3610 | |||
3611 | pop ecx edi esi |
||
3612 | .ret: |
||
3613 | ret |
||
3614 | |||
3615 | |||
3616 | |||
75 | diamond | 3617 | ;align 4 |
3618 | ; |
||
1 | ha | 3619 | ;read_floppy_file: |
75 | diamond | 3620 | ; |
1 | ha | 3621 | ;; as input |
75 | diamond | 3622 | ;; |
3623 | ;; eax pointer to file |
||
3624 | ;; ebx file lenght |
||
3625 | ;; ecx start 512 byte block number |
||
3626 | ;; edx number of blocks to read |
||
3627 | ;; esi pointer to return/work area (atleast 20 000 bytes) |
||
3628 | ;; |
||
3629 | ;; |
||
3630 | ;; on return |
||
3631 | ;; |
||
3632 | ;; eax = 0 command succesful |
||
3633 | ;; 1 no fd base and/or partition defined |
||
3634 | ;; 2 yet unsupported FS |
||
3635 | ;; 3 unknown FS |
||
3636 | ;; 4 partition not defined at hd |
||
3637 | ;; 5 file not found |
||
3638 | ;; ebx = size of file |
||
3639 | ; |
||
1 | ha | 3640 | ; mov edi,[TASK_BASE] |
379 | serge | 3641 | ; add edi,0x10 |
75 | diamond | 3642 | ; add esi,[edi] |
3643 | ; add eax,[edi] |
||
3644 | ; |
||
1 | ha | 3645 | ; pushad |
75 | diamond | 3646 | ; mov edi,esi |
3647 | ; add edi,1024 |
||
3648 | ; mov esi,0x100000+19*512 |
||
3649 | ; sub ecx,1 |
||
3650 | ; shl ecx,9 |
||
3651 | ; add esi,ecx |
||
3652 | ; shl edx,9 |
||
3653 | ; mov ecx,edx |
||
3654 | ; cld |
||
3655 | ; rep movsb |
||
3656 | ; popad |
||
3657 | ; |
||
3658 | ; mov [esp+36],eax |
||
3659 | ; mov [esp+24],ebx |
||
3660 | ; ret |
||
3661 | |||
1 | ha | 3662 | |
3663 | |||
3664 | |||
3665 | |||
3666 | |||
3667 | |||
3668 | |||
765 | Rus | 3669 | add ebx, [eax + TASKDATA.mem_start] |
3670 | |||
1 | ha | 3671 | |
765 | Rus | 3672 | jae .not_owner |
75 | diamond | 3673 | mov edi, [eax + TASKDATA.pid] |
765 | Rus | 3674 | cmp edi, [irq_owner + 4 * ecx] |
3675 | je .spril1 |
||
3676 | .not_owner: |
||
75 | diamond | 3677 | xor ecx, ecx |
765 | Rus | 3678 | jmp .end |
3679 | .spril1: |
||
3680 | |||
1 | ha | 3681 | |
765 | Rus | 3682 | mov esi, ebx |
3683 | lea edi, [irq00read + ecx] |
||
3684 | push 16 |
||
3685 | pop ecx |
||
3686 | |||
3687 | |||
1 | ha | 3688 | rep movsd |
3689 | .end: |
||
765 | Rus | 3690 | mov [esp+32], ecx |
3691 | ret |
||
1 | ha | 3692 | |
3693 | |||
3694 | |||
3695 | |||
3696 | |||
3697 | movzx esi, bh ; save number of subfunction, if bh = 1, return data size, otherwise, read data |
||
760 | Rus | 3698 | xor bh, bh |
3699 | cmp ebx, 16 |
||
3700 | jae .not_owner |
||
75 | diamond | 3701 | mov edx, [4 * ebx + irq_owner] ; check for irq owner |
760 | Rus | 3702 | |
742 | Rus | 3703 | |
760 | Rus | 3704 | |
742 | Rus | 3705 | |
760 | Rus | 3706 | je gidril1 |
1 | ha | 3707 | .not_owner: |
75 | diamond | 3708 | xor edx, edx |
760 | Rus | 3709 | dec edx |
3710 | jmp gid1 |
||
3711 | |||
1 | ha | 3712 | |
3713 | |||
3714 | |||
760 | Rus | 3715 | lea eax, [ebx + IRQ_SAVE] ; calculate address of the beginning of buffer + 0x0 - data size |
3716 | mov edx, [eax] ; + 0x4 - data offset |
||
3717 | dec esi |
||
3718 | jz gid1 |
||
1 | ha | 3719 | test edx, edx ; check if buffer is empty |
760 | Rus | 3720 | jz gid1 |
3721 | |||
1 | ha | 3722 | |
760 | Rus | 3723 | mov edi, ecx |
3724 | |||
742 | Rus | 3725 | |
760 | Rus | 3726 | |
742 | Rus | 3727 | |
760 | Rus | 3728 | jb @f |
759 | Rus | 3729 | |
742 | Rus | 3730 | |
760 | Rus | 3731 | |
759 | Rus | 3732 | |
3733 | |||
3734 | |||
760 | Rus | 3735 | cld |
3736 | cmp esi, ecx ; if greater than the buffer size, begin cycle again |
||
3737 | jbe @f |
||
3738 | |||
759 | Rus | 3739 | |
760 | Rus | 3740 | sub edx, ecx |
3741 | |||
759 | Rus | 3742 | |
760 | Rus | 3743 | rep movsb |
3744 | |||
3745 | |||
3746 | @@: |
||
3747 | lea esi, [eax + ebx + 0x10] |
||
3748 | mov ecx, edx |
||
3749 | add ebx, edx |
||
3750 | |||
3751 | |||
3752 | mov edx, [eax] |
||
3753 | mov [eax], ecx ; set data size to zero |
||
3754 | mov [eax + 0x4], ebx ; set data offset |
||
3755 | |||
3756 | |||
1 | ha | 3757 | mov [esp+32], edx ; eax |
760 | Rus | 3758 | ret |
1 | ha | 3759 | |
3760 | |||
3761 | |||
3762 | |||
3763 | |||
3764 | |||
3765 | |||
465 | serge | 3766 | |
1 | ha | 3767 | |
465 | serge | 3768 | ; and ecx,7 ; offset in byte |
3769 | |||
1 | ha | 3770 | |
465 | serge | 3771 | ; add edi,eax |
3772 | |||
1 | ha | 3773 | |
465 | serge | 3774 | ; shl ebx,cl |
3775 | |||
1 | ha | 3776 | |
742 | Rus | 3777 | jne siar1 |
1 | ha | 3778 | |
3779 | |||
465 | serge | 3780 | ; and [edi],byte bl |
3781 | btr [edi], eax |
||
3782 | |||
1 | ha | 3783 | |
3784 | |||
3785 | |||
3786 | |||
3787 | |||
465 | serge | 3788 | |
1 | ha | 3789 | |
465 | serge | 3790 | ; or [edi],byte bl ; disable access - ebp = 1 |
3791 | |||
1 | ha | 3792 | |
3793 | |||
3794 | |||
3795 | |||
3796 | |||
3797 | |||
3798 | |||
3799 | jnz free_port_area |
||
3800 | ; je r_port_area |
||
3801 | ; jmp free_port_area |
||
3802 | |||
3803 | |||
3804 | |||
3805 | |||
3806 | |||
3807 | |||
742 | Rus | 3808 | ja rpal1 |
75 | diamond | 3809 | cmp ecx,65536 |
3810 | jae rpal1 |
||
3811 | mov esi,[RESERVED_PORTS] |
||
381 | serge | 3812 | test esi,esi ; no reserved areas ? |
742 | Rus | 3813 | je rpal2 |
1 | ha | 3814 | cmp esi,255 ; max reserved |
742 | Rus | 3815 | jae rpal1 |
75 | diamond | 3816 | rpal3: |
465 | serge | 3817 | mov edi,esi |
1 | ha | 3818 | shl edi,4 |
3819 | add edi,RESERVED_PORTS |
||
381 | serge | 3820 | cmp ebx,[edi+8] |
1 | ha | 3821 | ja rpal4 |
75 | diamond | 3822 | cmp ecx,[edi+4] |
1 | ha | 3823 | jae rpal1 |
3824 | ; jb rpal4 |
||
3825 | ; jmp rpal1 |
||
3826 | rpal4: |
||
465 | serge | 3827 | |
1 | ha | 3828 | |
3829 | jnz rpal3 |
||
3830 | jmp rpal2 |
||
3831 | rpal1: |
||
3832 | popad |
||
3833 | mov eax,1 |
||
3834 | ret |
||
3835 | |||
3836 | |||
3837 | popad |
||
3838 | |||
3839 | |||
3840 | |||
3841 | cli |
||
3842 | pushad ; start enable io map |
||
742 | Rus | 3843 | |
1 | ha | 3844 | |
3845 | jae no_unmask_io ; jge |
||
3846 | |||
3847 | |||
3848 | |||
3849 | |||
3850 | |||
3851 | |||
3852 | |||
3853 | |||
742 | Rus | 3854 | call set_io_access_rights |
1 | ha | 3855 | |
3856 | |||
3857 | |||
3858 | |||
3859 | cmp eax,ecx |
||
3860 | jbe new_port_access |
||
3861 | |||
3862 | |||
3863 | |||
3864 | |||
742 | Rus | 3865 | sti |
1 | ha | 3866 | |
3867 | |||
381 | serge | 3868 | add edi,1 |
1 | ha | 3869 | mov [RESERVED_PORTS],edi |
381 | serge | 3870 | shl edi,4 |
1 | ha | 3871 | add edi,RESERVED_PORTS |
381 | serge | 3872 | mov esi,[TASK_BASE] |
379 | serge | 3873 | mov esi,[esi+TASKDATA.pid] |
115 | poddubny | 3874 | mov [edi],esi |
1 | ha | 3875 | mov [edi+4],ebx |
3876 | mov [edi+8],ecx |
||
3877 | |||
3878 | |||
3879 | ret |
||
3880 | |||
3881 | |||
3882 | |||
3883 | |||
3884 | |||
3885 | |||
381 | serge | 3886 | test esi,esi |
75 | diamond | 3887 | je frpal2 |
1 | ha | 3888 | mov edx,[TASK_BASE] |
379 | serge | 3889 | mov edx,[edx+TASKDATA.pid] |
115 | poddubny | 3890 | frpal3: |
1 | ha | 3891 | mov edi,esi |
3892 | shl edi,4 |
||
3893 | add edi,RESERVED_PORTS |
||
381 | serge | 3894 | cmp edx,[edi] |
1 | ha | 3895 | jne frpal4 |
3896 | cmp ebx,[edi+4] |
||
3897 | jne frpal4 |
||
3898 | cmp ecx,[edi+8] |
||
3899 | jne frpal4 |
||
3900 | jmp frpal1 |
||
3901 | frpal4: |
||
3902 | dec esi |
||
3903 | jnz frpal3 |
||
3904 | frpal2: |
||
3905 | popad |
||
3906 | mov eax,1 |
||
3907 | ret |
||
3908 | frpal1: |
||
3909 | mov ecx,256 |
||
3910 | sub ecx,esi |
||
3911 | shl ecx,4 |
||
3912 | mov esi,edi |
||
3913 | add esi,16 |
||
3914 | cld |
||
3915 | rep movsb |
||
3916 | |||
3917 | |||
381 | serge | 3918 | |
1 | ha | 3919 | |
3920 | |||
3921 | |||
3922 | |||
3923 | |||
3924 | |||
742 | Rus | 3925 | |
1 | ha | 3926 | |
3927 | jge no_mask_io |
||
3928 | |||
3929 | |||
3930 | |||
3931 | |||
3932 | |||
3933 | |||
3934 | |||
3935 | |||
742 | Rus | 3936 | call set_io_access_rights |
1 | ha | 3937 | |
3938 | |||
3939 | |||
3940 | |||
3941 | cmp eax,ecx |
||
3942 | jbe new_port_access_disable |
||
3943 | |||
3944 | |||
3945 | |||
3946 | |||
742 | Rus | 3947 | |
1 | ha | 3948 | |
3949 | ret |
||
3950 | |||
3951 | |||
3952 | |||
3953 | |||
3954 | |||
765 | Rus | 3955 | inc esi |
3956 | cmp ecx, 16 |
||
3957 | jae ril1 |
||
3958 | |||
1 | ha | 3959 | |
769 | Rus | 3960 | lea ecx, [irq_owner + 4 * ecx] |
765 | Rus | 3961 | mov edx, [ecx] |
3962 | mov eax, [TASK_BASE] |
||
3963 | mov edi, [eax + TASKDATA.pid] |
||
3964 | pop eax |
||
769 | Rus | 3965 | dec ebx |
765 | Rus | 3966 | jnz reserve_irq |
3967 | |||
1 | ha | 3968 | |
765 | Rus | 3969 | jne ril1 |
3970 | dec esi |
||
3971 | mov [ecx], esi |
||
3972 | |||
3973 | |||
3974 | |||
3975 | |||
1 | ha | 3976 | |
3977 | |||
765 | Rus | 3978 | jne ril1 |
3979 | |||
1 | ha | 3980 | |
769 | Rus | 3981 | |
3982 | |||
774 | Rus | 3983 | |
769 | Rus | 3984 | |
765 | Rus | 3985 | |
769 | Rus | 3986 | |
765 | Rus | 3987 | ril1: |
1 | ha | 3988 | mov [esp+32], esi ; return in eax |
765 | Rus | 3989 | ret |
1 | ha | 3990 | |
3991 | |||
769 | Rus | 3992 | f_irqs: |
3993 | dd 0x0 |
||
3994 | dd 0x0 |
||
3995 | dd p_irq2 |
||
3996 | dd p_irq3 |
||
3997 | dd p_irq4 |
||
3998 | dd p_irq5 |
||
3999 | dd p_irq6 |
||
4000 | dd p_irq7 |
||
4001 | dd p_irq8 |
||
4002 | dd p_irq9 |
||
4003 | dd p_irq10 |
||
4004 | dd p_irq11 |
||
4005 | dd 0x0 |
||
4006 | dd 0x0 |
||
4007 | dd p_irq14 |
||
4008 | dd p_irq15 |
||
4009 | |||
4010 | |||
4011 | |||
4012 | |||
1 | ha | 4013 | inc [mouse_pause] |
33 | mario79 | 4014 | cmp [scr_mode], 0x12 |
928 | serge | 4015 | je dbrv20 |
117 | mario79 | 4016 | dbrv12: |
1 | ha | 4017 | cmp [scr_mode], 0100000000000000b |
928 | serge | 4018 | jge dbrv20 |
1 | ha | 4019 | cmp [scr_mode], 0x13 |
928 | serge | 4020 | je dbrv20 |
1 | ha | 4021 | call vesa12_drawbackground |
4022 | dec [mouse_pause] |
||
33 | mario79 | 4023 | call [draw_pointer] |
36 | mario79 | 4024 | ret |
1 | ha | 4025 | dbrv20: |
4026 | cmp [BgrDrawMode],dword 1 |
||
527 | diamond | 4027 | jne bgrstr |
1 | ha | 4028 | call vesa20_drawbackground_tiled |
4029 | dec [mouse_pause] |
||
33 | mario79 | 4030 | call [draw_pointer] |
36 | mario79 | 4031 | ret |
1 | ha | 4032 | bgrstr: |
4033 | call vesa20_drawbackground_stretch |
||
4034 | dec [mouse_pause] |
||
33 | mario79 | 4035 | call [draw_pointer] |
36 | mario79 | 4036 | ret |
1 | ha | 4037 | |
4038 | |||
75 | diamond | 4039 | |
1 | ha | 4040 | |
742 | Rus | 4041 | sys_putimage: |
1 | ha | 4042 | test ecx,0x80008000 |
53 | mikedld | 4043 | jnz .exit |
4044 | test ecx,0x0000FFFF |
||
4045 | jz .exit |
||
4046 | test ecx,0xFFFF0000 |
||
4047 | jnz @f |
||
4048 | .exit: |
||
4049 | ret |
||
4050 | @@: |
||
4051 | mov edi,[current_slot] |
||
742 | Rus | 4052 | add dx,word[edi+APPDATA.wnd_clientbox.top] |
4053 | rol edx,16 |
||
4054 | add dx,word[edi+APPDATA.wnd_clientbox.left] |
||
4055 | rol edx,16 |
||
4056 | .forced: |
||
114 | mikedld | 4057 | push ebp esi 0 |
742 | Rus | 4058 | mov ebp, putimage_get24bpp |
4059 | mov esi, putimage_init24bpp |
||
4060 | sys_putimage_bpp: |
||
283 | diamond | 4061 | ; call [disable_mouse] ; this will be done in xxx_putimage |
4062 | ; mov eax, vga_putimage |
||
117 | mario79 | 4063 | cmp [scr_mode], 0x12 |
928 | serge | 4064 | jz @f ;.doit |
742 | Rus | 4065 | mov eax, vesa12_putimage |
4066 | cmp [scr_mode], 0100000000000000b |
||
928 | serge | 4067 | jae @f |
742 | Rus | 4068 | cmp [scr_mode], 0x13 |
928 | serge | 4069 | jnz .doit |
742 | Rus | 4070 | @@: |
75 | diamond | 4071 | mov eax, vesa20_putimage |
742 | Rus | 4072 | .doit: |
75 | diamond | 4073 | inc [mouse_pause] |
742 | Rus | 4074 | call eax |
4075 | dec [mouse_pause] |
||
4076 | pop ebp esi ebp |
||
4077 | jmp [draw_pointer] |
||
4078 | |||
1 | ha | 4079 | |
283 | diamond | 4080 | mov edi, esi |
742 | Rus | 4081 | mov esi, edx |
4082 | mov edx, ecx |
||
4083 | mov ecx, ebx |
||
4084 | mov ebx, eax |
||
4085 | sys_putimage_palette: |
||
283 | diamond | 4086 | ; ebx = pointer to image |
4087 | ; ecx = [xsize]*65536 + [ysize] |
||
4088 | ; edx = [xstart]*65536 + [ystart] |
||
4089 | ; esi = number of bits per pixel, must be 8, 24 or 32 |
||
314 | diamond | 4090 | ; edi = pointer to palette |
283 | diamond | 4091 | ; ebp = row delta |
314 | diamond | 4092 | mov eax, [CURRENT_TASK] |
742 | Rus | 4093 | shl eax, 8 |
4094 | add dx, word [eax+SLOT_BASE+APPDATA.wnd_clientbox.top] |
||
4095 | rol edx, 16 |
||
4096 | add dx, word [eax+SLOT_BASE+APPDATA.wnd_clientbox.left] |
||
4097 | rol edx, 16 |
||
4098 | .forced: |
||
283 | diamond | 4099 | cmp esi, 1 |
914 | serge | 4100 | jnz @f |
4101 | push edi |
||
4102 | mov eax, [edi+4] |
||
4103 | sub eax, [edi] |
||
4104 | push eax |
||
4105 | push dword [edi] |
||
4106 | push 0ffffff80h |
||
4107 | mov edi, esp |
||
4108 | call put_mono_image |
||
4109 | add esp, 12 |
||
4110 | pop edi |
||
4111 | ret |
||
4112 | @@: |
||
4113 | cmp esi, 4 |
||
4114 | jnz @f |
||
4115 | push edi |
||
4116 | push 0ffffff80h |
||
4117 | mov edi, esp |
||
4118 | call put_4bit_image |
||
4119 | pop eax |
||
4120 | pop edi |
||
4121 | ret |
||
4122 | @@: |
||
4123 | push ebp esi ebp |
||
742 | Rus | 4124 | cmp esi, 8 |
4125 | jnz @f |
||
4126 | mov ebp, putimage_get8bpp |
||
4127 | mov esi, putimage_init8bpp |
||
4128 | jmp sys_putimage_bpp |
||
4129 | @@: |
||
314 | diamond | 4130 | cmp esi, 15 |
914 | serge | 4131 | jnz @f |
4132 | mov ebp, putimage_get15bpp |
||
4133 | mov esi, putimage_init15bpp |
||
4134 | jmp sys_putimage_bpp |
||
4135 | @@: |
||
4136 | cmp esi, 16 |
||
844 | serge | 4137 | jnz @f |
4138 | mov ebp, putimage_get16bpp |
||
4139 | mov esi, putimage_init16bpp |
||
4140 | jmp sys_putimage_bpp |
||
4141 | @@: |
||
4142 | cmp esi, 24 |
||
742 | Rus | 4143 | jnz @f |
4144 | mov ebp, putimage_get24bpp |
||
4145 | mov esi, putimage_init24bpp |
||
4146 | jmp sys_putimage_bpp |
||
4147 | @@: |
||
314 | diamond | 4148 | cmp esi, 32 |
742 | Rus | 4149 | jnz @f |
4150 | mov ebp, putimage_get32bpp |
||
4151 | mov esi, putimage_init32bpp |
||
4152 | jmp sys_putimage_bpp |
||
4153 | @@: |
||
314 | diamond | 4154 | pop ebp esi ebp |
844 | serge | 4155 | ret |
742 | Rus | 4156 | |
283 | diamond | 4157 | |
914 | serge | 4158 | push ebp esi ebp |
4159 | mov ebp, putimage_get1bpp |
||
4160 | mov esi, putimage_init1bpp |
||
4161 | jmp sys_putimage_bpp |
||
4162 | put_4bit_image: |
||
4163 | push ebp esi ebp |
||
4164 | mov ebp, putimage_get4bpp |
||
4165 | mov esi, putimage_init4bpp |
||
4166 | jmp sys_putimage_bpp |
||
4167 | |||
4168 | |||
283 | diamond | 4169 | lea eax, [eax*3] |
742 | Rus | 4170 | putimage_init8bpp: |
283 | diamond | 4171 | ret |
742 | Rus | 4172 | |
283 | diamond | 4173 | |
914 | serge | 4174 | putimage_get24bpp: |
283 | diamond | 4175 | mov eax, [esi] |
742 | Rus | 4176 | add esi, 3 |
4177 | ret 4 |
||
4178 | align 16 |
||
914 | serge | 4179 | putimage_get8bpp: |
283 | diamond | 4180 | movzx eax, byte [esi] |
742 | Rus | 4181 | push edx |
4182 | mov edx, [esp+8] |
||
4183 | mov eax, [edx+eax*4] |
||
4184 | pop edx |
||
4185 | inc esi |
||
4186 | ret 4 |
||
4187 | |||
283 | diamond | 4188 | |
914 | serge | 4189 | add eax, ecx |
4190 | push ecx |
||
4191 | add eax, 7 |
||
4192 | add ecx, 7 |
||
4193 | shr eax, 3 |
||
4194 | shr ecx, 3 |
||
4195 | sub eax, ecx |
||
4196 | pop ecx |
||
4197 | ret |
||
4198 | align 16 |
||
4199 | putimage_get1bpp: |
||
4200 | push edx |
||
4201 | mov edx, [esp+8] |
||
4202 | mov al, [edx] |
||
4203 | add al, al |
||
4204 | jnz @f |
||
4205 | lodsb |
||
4206 | adc al, al |
||
4207 | @@: |
||
4208 | mov [edx], al |
||
4209 | sbb eax, eax |
||
4210 | and eax, [edx+8] |
||
4211 | add eax, [edx+4] |
||
4212 | pop edx |
||
4213 | ret 4 |
||
4214 | |||
4215 | |||
4216 | add eax, ecx |
||
4217 | push ecx |
||
4218 | add ecx, 1 |
||
4219 | add eax, 1 |
||
4220 | shr ecx, 1 |
||
4221 | shr eax, 1 |
||
4222 | sub eax, ecx |
||
4223 | pop ecx |
||
4224 | ret |
||
4225 | align 16 |
||
4226 | putimage_get4bpp: |
||
4227 | push edx |
||
4228 | mov edx, [esp+8] |
||
4229 | add byte [edx], 80h |
||
4230 | jc @f |
||
4231 | movzx eax, byte [edx+1] |
||
4232 | mov edx, [edx+4] |
||
4233 | and eax, 0x0F |
||
4234 | mov eax, [edx+eax*4] |
||
4235 | pop edx |
||
4236 | ret 4 |
||
4237 | @@: |
||
4238 | movzx eax, byte [esi] |
||
4239 | add esi, 1 |
||
4240 | mov [edx+1], al |
||
4241 | shr eax, 4 |
||
4242 | mov edx, [edx+4] |
||
4243 | mov eax, [edx+eax*4] |
||
4244 | pop edx |
||
4245 | ret 4 |
||
4246 | |||
4247 | |||
314 | diamond | 4248 | shl eax, 2 |
742 | Rus | 4249 | ret |
4250 | align 16 |
||
914 | serge | 4251 | putimage_get32bpp: |
314 | diamond | 4252 | lodsd |
742 | Rus | 4253 | ret 4 |
4254 | |||
314 | diamond | 4255 | |
914 | serge | 4256 | putimage_init16bpp: |
844 | serge | 4257 | add eax, eax |
4258 | ret |
||
4259 | align 16 |
||
914 | serge | 4260 | putimage_get15bpp: |
4261 | ; 0RRRRRGGGGGBBBBB -> 00000000RRRRR000GGGGG000BBBBB000 |
||
844 | serge | 4262 | push ecx edx |
4263 | movzx eax, word [esi] |
||
4264 | add esi, 2 |
||
4265 | mov ecx, eax |
||
4266 | mov edx, eax |
||
4267 | and eax, 0x1F |
||
4268 | and ecx, 0x1F shl 5 |
||
4269 | and edx, 0x1F shl 10 |
||
4270 | shl eax, 3 |
||
4271 | shl ecx, 6 |
||
4272 | shl edx, 9 |
||
4273 | or eax, ecx |
||
4274 | or eax, edx |
||
4275 | pop edx ecx |
||
4276 | ret 4 |
||
914 | serge | 4277 | |
844 | serge | 4278 | |
914 | serge | 4279 | putimage_get16bpp: |
4280 | ; RRRRRGGGGGGBBBBB -> 00000000RRRRR000GGGGGG00BBBBB000 |
||
4281 | push ecx edx |
||
4282 | movzx eax, word [esi] |
||
4283 | add esi, 2 |
||
4284 | mov ecx, eax |
||
4285 | mov edx, eax |
||
4286 | and eax, 0x1F |
||
4287 | and ecx, 0x3F shl 5 |
||
4288 | and edx, 0x1F shl 11 |
||
4289 | shl eax, 3 |
||
4290 | shl ecx, 5 |
||
4291 | shl edx, 8 |
||
4292 | or eax, ecx |
||
4293 | or eax, edx |
||
4294 | pop edx ecx |
||
4295 | ret 4 |
||
4296 | |||
4297 | |||
1 | ha | 4298 | ; ebx y beginning |
4299 | ; ecx x end |
||
4300 | ; edx y end |
||
283 | diamond | 4301 | ; edi color |
1 | ha | 4302 | |
4303 | |||
4304 | mov esi,[current_slot] |
||
742 | Rus | 4305 | add eax,[esi+APPDATA.wnd_clientbox.left] |
4306 | add ecx,[esi+APPDATA.wnd_clientbox.left] |
||
4307 | add ebx,[esi+APPDATA.wnd_clientbox.top] |
||
4308 | add edx,[esi+APPDATA.wnd_clientbox.top] |
||
4309 | .forced: |
||
114 | mikedld | 4310 | inc [mouse_pause] |
33 | mario79 | 4311 | ; call [disable_mouse] |
283 | diamond | 4312 | cmp [scr_mode], 0x12 |
928 | serge | 4313 | je dbv20 |
742 | Rus | 4314 | sdbv20: |
1 | ha | 4315 | cmp [scr_mode], 0100000000000000b |
928 | serge | 4316 | jge dbv20 |
1 | ha | 4317 | cmp [scr_mode], 0x13 |
928 | serge | 4318 | je dbv20 |
742 | Rus | 4319 | call vesa12_drawbar |
1 | ha | 4320 | dec [mouse_pause] |
33 | mario79 | 4321 | call [draw_pointer] |
36 | mario79 | 4322 | ret |
1 | ha | 4323 | dbv20: |
4324 | call vesa20_drawbar |
||
4325 | dec [mouse_pause] |
||
33 | mario79 | 4326 | call [draw_pointer] |
36 | mario79 | 4327 | ret |
1 | ha | 4328 | |
4329 | |||
4330 | |||
4331 | |||
4332 | |||
4333 | |||
742 | Rus | 4334 | |
1 | ha | 4335 | |
742 | Rus | 4336 | kr_loop: |
1 | ha | 4337 | in al,0x64 |
742 | Rus | 4338 | test al,1 |
4339 | jnz kr_ready |
||
4340 | loop kr_loop |
||
4341 | mov ah,1 |
||
4342 | jmp kr_exit |
||
4343 | kr_ready: |
||
1 | ha | 4344 | push ecx |
742 | Rus | 4345 | mov ecx,32 |
4346 | kr_delay: |
||
1 | ha | 4347 | loop kr_delay |
742 | Rus | 4348 | pop ecx |
4349 | in al,0x60 |
||
4350 | xor ah,ah |
||
4351 | kr_exit: |
||
1 | ha | 4352 | |
4353 | |||
742 | Rus | 4354 | |
1 | ha | 4355 | |
742 | Rus | 4356 | |
1 | ha | 4357 | |
4358 | |||
4359 | |||
4360 | |||
742 | Rus | 4361 | |
1 | ha | 4362 | |
742 | Rus | 4363 | ; mov ecx,0x1ffff ; last 0xffff, new value in view of fast CPU's |
265 | diamond | 4364 | ; kw_loop1: |
4365 | ; in al,0x64 |
||
4366 | ; test al,0x20 |
||
4367 | ; jz kw_ok1 |
||
4368 | ; loop kw_loop1 |
||
4369 | ; mov ah,1 |
||
4370 | ; jmp kw_exit |
||
4371 | ; kw_ok1: |
||
4372 | in al,0x60 |
||
742 | Rus | 4373 | mov ecx,0x1ffff ; last 0xffff, new value in view of fast CPU's |
4374 | kw_loop: |
||
1 | ha | 4375 | in al,0x64 |
742 | Rus | 4376 | test al,2 |
4377 | jz kw_ok |
||
4378 | loop kw_loop |
||
4379 | mov ah,1 |
||
4380 | jmp kw_exit |
||
4381 | kw_ok: |
||
1 | ha | 4382 | mov al,dl |
742 | Rus | 4383 | out 0x60,al |
4384 | mov ecx,0x1ffff ; last 0xffff, new value in view of fast CPU's |
||
4385 | kw_loop3: |
||
1 | ha | 4386 | in al,0x64 |
742 | Rus | 4387 | test al,2 |
4388 | jz kw_ok3 |
||
4389 | loop kw_loop3 |
||
4390 | mov ah,1 |
||
4391 | jmp kw_exit |
||
4392 | kw_ok3: |
||
1 | ha | 4393 | mov ah,8 |
742 | Rus | 4394 | kw_loop4: |
1 | ha | 4395 | mov ecx,0x1ffff ; last 0xffff, new value in view of fast CPU's |
742 | Rus | 4396 | kw_loop5: |
1 | ha | 4397 | in al,0x64 |
742 | Rus | 4398 | test al,1 |
4399 | jnz kw_ok4 |
||
4400 | loop kw_loop5 |
||
4401 | dec ah |
||
4402 | jnz kw_loop4 |
||
4403 | kw_ok4: |
||
1 | ha | 4404 | xor ah,ah |
742 | Rus | 4405 | kw_exit: |
1 | ha | 4406 | |
4407 | |||
742 | Rus | 4408 | |
1 | ha | 4409 | |
742 | Rus | 4410 | |
1 | ha | 4411 | |
4412 | |||
4413 | |||
4414 | |||
742 | Rus | 4415 | c_wait: |
1 | ha | 4416 | in al,0x64 |
742 | Rus | 4417 | test al,2 |
4418 | jz c_send |
||
4419 | loop c_wait |
||
4420 | jmp c_error |
||
4421 | c_send: |
||
1 | ha | 4422 | mov al,bl |
742 | Rus | 4423 | out 0x64,al |
4424 | mov ecx,0x1ffff ; last 0xffff, new value in view of fast CPU's |
||
4425 | c_accept: |
||
1 | ha | 4426 | in al,0x64 |
742 | Rus | 4427 | test al,2 |
4428 | jz c_ok |
||
4429 | loop c_accept |
||
4430 | c_error: |
||
1 | ha | 4431 | mov ah,1 |
742 | Rus | 4432 | jmp c_exit |
4433 | c_ok: |
||
1 | ha | 4434 | xor ah,ah |
742 | Rus | 4435 | c_exit: |
1 | ha | 4436 | ret |
742 | Rus | 4437 | |
1 | ha | 4438 | |
4439 | |||
4440 | bt [cpu_caps], CAPS_TSC |
||
164 | serge | 4441 | jnc ret_rdtsc |
4442 | rdtsc |
||
1 | ha | 4443 | ret |
4444 | ret_rdtsc: |
||
4445 | mov edx,0xffffffff |
||
4446 | mov eax,0xffffffff |
||
4447 | ret |
||
4448 | |||
4449 | |||
4450 | |||
4451 | |||
742 | Rus | 4452 | out 0x20,al |
4453 | out 0xA0,al |
||
4454 | |||
1 | ha | 4455 | |
742 | Rus | 4456 | out 0x21,al |
4457 | mov al,0x28 ; generate 0x28 + |
||
4458 | out 0xA1,al |
||
4459 | |||
1 | ha | 4460 | |
742 | Rus | 4461 | out 0x21,al |
4462 | mov al,0x02 ; at irq9 |
||
4463 | out 0xA1,al |
||
4464 | |||
1 | ha | 4465 | |
742 | Rus | 4466 | out 0x21,al |
4467 | out 0xA1,al |
||
4468 | |||
1 | ha | 4469 | |
742 | Rus | 4470 | out 0xA1,al |
4471 | out 0x21,al |
||
4472 | |||
1 | ha | 4473 | |
742 | Rus | 4474 | out 0xA1,al |
4475 | out 0x21,al |
||
4476 | ret |
||
4477 | |||
1 | ha | 4478 | |
890 | serge | 4479 | _SysMsgBoardStr: |
4480 | sys_msg_board_str: |
||
1 | ha | 4481 | |
4482 | |||
4483 | @@: |
||
4484 | cmp [esi],byte 0 |
||
4485 | je @f |
||
4486 | mov eax,1 |
||
4487 | movzx ebx,byte [esi] |
||
4488 | call sys_msg_board |
||
4489 | inc esi |
||
4490 | jmp @b |
||
4491 | @@: |
||
4492 | popad |
||
4493 | ret |
||
4494 | |||
4495 | |||
709 | diamond | 4496 | ; in: al = byte to display |
4497 | ; out: nothing |
||
4498 | ; destroys: nothing |
||
4499 | pushad |
||
742 | Rus | 4500 | mov ecx, 2 |
4501 | shl eax, 24 |
||
4502 | jmp @f |
||
4503 | |||
709 | diamond | 4504 | |
4505 | ; in: ax = word to display |
||
4506 | ; out: nothing |
||
4507 | ; destroys: nothing |
||
4508 | pushad |
||
742 | Rus | 4509 | mov ecx, 4 |
4510 | shl eax, 16 |
||
4511 | jmp @f |
||
4512 | |||
709 | diamond | 4513 | |
4514 | ; in: eax = dword to display |
||
4515 | ; out: nothing |
||
4516 | ; destroys: nothing |
||
4517 | pushad |
||
742 | Rus | 4518 | mov ecx, 8 |
4519 | @@: |
||
709 | diamond | 4520 | push ecx |
742 | Rus | 4521 | rol eax, 4 |
4522 | push eax |
||
4523 | and al, 0xF |
||
4524 | cmp al, 10 |
||
4525 | sbb al, 69h |
||
4526 | das |
||
4527 | mov bl, al |
||
4528 | xor eax, eax |
||
4529 | inc eax |
||
4530 | call sys_msg_board |
||
4531 | pop eax |
||
4532 | pop ecx |
||
4533 | loop @b |
||
4534 | popad |
||
4535 | ret |
||
4536 | |||
709 | diamond | 4537 | |
1 | ha | 4538 | msg_board_data: times 4096 db 0 |
373 | mikedld | 4539 | msg_board_count dd 0x0 |
1 | ha | 4540 | endg |
4541 | |||
4542 | |||
4543 | |||
4544 | |||
4545 | ; eax=2 : read : ebx=0 -> no data, ebx=1 -> data in al |
||
4546 | |||
4547 | |||
671 | Ghost | 4548 | cmp eax, 1 |
4549 | jne .smbl1 |
||
4550 | |||
1 | ha | 4551 | |
4552 | |||
671 | Ghost | 4553 | inc ecx |
4554 | and ecx, 4095 |
||
4555 | mov [msg_board_count], ecx |
||
4556 | mov [check_idle_semaphore], 5 |
||
4557 | ret |
||
4558 | .smbl1: |
||
4559 | cmp eax, 2 |
||
4560 | jne .smbl2 |
||
4561 | test ecx, ecx |
||
4562 | jz .smbl21 |
||
4563 | mov eax, msg_board_data+1 |
||
4564 | mov ebx, msg_board_data |
||
4565 | movzx edx, byte [ebx] |
||
4566 | call memmove |
||
4567 | dec [msg_board_count] |
||
4568 | mov [esp + 36], edx ;eax |
||
4569 | mov [esp + 24], dword 1 |
||
4570 | ret |
||
4571 | .smbl21: |
||
4572 | mov [esp+36], ecx |
||
4573 | mov [esp+24], ecx |
||
4574 | .smbl2: |
||
4575 | ret |
||
4576 | |||
1 | ha | 4577 | |
4578 | |||
4579 | |||
4580 | mov edi, [CURRENT_TASK] |
||
742 | Rus | 4581 | |
1 | ha | 4582 | |
742 | Rus | 4583 | jne no_set_keyboard_setup |
1 | ha | 4584 | |
4585 | |||
4586 | mov [edi+SLOT_BASE + APPDATA.keyboard_mode],bl |
||
380 | serge | 4587 | |
1 | ha | 4588 | |
4589 | |||
4590 | |||
4591 | |||
4592 | |||
742 | Rus | 4593 | jne no_get_keyboard_setup |
1 | ha | 4594 | |
4595 | |||
4596 | movzx eax, byte [SLOT_BASE+edi + APPDATA.keyboard_mode] |
||
380 | serge | 4597 | |
1 | ha | 4598 | |
4599 | |||
4600 | |||
4601 | |||
4602 | |||
4603 | |||
4604 | |||
742 | Rus | 4605 | jne no_get_keyboard_cas |
1 | ha | 4606 | |
4607 | |||
4608 | ; movzx eax,byte [shift] |
||
4609 | ; movzx ebx,byte [ctrl] |
||
4610 | ; shl ebx,2 |
||
4611 | ; add eax,ebx |
||
4612 | ; movzx ebx,byte [alt] |
||
4613 | ; shl ebx,3 |
||
4614 | ; add eax,ebx |
||
4615 | |||
4616 | |||
4617 | mov eax, [kb_state] |
||
4618 | ;// mike.dld ] |
||
4619 | |||
4620 | |||
4621 | |||
4622 | |||
4623 | |||
4624 | |||
4625 | |||
4626 | |||
742 | Rus | 4627 | jnz no_add_keyboard_hotkey |
4628 | |||
1 | ha | 4629 | |
742 | Rus | 4630 | @@: |
92 | diamond | 4631 | cmp dword [eax+8], 0 |
742 | Rus | 4632 | jz .found_free |
4633 | add eax, 16 |
||
4634 | cmp eax, hotkey_list+16*256 |
||
4635 | jb @b |
||
4636 | mov dword [esp+36], 1 |
||
4637 | ret |
||
4638 | .found_free: |
||
92 | diamond | 4639 | mov [eax+8], edi |
742 | Rus | 4640 | mov [eax+4], ecx |
4641 | movzx ebx, bl |
||
4642 | lea ebx, [hotkey_scancodes+ebx*4] |
||
4643 | mov ecx, [ebx] |
||
4644 | mov [eax], ecx |
||
4645 | mov [ebx], eax |
||
4646 | mov [eax+12], ebx |
||
4647 | jecxz @f |
||
4648 | mov [ecx+12], eax |
||
4649 | @@: |
||
92 | diamond | 4650 | and dword [esp+36], 0 |
742 | Rus | 4651 | ret |
4652 | |||
92 | diamond | 4653 | |
4654 | |||
4655 | |||
742 | Rus | 4656 | jnz no_del_keyboard_hotkey |
4657 | |||
92 | diamond | 4658 | |
742 | Rus | 4659 | lea ebx, [hotkey_scancodes+ebx*4] |
4660 | mov eax, [ebx] |
||
4661 | .scan: |
||
92 | diamond | 4662 | test eax, eax |
742 | Rus | 4663 | jz .notfound |
4664 | cmp [eax+8], edi |
||
4665 | jnz .next |
||
4666 | cmp [eax+4], ecx |
||
4667 | jz .found |
||
4668 | .next: |
||
92 | diamond | 4669 | mov eax, [eax] |
742 | Rus | 4670 | jmp .scan |
4671 | .notfound: |
||
92 | diamond | 4672 | mov dword [esp+36], 1 |
742 | Rus | 4673 | ret |
4674 | .found: |
||
92 | diamond | 4675 | mov ecx, [eax] |
742 | Rus | 4676 | jecxz @f |
4677 | mov edx, [eax+12] |
||
4678 | mov [ecx+12], edx |
||
4679 | @@: |
||
92 | diamond | 4680 | mov ecx, [eax+12] |
742 | Rus | 4681 | mov edx, [eax] |
4682 | mov [ecx], edx |
||
4683 | xor edx, edx |
||
4684 | mov [eax+4], edx |
||
4685 | mov [eax+8], edx |
||
4686 | mov [eax+12], edx |
||
4687 | mov [eax], edx |
||
4688 | mov [esp+36], edx |
||
4689 | ret |
||
4690 | |||
92 | diamond | 4691 | |
4692 | ret |
||
1 | ha | 4693 | |
4694 | |||
4695 | |||
4696 | |||
4697 | |||
742 | Rus | 4698 | |
1 | ha | 4699 | |
742 | Rus | 4700 | jne no_gs1 |
1 | ha | 4701 | mov eax,[Screen_Max_X] |
753 | serge | 4702 | shl eax,16 |
1 | ha | 4703 | mov ax, word [Screen_Max_Y] |
928 | serge | 4704 | add eax,0x00010001 |
1 | ha | 4705 | mov [esp+36],eax |
4706 | ret |
||
4707 | no_gs1: |
||
4708 | |||
4709 | |||
742 | Rus | 4710 | jne no_gs2 |
1 | ha | 4711 | mov eax, [ScreenBPP] |
928 | serge | 4712 | mov [esp+36],eax |
1 | ha | 4713 | ret |
4714 | no_gs2: |
||
4715 | |||
4716 | |||
742 | Rus | 4717 | jne no_gs3 |
1 | ha | 4718 | mov eax,[BytesPerScanLine] |
381 | serge | 4719 | mov [esp+36],eax |
1 | ha | 4720 | ret |
4721 | no_gs3: |
||
4722 | |||
4723 | |||
4724 | ret |
||
4725 | |||
4726 | |||
4727 | |||
4728 | |||
4729 | |||
4730 | |||
4731 | |||
4732 | mov [esp+36],eax |
||
4733 | ret |
||
4734 | |||
4735 | |||
4736 | |||
4737 | |||
4738 | |||
742 | Rus | 4739 | |
1 | ha | 4740 | |
742 | Rus | 4741 | mov ebx, ecx |
4742 | mov ecx, edx |
||
4743 | mov edx, [TASK_BASE] |
||
4744 | add eax, [edx-twdw+WDATA.box.left] |
||
4745 | add ebx, [edx-twdw+WDATA.box.top] |
||
4746 | mov edi, [current_slot] |
||
4747 | add eax, [edi+APPDATA.wnd_clientbox.left] |
||
4748 | add ebx, [edi+APPDATA.wnd_clientbox.top] |
||
4749 | xor edi, edi ; no force |
||
4750 | ; mov edi, 1 |
||
684 | diamond | 4751 | call [disable_mouse] |
742 | Rus | 4752 | jmp [putpixel] |
4753 | |||
1 | ha | 4754 | |
4755 | |||
4756 | |||
742 | Rus | 4757 | |
1 | ha | 4758 | |
742 | Rus | 4759 | mov ebp,[eax-twdw+WDATA.box.left] |
4760 | push esi |
||
4761 | mov esi,[current_slot] |
||
4762 | add ebp,[esi+APPDATA.wnd_clientbox.left] |
||
4763 | shl ebp,16 |
||
4764 | add ebp,[eax-twdw+WDATA.box.top] |
||
4765 | add bp,word[esi+APPDATA.wnd_clientbox.top] |
||
4766 | pop esi |
||
4767 | add ebx,ebp |
||
4768 | mov eax,edi |
||
4769 | xor edi,edi |
||
4770 | jmp dtext |
||
4771 | |||
1 | ha | 4772 | |
4773 | |||
4774 | |||
742 | Rus | 4775 | |
1 | ha | 4776 | |
742 | Rus | 4777 | mov ebx, ecx |
4778 | mov ecx, edx |
||
4779 | mov edx, esi |
||
4780 | mov esi, 12 |
||
4781 | call fileread |
||
4782 | mov [esp+32], eax |
||
4783 | ret |
||
4784 | |||
1 | ha | 4785 | |
4786 | |||
4787 | |||
742 | Rus | 4788 | |
1 | ha | 4789 | |
671 | Ghost | 4790 | and edi, 0x80FFFFFF |
4791 | test bx, bx ; x.size |
||
4792 | je .drectr |
||
4793 | test cx, cx ; y.size |
||
4794 | je .drectr |
||
4795 | |||
1 | ha | 4796 | |
671 | Ghost | 4797 | mov ebx, ecx |
4798 | |||
1 | ha | 4799 | |
671 | Ghost | 4800 | shr eax, 16 ; eax - x.coord |
4801 | movzx edx, bx ; edx - y.size |
||
4802 | shr ebx, 16 ; ebx - y.coord |
||
4803 | mov esi, [current_slot] |
||
4804 | |||
1 | ha | 4805 | |
671 | Ghost | 4806 | add ebx, [esi + APPDATA.wnd_clientbox.top] |
4807 | add ecx, eax |
||
4808 | add edx, ebx |
||
4809 | jmp [drawbar] |
||
4810 | .drectr: |
||
4811 | ret |
||
4812 | |||
1 | ha | 4813 | |
4814 | syscall_getscreensize: ; GetScreenSize |
||
742 | Rus | 4815 | mov eax, [Screen_Max_X] |
928 | serge | 4816 | shl eax, 16 |
671 | Ghost | 4817 | mov ax, word [Screen_Max_Y] |
928 | serge | 4818 | mov [esp + 32], eax |
671 | Ghost | 4819 | ret |
4820 | |||
1 | ha | 4821 | |
671 | Ghost | 4822 | |
4823 | |||
742 | Rus | 4824 | |
1 | ha | 4825 | |
742 | Rus | 4826 | jb .audio |
4827 | jz .eject |
||
4828 | cmp eax, 5 |
||
4829 | jnz .ret |
||
4830 | .load: |
||
588 | diamond | 4831 | call .reserve |
742 | Rus | 4832 | call LoadMedium |
4833 | call .free |
||
4834 | ret |
||
4835 | .eject: |
||
588 | diamond | 4836 | call .reserve |
742 | Rus | 4837 | call clear_CD_cache |
4838 | call allow_medium_removal |
||
4839 | call EjectMedium |
||
4840 | call .free |
||
4841 | ret |
||
4842 | .audio: |
||
588 | diamond | 4843 | call sys_cd_audio |
1 | ha | 4844 | mov [esp+36],eax |
4845 | .ret: |
||
588 | diamond | 4846 | ret |
1 | ha | 4847 | |
4848 | |||
588 | diamond | 4849 | call reserve_cd |
742 | Rus | 4850 | mov eax, ebx |
4851 | shr eax, 1 |
||
4852 | and eax, 1 |
||
4853 | inc eax |
||
4854 | mov [ChannelNumber], ax |
||
4855 | mov eax, ebx |
||
4856 | and eax, 1 |
||
4857 | mov [DiskNumber], al |
||
4858 | call reserve_cd_channel |
||
4859 | and ebx, 3 |
||
4860 | inc ebx |
||
4861 | mov [cdpos], ebx |
||
4862 | add ebx, ebx |
||
4863 | mov cl, 8 |
||
4864 | sub cl, bl |
||
4865 | mov al, [DRIVE_DATA+1] |
||
4866 | shr al, cl |
||
4867 | test al, 2 |
||
4868 | jz .err |
||
4869 | ret |
||
4870 | .free: |
||
588 | diamond | 4871 | call free_cd_channel |
742 | Rus | 4872 | and [cd_status], 0 |
4873 | ret |
||
4874 | .err: |
||
590 | diamond | 4875 | call .free |
742 | Rus | 4876 | pop eax |
4877 | ret |
||
4878 | |||
588 | diamond | 4879 | |
1 | ha | 4880 | |
4881 | |||
742 | Rus | 4882 | mov ecx, [Screen_Max_X] |
753 | serge | 4883 | inc ecx |
1 | ha | 4884 | xor edx, edx |
671 | Ghost | 4885 | mov eax, ebx |
4886 | div ecx |
||
1 | ha | 4887 | mov ebx, edx |
671 | Ghost | 4888 | xchg eax, ebx |
4889 | call dword [get_pixel] ; eax - x, ebx - y |
||
928 | serge | 4890 | mov [esp + 32], ecx |
671 | Ghost | 4891 | ret |
1 | ha | 4892 | |
4893 | |||
4894 | |||
4895 | |||
4896 | |||
742 | Rus | 4897 | |
1 | ha | 4898 | |
671 | Ghost | 4899 | movzx eax, word[edi-twdw+WDATA.box.left] |
752 | Lrz | 4900 | mov ebp, eax |
4901 | mov esi, [current_slot] |
||
671 | Ghost | 4902 | add ebp, [esi+APPDATA.wnd_clientbox.left] |
4903 | add ax, word[esi+APPDATA.wnd_clientbox.left] |
||
752 | Lrz | 4904 | add ebp,ebx |
4905 | shl eax, 16 |
||
4906 | movzx ebx, word[edi-twdw+WDATA.box.top] |
||
4907 | add eax, ebp |
||
671 | Ghost | 4908 | mov ebp, ebx |
752 | Lrz | 4909 | add ebp, [esi+APPDATA.wnd_clientbox.top] |
671 | Ghost | 4910 | add bx, word[esi+APPDATA.wnd_clientbox.top] |
752 | Lrz | 4911 | add ebp, ecx |
759 | Rus | 4912 | shl ebx, 16 |
752 | Lrz | 4913 | xor edi, edi |
671 | Ghost | 4914 | add ebx, ebp |
752 | Lrz | 4915 | mov ecx, edx |
4916 | jmp [draw_line] |
||
671 | Ghost | 4917 | |
1 | ha | 4918 | |
4919 | |||
4920 | |||
742 | Rus | 4921 | |
4922 | |||
4923 | jae .err |
||
75 | diamond | 4924 | |
742 | Rus | 4925 | |
774 | Rus | 4926 | je .err |
4927 | |||
4928 | |||
742 | Rus | 4929 | mov [esp+32],eax |
4930 | |||
4931 | |||
1 | ha | 4932 | .err: |
75 | diamond | 4933 | or dword [esp+32], -1 |
742 | Rus | 4934 | ret |
75 | diamond | 4935 | |
1 | ha | 4936 | |
4937 | |||
4938 | |||
742 | Rus | 4939 | |
1 | ha | 4940 | |
4941 | mov [esp+36],eax |
||
4942 | ret |
||
4943 | |||
4944 | |||
4945 | |||
4946 | |||
742 | Rus | 4947 | |
1 | ha | 4948 | |
4949 | mov [esp+36],eax |
||
4950 | ret |
||
4951 | |||
4952 | |||
4953 | |||
4954 | |||
4955 | |||
4956 | |||
742 | Rus | 4957 | |
1 | ha | 4958 | |
4959 | ; call change_task ; between sent packet |
||
4960 | |||
4961 | |||
4962 | ret |
||
4963 | |||
4964 | |||
4965 | |||
4966 | |||
742 | Rus | 4967 | call app_socket_handler |
1 | ha | 4968 | |
4969 | |||
4970 | ; call change_task ; between sent packet |
||
4971 | |||
4972 | |||
4973 | mov [esp+24],ebx |
||
4974 | ret |
||
4975 | |||
4976 | |||
4977 | |||
4978 | |||
742 | Rus | 4979 | |
1 | ha | 4980 | |
379 | serge | 4981 | add edi,TASKDATA.mem_start |
115 | poddubny | 4982 | add eax,[edi] |
1 | ha | 4983 | add ecx,[edi] |
4984 | add edx,[edi] |
||
4985 | call file_read |
||
4986 | |||
4987 | |||
4988 | mov [esp+24],ebx |
||
4989 | |||
4990 | |||
4991 | |||
4992 | |||
375 | Ghost | 4993 | ret |
742 | Rus | 4994 | |
378 | serge | 4995 | |
890 | serge | 4996 | |
757 | serge | 4997 | _SetScreen: |
890 | serge | 4998 | set_screen: |
757 | serge | 4999 | cmp eax, [Screen_Max_X] |
759 | Rus | 5000 | jne .set |
5001 | |||
709 | diamond | 5002 | |
759 | Rus | 5003 | jne .set |
5004 | ret |
||
5005 | .set: |
||
757 | serge | 5006 | pushfd |
759 | Rus | 5007 | cli |
5008 | |||
757 | serge | 5009 | |
759 | Rus | 5010 | mov [Screen_Max_Y], edx |
5011 | |||
757 | serge | 5012 | |
759 | Rus | 5013 | mov [screen_workarea.bottom], edx |
5014 | inc eax |
||
5015 | shl eax, 2 ;32 bpp |
||
5016 | mov [BytesPerScanLine], eax |
||
5017 | push ebx |
||
5018 | push esi |
||
5019 | push edi |
||
5020 | call repos_windows |
||
5021 | mov eax, 0 |
||
5022 | mov ebx, 0 |
||
5023 | mov ecx, [Screen_Max_X] |
||
5024 | mov edx, [Screen_Max_Y] |
||
5025 | call calculatescreen |
||
5026 | pop edi |
||
5027 | pop esi |
||
5028 | pop ebx |
||
5029 | |||
757 | serge | 5030 | |
759 | Rus | 5031 | ret |
5032 | |||
757 | serge | 5033 | |
76 | mario79 | 5034 | apm_entry dp 0 |
5035 | apm_vf dd 0 |
||
742 | Rus | 5036 | align 4 |
1 | ha | 5037 | sys_apm: |
76 | mario79 | 5038 | cmp word [apm_vf], 0 ; Check APM BIOS enable |
5039 | jne @f |
||
5040 | or [esp + 56], byte 1 ; error |
||
742 | Rus | 5041 | mov [esp + 36], dword 8 ; 32-bit protected-mode interface not supported |
5042 | ret |
||
76 | mario79 | 5043 | |
164 | serge | 5044 | |
465 | serge | 5045 | xchg eax, ecx |
5046 | xchg ebx, ecx |
||
76 | mario79 | 5047 | |
164 | serge | 5048 | |
76 | mario79 | 5049 | ja @f |
742 | Rus | 5050 | and [esp + 56], byte 0xfe ; emulate func 0..3 as func 0 |
78 | diamond | 5051 | mov eax, [apm_vf] |
76 | mario79 | 5052 | mov [esp + 36], eax |
5053 | shr eax, 16 |
||
5054 | mov [esp + 32], eax |
||
5055 | ret |
||
5056 | |||
78 | diamond | 5057 | |
465 | serge | 5058 | |
5059 | |||
5060 | xchg [master_tab], esi |
||
5061 | push esi |
||
5062 | mov edi, cr3 |
||
5063 | mov cr3, edi ;flush TLB |
||
742 | Rus | 5064 | |
465 | serge | 5065 | |
742 | Rus | 5066 | |
465 | serge | 5067 | |
5068 | mov [master_tab], eax |
||
5069 | mov eax, cr3 |
||
5070 | mov cr3, eax |
||
5071 | pop eax |
||
5072 | |||
5073 | |||
76 | mario79 | 5074 | mov [esp + 12], esi |
5075 | mov [esp + 24], ebx |
||
5076 | mov [esp + 28], edx |
||
5077 | mov [esp + 32], ecx |
||
5078 | mov [esp + 36], eax |
||
5079 | setc al |
||
5080 | and [esp + 56], byte 0xfe |
||
78 | diamond | 5081 | or [esp + 56], al |
742 | Rus | 5082 | |
465 | serge | 5083 | |
5084 | |||
76 | mario79 | 5085 | ; ----------------------------------------- |
5086 | |||
1 | ha | 5087 | |
76 | mario79 | 5088 | |
5089 | |||
742 | Rus | 5090 | mov [esp + 32], dword -1 |
671 | Ghost | 5091 | ret |
1 | ha | 5092 | |
5093 | |||
465 | serge | 5094 | system_shutdown: ; shut down the system |
742 | Rus | 5095 | |
1 | ha | 5096 | |
742 | Rus | 5097 | jne @F |
5098 | ret |
||
5099 | @@: |
||
465 | serge | 5100 | call stop_all_services |
742 | Rus | 5101 | push 3 ; stop playing cd |
5102 | pop eax |
||
5103 | call sys_cd_audio |
||
5104 | |||
1 | ha | 5105 | |
465 | serge | 5106 | |
863 | serge | 5107 | |
742 | Rus | 5108 | |
1 | ha | 5109 | |
863 | serge | 5110 | je _sys_reboot |
5111 | |||
1 | ha | 5112 | |
863 | serge | 5113 | je _sys_restart |
5114 | |||
1 | ha | 5115 | |
863 | serge | 5116 | mov esi, BOOT_VAR ; restore 0x0 - 0xffff |
855 | serge | 5117 | mov edi, OS_BASE |
847 | serge | 5118 | mov ecx,0x10000/4 |
5119 | rep movsd |
||
5120 | |||
1 | ha | 5121 | |
863 | serge | 5122 | mov ecx, _16bit_end |
5123 | shr ecx, 2 |
||
5124 | mov edi, _16BIT_BASE + OS_BASE |
||
5125 | rep movsd |
||
5126 | |||
1 | ha | 5127 | |
863 | serge | 5128 | mov eax, _sys_pdbr + (0x100000000-OS_BASE) |
5129 | mov cr3, eax |
||
5130 | |||
1 | ha | 5131 | |
928 | serge | 5132 | |
1 | ha | 5133 | |
928 | serge | 5134 | |
1 | ha | 5135 | |
863 | serge | 5136 | |
709 | diamond | 5137 | |
928 | serge | 5138 | mov dx, sel_app_data |
5139 | mov ss, ax |
||
5140 | mov esp, __os_stack |
||
863 | serge | 5141 | |
1 | ha | 5142 | |
863 | serge | 5143 | mov es, dx |
5144 | mov fs, dx |
||
5145 | mov gs, dx |
||
5146 | |||
1 | ha | 5147 | |
863 | serge | 5148 | |
709 | diamond | 5149 | |
863 | serge | 5150 | mov esi, BOOT_VAR ; restore 0x0 - 0xffff |
5151 | mov edi, OS_BASE |
||
5152 | mov ecx,0x10000/4 |
||
5153 | rep movsd |
||
5154 | |||
709 | diamond | 5155 | |
928 | serge | 5156 | mov [_pg_balloc], eax |
863 | serge | 5157 | |
709 | diamond | 5158 | |
863 | serge | 5159 | mov eax, _sys_pdbr + (0x100000000-OS_BASE) |
5160 | mov cr3, eax |
||
5161 | |||
5162 | |||
5163 | mov edi, cur_saved_data |
||
5164 | sub edi, OS_BASE |
||
5165 | sub ecx, edi |
||
5166 | shr ecx, 2 |
||
5167 | xor eax, eax |
||
5168 | rep stosd |
||
5169 | |||
5170 | |||
5171 | |||
5172 | |||
5173 | |||
5174 | |||
5175 | mov word [OS_BASE+0x467+0],0xFFF0 |
||
5176 | mov word [OS_BASE+0x467+2],0xF000 |
||
5177 | |||
5178 | |||
742 | Rus | 5179 | out 0x70,al |
5180 | mov al,0x05 |
||
5181 | out 0x71,al |
||
5182 | |||
709 | diamond | 5183 | |
742 | Rus | 5184 | out 0x64,al |
5185 | |||
709 | diamond | 5186 | |
742 | Rus | 5187 | |
709 | diamond | 5188 | |
465 | serge | 5189 | |
1 | ha | 5190 | |
465 | serge | 5191 | |
1 | ha | 5192 | |
849 | serge | 5193 | ;diff16 "end of kernel code",0,$=> |
5194 |