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