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