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