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