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