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