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