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