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