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