Subversion Repositories Kolibri OS

Rev

Rev 2305 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2305 Rev 2382
Line 1... Line 1...
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;
2
;;
3
;; Copyright (C) KolibriOS team 2004-2010. All rights reserved.
3
;; Copyright (C) KolibriOS team 2004-2011. All rights reserved.
4
;; PROGRAMMING:
4
;; PROGRAMMING:
5
;; Ivan Poddubny
5
;; Ivan Poddubny
6
;; Marat Zakiyanov (Mario79)
6
;; Marat Zakiyanov (Mario79)
7
;; VaStaNi
7
;; VaStaNi
8
;; Trans
8
;; Trans
Line 17... Line 17...
17
;; Sergey Semyonov (Serge)
17
;; Sergey Semyonov (Serge)
18
;; Johnny_B
18
;; Johnny_B
19
;; SPraid (simba)
19
;; SPraid (simba)
20
;; Hidnplayr
20
;; Hidnplayr
21
;; Alexey Teplov ()
21
;; Alexey Teplov ()
-
 
22
;; Rus
-
 
23
;; Nable
-
 
24
;; shurf
-
 
25
;; Alver
-
 
26
;; Maxis
-
 
27
;; Galkov
-
 
28
;; CleverMouse
-
 
29
;; tsdima
-
 
30
;; turbanoff
-
 
31
;; Asper
-
 
32
;; art_zh
22
;;
33
;;
23
;; Data in this file was originally part of MenuetOS project which is
34
;; Data in this file was originally part of MenuetOS project which is
24
;; distributed under the terms of GNU GPL. It is modified and redistributed as
35
;; distributed under the terms of GNU GPL. It is modified and redistributed as
25
;; part of KolibriOS project under the terms of GNU GPL.
36
;; part of KolibriOS project under the terms of GNU GPL.
26
;;
37
;;
Line 56... Line 67...
56
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
67
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 57... Line 68...
57
 
68
 
58
include 'macros.inc'
69
include 'macros.inc'
Line 59... Line 70...
59
include 'struct.inc'
70
include 'struct.inc'
Line 60... Line 71...
60
 
71
 
Line 61... Line 72...
61
$Revision: 2305 $
72
$Revision: 2382 $
62
 
73
 
Line 63... Line 74...
63
 
74
 
64
USE_COM_IRQ	equ 1	   ; make irq 3 and irq 4 available for PCI devices
75
USE_COM_IRQ     equ 1      ; make irq 3 and irq 4 available for PCI devices
65
 
76
 
Line 66... Line 77...
66
; Enabling the next line will enable serial output console
77
; Enabling the next line will enable serial output console
67
debug_com_base	equ 0x3f8  ; 0x3f8 is com1, 0x2f8 is com2, 0x3e8 is com3, 0x2e8 is com4, no irq's are used
78
;debug_com_base  equ 0x3f8  ; 0x3f8 is com1, 0x2f8 is com2, 0x3e8 is com3, 0x2e8 is com4, no irq's are used
68
 
79
 
Line 159... Line 170...
159
	cli				; disable all irqs
170
        cli                             ; disable all irqs
160
	cld
171
        cld
161
	mov	al,255			; mask all irqs
172
        mov     al, 255                 ; mask all irqs
162
	out	0xa1,al
173
        out     0xa1, al
163
	out	0x21,al
174
        out     0x21, al
-
 
175
   l.5:
164
   l.5: in	al, 0x64		; Enable A20
176
        in      al, 0x64                ; Enable A20
165
	test	al, 2
177
        test    al, 2
166
	jnz	l.5
178
        jnz     l.5
167
	mov	al, 0xD1
179
        mov     al, 0xD1
168
	out	0x64, al
180
        out     0x64, al
-
 
181
   l.6:
169
   l.6: in	al, 0x64
182
        in      al, 0x64
170
	test	al, 2
183
        test    al, 2
171
	jnz	l.6
184
        jnz     l.6
172
	mov	al, 0xDF
185
        mov     al, 0xDF
173
	out	0x60, al
186
        out     0x60, al
-
 
187
   l.7:
174
   l.7: in	al, 0x64
188
        in      al, 0x64
175
	test	al, 2
189
        test    al, 2
176
	jnz	l.7
190
        jnz     l.7
177
	mov	al, 0xFF
191
        mov     al, 0xFF
178
	out	0x64, al
192
        out     0x64, al
Line 214... Line 228...
214
	   mov	 ds,ax
228
        mov     ds, ax
215
	   mov	 es,ax
229
        mov     es, ax
216
	   mov	 fs,ax
230
        mov     fs, ax
217
	   mov	 gs,ax
231
        mov     gs, ax
218
	   mov	 ss,ax
232
        mov     ss, ax
219
	   mov	 esp,0x3ec00	   ; Set stack
233
        mov     esp, 0x006CC00       ; Set stack
Line 220... Line 234...
220
 
234
 
Line 221... Line 235...
221
; CLEAR 0x280000 - HEAP_BASE
235
; CLEAR 0x280000 - HEAP_BASE
222
 
236
 
223
	   xor	 eax,eax
237
        xor     eax, eax
224
	   mov	 edi,0x280000
238
        mov     edi, CLEAN_ZONE
225
	   mov	 ecx,(HEAP_BASE-OS_BASE-0x280000) / 4
239
        mov     ecx, (HEAP_BASE-OS_BASE-CLEAN_ZONE) / 4
Line 226... Line -...
226
	   cld
-
 
227
	   rep	 stosd
-
 
228
 
-
 
229
	   mov	 edi,0x40000
-
 
230
	   mov	 ecx,(0x90000-0x40000)/4
240
        cld
231
	   rep	 stosd
241
        rep stosd
-
 
242
 
232
 
243
; CLEAR KERNEL UNDEFINED GLOBALS
-
 
244
        mov     edi, endofcode-OS_BASE
233
; CLEAR KERNEL UNDEFINED GLOBALS
245
        mov     ecx, 0x90000
Line 234... Line 246...
234
	   mov	 edi, endofcode-OS_BASE
246
        sub     ecx, edi
Line 235... Line 247...
235
	   mov	 ecx, (uglobals_size/4)+4
247
        shr     ecx, 2
236
	   rep	 stosd
248
        rep stosd
237
 
249
 
238
; SAVE & CLEAR 0-0xffff
250
; SAVE & CLEAR 0-0xffff
239
 
251
 
240
	   xor	 esi, esi
252
        xor     esi, esi
241
	   mov	 edi,0x2F0000
253
        mov     edi, (BOOT_VAR-OS_BASE)
Line 242... Line 254...
242
	   mov	 ecx,0x10000 / 4
254
        mov     ecx, 0x10000 / 4
243
	   rep	 movsd
255
        rep movsd
Line -... Line 256...
-
 
256
        mov     edi, 0x1000
244
	   mov	 edi,0x1000
257
        mov     ecx, 0xf000 / 4
245
	   mov	 ecx,0xf000 / 4
258
        rep stosd
246
	   rep	 stosd
259
 
247
 
260
        call    test_cpu
248
	   call test_cpu
261
        bts     [cpu_caps-OS_BASE], CAPS_TSC    ;force use rdtsc
Line 309... Line 322...
309
	   mov dword [sys_pgdir+4], eax
322
        mov     dword [sys_pgdir+4], eax
Line 310... Line 323...
310
 
323
 
311
	   mov eax, cr3
324
        mov     eax, cr3
Line -... Line 325...
-
 
325
        mov     cr3, eax          ; flush TLB
-
 
326
 
-
 
327
        mov     ecx, pg_data.mutex
-
 
328
        call    mutex_init
-
 
329
 
-
 
330
        mov     ecx, disk_list_mutex
312
	   mov cr3, eax 	  ; flush TLB
331
        call    mutex_init
313
 
332
 
314
; SAVE REAL MODE VARIABLES
333
; SAVE REAL MODE VARIABLES
315
	mov	ax, [BOOT_VAR + 0x9031]
334
        mov     ax, [BOOT_VAR + 0x9031]
Line 549... Line 568...
549
	   call init_events
568
        call    init_events
550
	   mov eax, srv.fd-SRV_FD_OFFSET
569
        mov     eax, srv.fd-SRV_FD_OFFSET
551
	   mov [srv.fd], eax
570
        mov     [srv.fd], eax
552
	   mov [srv.bk], eax
571
        mov     [srv.bk], eax
Line 553... Line -...
553
 
-
 
554
	   mov edi, irq_tab
-
 
555
	   xor eax, eax
-
 
556
	   mov ecx, 16
-
 
557
	   rep stosd
-
 
558
 
572
 
559
;Set base of graphic segment to linear address of LFB
573
;Set base of graphic segment to linear address of LFB
560
	mov	eax,[LFBAddress]	  ; set for gs
574
        mov     eax, [LFBAddress]         ; set for gs
561
	mov	[graph_data_l+2],ax
575
        mov     [graph_data_l+2], ax
562
	shr	eax,16
576
        shr     eax, 16
Line 583... Line 597...
583
 
597
 
Line 584... Line 598...
584
	mov	[SLOT_BASE + 256 + APPDATA.dir_table], sys_pgdir - OS_BASE
598
        mov     [SLOT_BASE + 256 + APPDATA.dir_table], sys_pgdir - OS_BASE
Line 585... Line 599...
585
 
599
 
-
 
600
; REDIRECT ALL IRQ'S TO INT'S 0x20-0x2f
Line 586... Line 601...
586
; REDIRECT ALL IRQ'S TO INT'S 0x20-0x2f
601
 
587
 
602
        call    init_irqs
Line -... Line 603...
-
 
603
        call    PIC_init
588
	call  rerouteirqs
604
 
Line 589... Line -...
589
 
-
 
590
; Initialize system V86 machine
-
 
591
	call	init_sys_v86
-
 
592
 
605
; Initialize system V86 machine
593
; TIMER SET TO 1/100 S
606
        call    init_sys_v86
594
 
-
 
Line 595... Line 607...
595
	mov   al,0x34		   ; set to 100Hz
607
 
596
	out   0x43,al
608
; Initialize system timer (IRQ0)
-
 
609
        call    PIT_init
597
	mov   al,0x9b		   ; lsb    1193180 / 1193
610
 
-
 
611
; Try to Initialize APIC
598
	out   0x40,al
612
        call    APIC_init
-
 
613
 
-
 
614
; Enable timer IRQ (IRQ0) and hard drives IRQs (IRQ14, IRQ15)
-
 
615
; they are used: when partitions are scanned, hd_read relies on timer
-
 
616
        call    unmask_timer
-
 
617
        stdcall enable_irq, 2               ; @#$%! PIC
599
	mov   al,0x2e		   ; msb
618
        stdcall enable_irq, 6               ; FDD
600
	out   0x40,al
619
        stdcall enable_irq, 13              ; co-processor
601
 
620
        stdcall enable_irq, 14
602
; Enable timer IRQ (IRQ0) and hard drives IRQs (IRQ14, IRQ15)
621
        stdcall enable_irq, 15
Line 603... Line 622...
603
; they are used: when partitions are scanned, hd_read relies on timer
622
 
604
; Also enable IRQ2, because in some configurations
623
; Enable interrupts in IDE controller
605
; IRQs from slave controller are not delivered until IRQ2 on master is enabled
624
        mov     al, 0
Line 606... Line 625...
606
	mov	al, 0xFA
625
        mov     dx, 0x3F6
Line -... Line 626...
-
 
626
        out     dx, al
-
 
627
        mov     dl, 0x76
607
	out	0x21, al
628
        out     dx, al
Line 608... Line 629...
608
	mov	al, 0x3F
629
 
609
	out	0xA1, al
630
;!!!!!!!!!!!!!!!!!!!!!!!!!!
610
 
631
include 'detect/disks.inc'
-
 
632
;!!!!!!!!!!!!!!!!!!!!!!!!!!
611
;!!!!!!!!!!!!!!!!!!!!!!!!!!
633
 
612
include 'detect/disks.inc'
634
        call    Parser_params
Line 613... Line 635...
613
;!!!!!!!!!!!!!!!!!!!!!!!!!!
635
 
Line 614... Line -...
614
 
-
 
615
  call Parser_params
-
 
616
 
-
 
617
; READ RAMDISK IMAGE FROM HD
-
 
618
 
-
 
619
;!!!!!!!!!!!!!!!!!!!!!!!
-
 
620
include 'boot/rdload.inc'
636
if ~ defined extended_primary_loader
621
;!!!!!!!!!!!!!!!!!!!!!!!
637
; ramdisk image should be loaded by extended primary loader if it exists
622
;    mov    [dma_hdd],1
638
; READ RAMDISK IMAGE FROM HD
623
; CALCULATE FAT CHAIN FOR RAMDISK
639
 
624
 
640
;!!!!!!!!!!!!!!!!!!!!!!!
Line 647... Line 663...
647
	stdcall read_file, char2, FONT_II, 0, 2560
663
        stdcall read_file, char2, FONT_II, 0, 2560
Line 648... Line 664...
648
 
664
 
649
	mov   esi,boot_fonts
665
        mov     esi, boot_fonts
Line -... Line 666...
-
 
666
        call    boot_log
-
 
667
 
-
 
668
; Display APIC status
-
 
669
        mov     esi, boot_APIC_found
-
 
670
        cmp     [irq_mode], IRQ_APIC
-
 
671
        je      @f
-
 
672
        mov     esi, boot_APIC_nfound
650
	call  boot_log
673
@@:
651
 
674
 
652
; PRINT AMOUNT OF MEMORY
675
; PRINT AMOUNT OF MEMORY
Line 653... Line 676...
653
	mov	esi, boot_memdetect
676
        mov     esi, boot_memdetect
-
 
677
        call    boot_log
-
 
678
 
-
 
679
        movzx   ecx, word [boot_y]
654
	call	boot_log
680
        if lang eq ru
-
 
681
        or      ecx, (10+30*6) shl 16
655
 
682
                else
656
	movzx	ecx, word [boot_y]
683
        or      ecx, (10+29*6) shl 16
657
	or	ecx, (10+29*6) shl 16 ; "Determining amount of memory"
684
                end if
658
	sub	ecx, 10
685
        sub     ecx, 10
659
	mov	edx, 0xFFFFFF
686
        mov     edx, 0xFFFFFF
Line 691... Line 718...
691
 
718
 
692
	mov   esi,boot_resirqports
719
        mov     esi, boot_resirqports
693
	call  boot_log
720
        call    boot_log
Line 694... Line -...
694
	call  reserve_irqs_ports
-
 
695
 
-
 
696
; SET PORTS FOR IRQ HANDLERS
-
 
697
 
-
 
698
	mov  esi,boot_setrports
-
 
699
	call boot_log
-
 
700
	;call setirqreadports
721
        call    reserve_irqs_ports
Line 701... Line 722...
701
 
722
 
702
; SET UP OS TASK
723
; SET UP OS TASK
Line 777... Line 798...
777
	mov	esi, boot_cpufreq
798
        mov     esi, boot_cpufreq
778
	call	boot_log
799
        call    boot_log
Line 779... Line 800...
779
 
800
 
780
	mov	ebx, edx
801
        mov     ebx, edx
-
 
802
        movzx   ecx, word [boot_y]
-
 
803
        if lang eq ru
-
 
804
        add     ecx, (10+19*6) shl 16 - 10         ; 'Determining amount of memory'
781
	movzx	ecx, word [boot_y]
805
                else
-
 
806
        add     ecx, (10+17*6) shl 16 - 10         ; 'Determining amount of memory'
782
	add	ecx, (10+17*6) shl 16 - 10 ; 'CPU frequency is '
807
                end if
783
	mov	edx, 0xFFFFFF
808
        mov     edx, 0xFFFFFF
784
	xor	edi,edi
809
        xor     edi, edi
785
	mov	eax, 0x00040000
810
        mov     eax, 0x00040000
786
		inc		edi
811
        inc     edi
Line 787... Line 812...
787
	call	display_number_force
812
        call    display_number_force
Line 788... Line 813...
788
 
813
 
Line 789... Line -...
789
; SET VARIABLES
-
 
790
 
-
 
791
	call  set_variables
-
 
792
 
-
 
793
; SET MOUSE
-
 
794
 
-
 
795
	;call   detect_devices
-
 
796
	stdcall load_driver, szPS2MDriver
-
 
797
;        stdcall load_driver, szCOM_MDriver
-
 
798
 
-
 
799
	mov   esi,boot_setmouse
-
 
800
	call  boot_log
814
; SET VARIABLES
Line 801... Line 815...
801
	call  setmouse
815
 
802
 
816
        call    set_variables
Line 836... Line 850...
836
	   stdcall map_page,tss._io_map_0,\
850
        stdcall map_page, tss._io_map_0, \
837
		   [SLOT_BASE+256+APPDATA.io_map], PG_MAP
851
                [SLOT_BASE+256+APPDATA.io_map], PG_MAP
838
	   stdcall map_page,tss._io_map_1,\
852
        stdcall map_page, tss._io_map_1, \
839
		   [SLOT_BASE+256+APPDATA.io_map+4], PG_MAP
853
                [SLOT_BASE+256+APPDATA.io_map+4], PG_MAP
Line -... Line 854...
-
 
854
 
-
 
855
        mov     ax, [OS_BASE+0x10000+bx_from_load]
840
 
856
 
841
; LOAD FIRST APPLICATION
857
; LOAD FIRST APPLICATION
Line 842... Line 858...
842
	cli
858
        cli
843
 
859
 
844
	cmp   byte [BOOT_VAR+0x9030],1
-
 
845
	jne   no_load_vrr_m
-
 
846
 
-
 
847
	mov	ebp, vrr_m
-
 
848
	call	fs_execute_from_sysdir
-
 
849
 
-
 
850
;        cmp   eax,2                  ; if vrr_m app found (PID=2)
-
 
Line -... Line 860...
-
 
860
;        cmp   byte [BOOT_VAR+0x9030],1
-
 
861
;        jne   no_load_vrr_m
-
 
862
 
-
 
863
;        mov     ebp, vrr_m
-
 
864
;        call    fs_execute_from_sysdir
-
 
865
;
-
 
866
;;        cmp   eax,2                  ; if vrr_m app found (PID=2)
851
	sub   eax,2
867
;       sub   eax,2
Line 852... Line 868...
852
	jz    first_app_found
868
;        jz    first_app_found
853
 
869
;
Line 854... Line 870...
854
no_load_vrr_m:
870
;no_load_vrr_m:
Line 883... Line 899...
883
      @@:
899
      @@:
884
	in     al,64h
900
        in      al, 64h
885
	and    al,00000010b
901
        and     al, 00000010b
886
	loopnz @b
902
        loopnz  @b
Line 887... Line 903...
887
 
903
 
888
       ; mov   al, 0xED       ; svetodiody - only for testing!
904
       ; mov   al, 0xED       ; Keyboard LEDs - only for testing!
889
       ; call  kb_write
905
       ; call  kb_write
890
       ; call  kb_read
906
       ; call  kb_read
891
       ; mov   al, 111b
907
       ; mov   al, 111b
892
       ; call  kb_write
908
       ; call  kb_write
Line 899... Line 915...
899
	call  kb_write
915
        call    kb_write
900
;        call  kb_read
916
;        call  kb_read
901
     ;// mike.dld [
917
     ;// mike.dld [
902
	call  set_lights
918
        call    set_lights
903
     ;// mike.dld ]
919
     ;// mike.dld ]
-
 
920
        stdcall attach_int_handler, 1, irq1, 0
Line -... Line 921...
-
 
921
 
-
 
922
; SET MOUSE
-
 
923
 
-
 
924
        stdcall load_driver, szPS2MDriver
-
 
925
;        stdcall load_driver, szCOM_MDriver
-
 
926
 
-
 
927
        mov     esi, boot_setmouse
-
 
928
        call    boot_log
Line 904... Line 929...
904
 
929
        call    setmouse
Line 905... Line 930...
905
 
930
 
Line 944... Line 969...
944
 
969
 
Line 945... Line 970...
945
end if
970
end if
Line -... Line 971...
-
 
971
 
946
 
972
; START MULTITASKING
947
; START MULTITASKING
973
 
948
 
974
; A 'All set - press ESC to start' messages if need
-
 
975
if preboot_blogesc
949
if preboot_blogesc
976
        mov     esi, boot_tasking
950
	mov	esi, boot_tasking
977
        call    boot_log
951
	call	boot_log
978
.bll1:
952
.bll1:	in	al, 0x60	; wait for ESC key press
979
        in      al, 0x60        ; wait for ESC key press
Line 953... Line -...
953
	cmp	al, 129
-
 
954
	jne	.bll1
-
 
955
end if
-
 
956
 
-
 
957
;       mov   [ENABLE_TASKSWITCH],byte 1        ; multitasking enabled
-
 
958
 
-
 
959
; UNMASK ALL IRQ'S
-
 
960
 
-
 
961
	mov   esi,boot_allirqs
-
 
962
	call  boot_log
-
 
963
 
-
 
964
	cli			     ;guarantee forbidance of interrupts.
-
 
965
	mov   al,0		     ; unmask all irq's
-
 
966
	out   0xA1,al
-
 
967
	out   0x21,al
-
 
968
 
-
 
969
	mov   ecx,32
-
 
970
 
-
 
971
     ready_for_irqs:
-
 
972
 
-
 
973
	mov   al,0x20		     ; ready for irqs
-
 
974
	out   0x20,al
-
 
975
	out   0xa0,al
-
 
976
 
-
 
977
	loop  ready_for_irqs	     ; flush the queue
-
 
978
 
980
        cmp     al, 129
979
	stdcall attach_int_handler, dword 1, irq1, dword 0
981
        jne     .bll1
980
 
982
end if
Line 981... Line 983...
981
;        mov    [dma_hdd],1
983
 
982
	cmp	[IDEContrRegsBaseAddr], 0
984
        cmp     [IDEContrRegsBaseAddr], 0
Line 983... Line 985...
983
	setnz	[dma_hdd]
985
        setnz   [dma_hdd]
Line 984... Line -...
984
	mov [timer_ticks_enable],1		; for cd driver
-
 
Line 985... Line 986...
985
 
986
        mov     [timer_ticks_enable], 1         ; for cd driver
Line 986... Line 987...
986
	sti
987
 
987
	call change_task
988
        sti
Line 1021... Line 1022...
1021
;                                                                    ;
1022
;                                                                    ;
1022
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1023
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1023
align 32
1024
align 32
1024
osloop:
1025
osloop:
1025
	call   [draw_pointer]
1026
        call    [draw_pointer]
1026
	call   check_buttons
1027
        call    window_check_events
1027
	call   checkwindows
-
 
1028
;       call   check_window_move_request
1028
        call    mouse_check_events
1029
	call   checkmisc
1029
        call    checkmisc
1030
	call   checkVga_N13
1030
        call    checkVga_N13
1031
	call   stack_handler
1031
        call    stack_handler
1032
	call   checkidle
1032
        call    checkidle
1033
	call   check_fdd_motor_status
1033
        call    check_fdd_motor_status
1034
	call   check_ATAPI_device_event
1034
        call    check_ATAPI_device_event
-
 
1035
        call    check_timers
1035
	jmp    osloop
1036
        jmp     osloop
1036
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1037
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1037
;                                                                    ;
1038
;                                                                    ;
1038
;                      MAIN OS LOOP END                              ;
1039
;                      MAIN OS LOOP END                              ;
1039
;                                                                    ;
1040
;                                                                    ;
Line 1087... Line 1088...
1087
;                                                                      ;
1088
;                                                                      ;
1088
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1089
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 1089... Line 1090...
1089
 
1090
 
Line 1090... Line -...
1090
reserve_irqs_ports:
-
 
1091
 
-
 
1092
	push eax
-
 
1093
	xor	eax,eax
-
 
1094
		inc	eax
-
 
1095
	mov  byte [irq_owner+4*0],al		;1    ; timer
-
 
1096
	;mov  [irq_owner+4*1], 1    ; keyboard
-
 
1097
	mov  byte [irq_owner+4*6],al		;1    ; floppy diskette
-
 
1098
	mov  byte [irq_owner+4*13],al	;1   ; math co-pros
-
 
1099
	mov  byte [irq_owner+4*14],al	;1   ; ide I
-
 
Line 1100... Line 1091...
1100
	mov  byte [irq_owner+4*15],al	;1   ; ide II
1091
reserve_irqs_ports:
1101
	pop  eax
-
 
1102
 
1092
 
-
 
1093
 
Line 1103... Line -...
1103
; RESERVE PORTS
-
 
1104
	push  4
-
 
1105
	pop   dword [RESERVED_PORTS]	;,edi
-
 
1106
 
-
 
1107
	push  1
-
 
1108
	pop   dword [RESERVED_PORTS+16+0]	;,dword 1
-
 
1109
	and   dword [RESERVED_PORTS+16+4],0	;,dword 0x0
1094
; RESERVE PORTS
1110
	mov   dword [RESERVED_PORTS+16+8],0x2d	;,dword 0x2d
-
 
1111
 
-
 
1112
	push  1
-
 
1113
	pop   dword [RESERVED_PORTS+32+0]	;,dword 1
-
 
1114
	push  0x30
-
 
1115
	pop   dword [RESERVED_PORTS+32+4]	;,dword 0x30
-
 
1116
	push  0x4d
-
 
1117
	pop   dword [RESERVED_PORTS+32+8]	;,dword 0x4d
-
 
1118
 
-
 
1119
	push  1
-
 
1120
	pop   dword [RESERVED_PORTS+48+0]	;,dword 1
-
 
1121
	push  0x50
-
 
1122
	pop   dword [RESERVED_PORTS+48+4]	;,dword 0x50
-
 
Line -... Line 1095...
-
 
1095
        mov     eax, RESERVED_PORTS
-
 
1096
        mov     ecx, 1
-
 
1097
 
-
 
1098
        mov     [eax], dword 4
-
 
1099
 
-
 
1100
        mov     [eax+16], ecx
-
 
1101
        mov     [eax+16+4], dword 0
-
 
1102
        mov     [eax+16+4], dword 0x2D
-
 
1103
 
-
 
1104
        mov     [eax+32], ecx
-
 
1105
        mov     [eax+32+4], dword 0x30
-
 
1106
        mov     [eax+32+8], dword 0x4D
-
 
1107
 
1123
	mov   dword [RESERVED_PORTS+48+8],0xdf	;,dword 0xdf
1108
        mov     [eax+48], ecx
1124
 
1109
        mov     [eax+48+4], dword 0x50
Line 1125... Line 1110...
1125
	push  1
1110
        mov     [eax+28+8], dword 0xDF
Line 1126... Line -...
1126
	pop   dword [RESERVED_PORTS+64+0]	;,dword 1
-
 
1127
 
-
 
1128
	mov   dword [RESERVED_PORTS+64+4],0xe5	;,dword 0xe5
-
 
1129
	mov   dword [RESERVED_PORTS+64+8],0xff	;,dword 0xff
-
 
1130
 
-
 
1131
	ret
-
 
1132
 
-
 
1133
setirqreadports:
-
 
1134
 
-
 
1135
	mov   [irq12read+0],dword 0x60 + 0x01000000  ; read port 0x60 , byte
-
 
1136
	    and   dword [irq12read+4],0 		  ; end of port list
-
 
Line 1137... Line 1111...
1137
;        mov   [irq12read+4],dword 0                  ; end of port list
1111
 
1138
	;mov   [irq04read+0],dword 0x3f8 + 0x01000000 ; read port 0x3f8 , byte
1112
        mov     [eax+64], ecx
1139
	;mov   [irq04read+4],dword 0                  ; end of port list
1113
        mov     [eax+64+4], dword 0xE5
Line 1140... Line 1114...
1140
	;mov   [irq03read+0],dword 0x2f8 + 0x01000000 ; read port 0x2f8 , byte
1114
        mov     [eax+64+8], dword 0xFF
Line 1141... Line 1115...
1141
	;mov   [irq03read+4],dword 0                  ; end of port list
1115
 
-
 
1116
        ret
1142
 
1117
 
1143
	ret
1118
 
1144
 
1119
iglobal
Line 1145... Line 1120...
1145
iglobal
1120
  process_number dd 0x1
1146
  process_number dd 0x1
1121
endg
Line 1615... Line 1590...
1615
	ret
1590
        ret
Line 1616... Line 1591...
1616
 
1591
 
1617
no_set_lba_read:
1592
no_set_lba_read:
1618
;     cmp  eax,12                     ; ENABLE PCI ACCESS
1593
;     cmp  eax,12                     ; ENABLE PCI ACCESS
1619
	dec  ebx
1594
        dec     ebx
1620
	jnz  no_set_pci_access
1595
        jnz     sys_setup_err
1621
	mov  [pci_access_enabled],ecx
1596
        mov     [pci_access_enabled], ecx
1622
	ret
-
 
1623
no_set_pci_access:
-
 
1624
 
-
 
1625
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
 
1626
include 'vmodeint.inc'
-
 
Line 1627... Line 1597...
1627
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1597
        ret
1628
 
1598
 
1629
sys_setup_err:
1599
sys_setup_err:
Line 1952... Line 1922...
1952
     jmp   waitterm
1922
        jmp     waitterm
Line 1953... Line 1923...
1953
 
1923
 
1954
iglobal
1924
iglobal
1955
align 4
1925
align 4
1956
sys_system_table:
1926
sys_system_table:
1957
	dd	exit_for_anyone 	; 1 = obsolete
1927
        dd      sysfn_deactivate        ; 1 = deactivate window
1958
	dd	sysfn_terminate 	; 2 = terminate thread
1928
        dd      sysfn_terminate         ; 2 = terminate thread
1959
	dd	sysfn_activate		; 3 = activate window
1929
        dd      sysfn_activate          ; 3 = activate window
1960
	dd	sysfn_getidletime	; 4 = get idle time
1930
        dd      sysfn_getidletime       ; 4 = get idle time
1961
	dd	sysfn_getcpuclock	; 5 = get cpu clock
1931
        dd      sysfn_getcpuclock       ; 5 = get cpu clock
Line 1977... Line 1947...
1977
	dd	sysfn_meminfo		; 20 = get extended memory info
1947
        dd      sysfn_meminfo           ; 20 = get extended memory info
1978
	dd	sysfn_pid_to_slot	; 21 = get slot number for pid
1948
        dd      sysfn_pid_to_slot       ; 21 = get slot number for pid
1979
	dd	sysfn_min_rest_window	; 22 = minimize and restore any window
1949
        dd      sysfn_min_rest_window   ; 22 = minimize and restore any window
1980
sysfn_num = ($ - sys_system_table)/4
1950
sysfn_num = ($ - sys_system_table)/4
1981
endg
1951
endg
1982
 
-
 
-
 
1952
;------------------------------------------------------------------------------
1983
sys_system:
1953
sys_system:
1984
	dec	ebx
1954
        dec     ebx
1985
	cmp	ebx, sysfn_num
1955
        cmp     ebx, sysfn_num
1986
	jae	@f
1956
        jae     @f
1987
	jmp	dword [sys_system_table + ebx*4]
1957
        jmp     dword [sys_system_table + ebx*4]
1988
@@:
1958
@@:
1989
	ret
1959
        ret
1990
 
-
 
1991
 
-
 
-
 
1960
;------------------------------------------------------------------------------
1992
sysfn_shutdown: 	 ; 18.9 = system shutdown
1961
sysfn_shutdown:          ; 18.9 = system shutdown
1993
     cmp  ecx,1
1962
        cmp     ecx, 1
1994
     jl   exit_for_anyone
1963
        jl      exit_for_anyone
1995
     cmp  ecx,4
1964
        cmp     ecx, 4
1996
     jg   exit_for_anyone
1965
        jg      exit_for_anyone
Line 2001... Line 1970...
2001
     mov  [shutdown_processes],eax
1970
        mov     [shutdown_processes], eax
2002
     and  dword [esp+32], 0
1971
        and     dword [esp+32], 0
2003
 exit_for_anyone:
1972
 exit_for_anyone:
2004
     ret
1973
        ret
2005
  uglobal
1974
  uglobal
2006
   shutdown_processes: dd 0x0
1975
   shutdown_processes:
-
 
1976
                       dd 0x0
2007
  endg
1977
  endg
2008
 
-
 
-
 
1978
;------------------------------------------------------------------------------
2009
sysfn_terminate:	; 18.2 = TERMINATE
1979
sysfn_terminate:        ; 18.2 = TERMINATE
2010
     cmp  ecx,2
1980
        cmp     ecx, 2
2011
     jb   noprocessterminate
1981
        jb      noprocessterminate
2012
     mov  edx,[TASK_COUNT]
1982
        mov     edx, [TASK_COUNT]
2013
     cmp  ecx,edx
1983
        cmp     ecx, edx
Line 2027... Line 1997...
2027
     jne  noatsc
1997
        jne     noatsc
2028
     and  [application_table_status],0
1998
        and     [application_table_status], 0
2029
   noatsc:
1999
   noatsc:
2030
   noprocessterminate:
2000
   noprocessterminate:
2031
     ret
2001
        ret
2032
 
-
 
-
 
2002
;------------------------------------------------------------------------------
2033
sysfn_terminate2:
2003
sysfn_terminate2:
2034
;lock application_table_status mutex
2004
;lock application_table_status mutex
2035
.table_status:
2005
.table_status:
2036
    cli
2006
        cli
2037
    cmp    [application_table_status],0
2007
        cmp     [application_table_status], 0
Line 2054... Line 2024...
2054
    ret
2024
        ret
2055
.not_found:
2025
.not_found:
2056
    mov    [application_table_status],0
2026
        mov     [application_table_status], 0
2057
    or	   dword [esp+32],-1
2027
        or      dword [esp+32], -1
2058
    ret
2028
        ret
-
 
2029
;------------------------------------------------------------------------------
-
 
2030
sysfn_deactivate:         ; 18.1 = DEACTIVATE WINDOW
-
 
2031
        cmp     ecx, 2
-
 
2032
        jb      .nowindowdeactivate
-
 
2033
        cmp     ecx, [TASK_COUNT]
-
 
2034
        ja      .nowindowdeactivate
-
 
2035
        
-
 
2036
        movzx   esi, word [WIN_STACK + ecx*2]
-
 
2037
        cmp     esi, 1
-
 
2038
        je      .nowindowdeactivate ; already deactive
-
 
2039
 
-
 
2040
        mov     edi, ecx
-
 
2041
        shl     edi, 5
-
 
2042
        add     edi, window_data
-
 
2043
        movzx   esi, word [WIN_STACK + ecx * 2]
-
 
2044
        lea     esi, [WIN_POS + esi * 2]
-
 
2045
        call    window._.window_deactivate
Line -... Line 2046...
-
 
2046
        
-
 
2047
        xor     eax, eax
-
 
2048
        mov     byte[MOUSE_BACKGROUND], al
-
 
2049
        mov     byte[DONT_DRAW_MOUSE], al
-
 
2050
        mov     byte[MOUSE_DOWN], 0
-
 
2051
 
-
 
2052
        call    syscall_display_settings._.calculate_whole_screen
-
 
2053
        call    syscall_display_settings._.redraw_whole_screen
-
 
2054
.nowindowdeactivate:
-
 
2055
        ret
2059
 
2056
 ;------------------------------------------------------------------------------   
2060
sysfn_activate: 	; 18.3 = ACTIVATE WINDOW
2057
sysfn_activate:         ; 18.3 = ACTIVATE WINDOW
2061
     cmp  ecx,2
2058
        cmp     ecx, 2
2062
     jb   .nowindowactivate
2059
        jb      .nowindowactivate
2063
     cmp  ecx,[TASK_COUNT]
2060
        cmp     ecx, [TASK_COUNT]
Line 2075... Line 2072...
2075
     movzx esi, word [WIN_STACK + ecx * 2]
2072
        movzx   esi, word [WIN_STACK + ecx * 2]
2076
     lea   esi, [WIN_POS + esi * 2]
2073
        lea     esi, [WIN_POS + esi * 2]
2077
     call  waredraw
2074
        call    waredraw
2078
.nowindowactivate:
2075
.nowindowactivate:
2079
     ret
2076
        ret
2080
 
-
 
-
 
2077
;------------------------------------------------------------------------------
2081
sysfn_getidletime:		; 18.4 = GET IDLETIME
2078
sysfn_getidletime:              ; 18.4 = GET IDLETIME
2082
     mov  eax,[idleusesec]
2079
        mov     eax, [idleusesec]
2083
     mov  [esp+32], eax
2080
        mov     [esp+32], eax
2084
     ret
2081
        ret
2085
 
-
 
-
 
2082
;------------------------------------------------------------------------------
2086
sysfn_getcpuclock:		; 18.5 = GET TSC/SEC
2083
sysfn_getcpuclock:              ; 18.5 = GET TSC/SEC
2087
     mov  eax,[CPU_FREQ]
2084
        mov     eax, [CPU_FREQ]
2088
     mov  [esp+32], eax
2085
        mov     [esp+32], eax
2089
     ret
2086
        ret
2090
 
-
 
-
 
2087
;------------------------------------------------------------------------------
2091
;  SAVE ramdisk to /hd/1/menuet.img
2088
;  SAVE ramdisk to /hd/1/menuet.img
2092
;!!!!!!!!!!!!!!!!!!!!!!!!
2089
;!!!!!!!!!!!!!!!!!!!!!!!!
2093
   include 'blkdev/rdsave.inc'
2090
   include 'blkdev/rdsave.inc'
2094
;!!!!!!!!!!!!!!!!!!!!!!!!
2091
;!!!!!!!!!!!!!!!!!!!!!!!!
-
 
2092
;------------------------------------------------------------------------------
2095
align 4
2093
align 4
2096
sysfn_getactive:	; 18.7 = get active window
2094
sysfn_getactive:        ; 18.7 = get active window
2097
     mov  eax, [TASK_COUNT]
2095
        mov     eax, [TASK_COUNT]
2098
   movzx  eax, word [WIN_POS + eax*2]
2096
        movzx   eax, word [WIN_POS + eax*2]
2099
     mov  [esp+32],eax
2097
        mov     [esp+32], eax
2100
     ret
2098
        ret
2101
 
-
 
-
 
2099
;------------------------------------------------------------------------------
2102
sysfn_sound_flag:	; 18.8 = get/set sound_flag
2100
sysfn_sound_flag:       ; 18.8 = get/set sound_flag
2103
;     cmp  ecx,1
2101
;     cmp  ecx,1
2104
     dec  ecx
2102
        dec     ecx
2105
     jnz  nogetsoundflag
2103
        jnz     nogetsoundflag
2106
     movzx  eax,byte [sound_flag] ; get sound_flag
2104
        movzx   eax, byte [sound_flag]; get sound_flag
Line 2111... Line 2109...
2111
     dec  ecx
2109
        dec     ecx
2112
     jnz  nosoundflag
2110
        jnz     nosoundflag
2113
     xor  byte [sound_flag], 1
2111
        xor     byte [sound_flag], 1
2114
 nosoundflag:
2112
 nosoundflag:
2115
     ret
2113
        ret
2116
 
-
 
-
 
2114
;------------------------------------------------------------------------------
2117
sysfn_minimize: 	; 18.10 = minimize window
2115
sysfn_minimize:         ; 18.10 = minimize window
2118
     mov   [window_minimize],1
2116
        mov     [window_minimize], 1
2119
     ret
2117
        ret
-
 
2118
;------------------------------------------------------------------------------
2120
align 4
2119
align 4
2121
sysfn_getdiskinfo:	; 18.11 = get disk info table
2120
sysfn_getdiskinfo:      ; 18.11 = get disk info table
2122
;     cmp  ecx,1
2121
;     cmp  ecx,1
2123
     dec  ecx
2122
        dec     ecx
2124
     jnz  full_table
2123
        jnz     full_table
Line 2139... Line 2138...
2139
     call for_all_tables
2138
        call    for_all_tables
2140
     mov ecx,16384
2139
        mov     ecx, 16384
2141
     cld
2140
        cld
2142
     rep movsd
2141
        rep movsd
2143
     ret
2142
        ret
2144
 
-
 
-
 
2143
;------------------------------------------------------------------------------
2145
sysfn_lastkey:		; 18.12 = return 0 (backward compatibility)
2144
sysfn_lastkey:          ; 18.12 = return 0 (backward compatibility)
2146
	and	dword [esp+32], 0
2145
        and     dword [esp+32], 0
2147
	ret
2146
        ret
2148
 
-
 
-
 
2147
;------------------------------------------------------------------------------
2149
sysfn_getversion:	; 18.13 = get kernel ID and version
2148
sysfn_getversion:       ; 18.13 = get kernel ID and version
2150
     mov edi,ebx
2149
        mov     edi, ecx
2151
     mov esi,version_inf
2150
        mov     esi, version_inf
2152
     mov ecx,version_end-version_inf
2151
        mov     ecx, version_end-version_inf
2153
     rep movsb
2152
        rep movsb
2154
     ret
2153
        ret
2155
 
-
 
-
 
2154
;------------------------------------------------------------------------------
2156
sysfn_waitretrace:     ; 18.14 = sys wait retrace
2155
sysfn_waitretrace:     ; 18.14 = sys wait retrace
2157
     ;wait retrace functions
2156
     ;wait retrace functions
2158
 sys_wait_retrace:
2157
 sys_wait_retrace:
2159
     mov edx,0x3da
2158
        mov     edx, 0x3da
2160
 WaitRetrace_loop:
2159
 WaitRetrace_loop:
2161
     in al,dx
2160
        in      al, dx
2162
     test al,1000b
2161
        test    al, 1000b
2163
     jz WaitRetrace_loop
2162
        jz      WaitRetrace_loop
2164
     and [esp+32],dword 0
2163
        and     [esp+32], dword 0
2165
     ret
2164
        ret
2166
 
-
 
-
 
2165
;------------------------------------------------------------------------------
2167
align 4
2166
align 4
2168
sysfn_centermouse:	; 18.15 = mouse centered
2167
sysfn_centermouse:      ; 18.15 = mouse centered
2169
; removed here by 
2168
; removed here by 
2170
;     call  mouse_centered
2169
;     call  mouse_centered
2171
;* mouse centered - start code- Mario79
2170
;* mouse centered - start code- Mario79
Line 2180... Line 2179...
2180
;        ret
2179
;        ret
2181
;* mouse centered - end code- Mario79
2180
;* mouse centered - end code- Mario79
2182
	xor   eax,eax
2181
        xor     eax, eax
2183
	and   [esp+32],eax
2182
        and     [esp+32], eax
2184
;        pop   eax
2183
;        pop   eax
2185
 
-
 
2186
     ret
2184
        ret
-
 
2185
;------------------------------------------------------------------------------
2187
align 4
2186
align 4
2188
sysfn_mouse_acceleration: ; 18.19 = set/get mouse features
2187
sysfn_mouse_acceleration: ; 18.19 = set/get mouse features
2189
     test ecx,ecx  ; get mouse speed factor
2188
        test    ecx, ecx; get mouse speed factor
2190
     jnz  .set_mouse_acceleration
2189
        jnz     .set_mouse_acceleration
2191
     xor  eax,eax
2190
        xor     eax, eax
Line 2213... Line 2212...
2213
     ret
2212
        ret
2214
 .set_pointer_position:
2213
 .set_pointer_position:
2215
;     cmp  ecx,4  ; set mouse pointer position
2214
;     cmp  ecx,4  ; set mouse pointer position
2216
     dec   ecx
2215
        dec     ecx
2217
     jnz  .set_mouse_button
2216
        jnz     .set_mouse_button
2218
     mov   [MOUSE_Y],dx    ;y
2217
        cmp     dx, word[Screen_Max_Y]
2219
     ror   edx,16
2218
        ja      .end
2220
     mov   [MOUSE_X],dx    ;x
-
 
2221
     rol   edx,16
2219
        rol     edx, 16
-
 
2220
        cmp     dx, word[Screen_Max_X]
-
 
2221
        ja      .end
-
 
2222
        mov     [MOUSE_X], edx
2222
     ret
2223
        ret
2223
 .set_mouse_button:
2224
 .set_mouse_button:
2224
;     cmp   ecx,5  ; set mouse button features
2225
;     cmp   ecx,5  ; set mouse button features
2225
     dec   ecx
2226
        dec     ecx
2226
     jnz  .end
2227
        jnz     .end
2227
     mov   [BTN_DOWN],dl
2228
        mov     [BTN_DOWN], dl
2228
     mov   [mouse_active],1
2229
        mov     [mouse_active], 1
2229
 .end:
2230
 .end:
2230
     ret
2231
        ret
2231
 
-
 
-
 
2232
;------------------------------------------------------------------------------
2232
sysfn_getfreemem:
2233
sysfn_getfreemem:
2233
     mov eax, [pg_data.pages_free]
2234
        mov     eax, [pg_data.pages_free]
2234
     shl eax, 2
2235
        shl     eax, 2
2235
     mov [esp+32],eax
2236
        mov     [esp+32], eax
2236
     ret
2237
        ret
Line 2286... Line 2287...
2286
;// mike.dld, 2006-29-01 ]
2287
;// mike.dld, 2006-29-01 ]
2287
window_minimize db 0
2288
window_minimize db 0
2288
sound_flag	db 0
2289
sound_flag      db 0
2289
endg
2290
endg
Line -... Line 2291...
-
 
2291
 
-
 
2292
UID_NONE=0
-
 
2293
UID_MENUETOS=1   ;official
-
 
2294
UID_KOLIBRI=2    ;russian
2290
 
2295
 
2291
iglobal
2296
iglobal
2292
version_inf:
2297
version_inf:
2293
  db 0,7,7,0  ; version 0.7.7.0
2298
  db 0,7,7,0  ; version 0.7.7.0
2294
  db UID_KOLIBRI
2299
  db 0
2295
  dd __REV__
2300
  dd __REV__
2296
version_end:
2301
version_end:
Line 2297... Line -...
2297
endg
-
 
2298
 
-
 
2299
UID_NONE=0
-
 
2300
UID_MENUETOS=1	 ;official
-
 
2301
UID_KOLIBRI=2	 ;russian
2302
endg
2302
 
2303
 
2303
sys_cachetodiskette:
2304
sys_cachetodiskette:
2304
	cmp	ebx, 1
2305
        cmp     ebx, 1
2305
	jne	.no_floppy_a_save
2306
        jne     .no_floppy_a_save
Line 2423... Line 2424...
2423
;    cmp   [bgrchanged],1 ;0
2424
;    cmp   [bgrchanged],1 ;0
2424
;    je    nosb31
2425
;    je    nosb31
2425
;draw_background_temp:
2426
;draw_background_temp:
2426
;    mov   [bgrchanged],1 ;0
2427
;    mov   [bgrchanged],1 ;0
2427
    mov    [background_defined], 1
2428
        mov     [background_defined], 1
-
 
2429
        mov     byte[BACKGROUND_CHANGED], 1
2428
    call  force_redraw_background
2430
        call    force_redraw_background
2429
    mov    [REDRAW_BACKGROUND], byte 2
-
 
2430
   nosb31:
2431
   nosb31:
2431
    ret
2432
        ret
2432
  nosb3:
2433
  nosb3:
Line 2433... Line 2434...
2433
 
2434
 
Line 2544... Line 2545...
2544
 
2545
 
2545
nosb7:
2546
nosb7:
Line 2546... Line 2547...
2546
    ret
2547
        ret
2547
 
2548
 
2548
force_redraw_background:
2549
force_redraw_background:
2549
    and   [draw_data+32 + RECT.left],dword 0
2550
        and     [draw_data+32 + RECT.left], 0
2550
    and   [draw_data+32 + RECT.top],dword 0
2551
        and     [draw_data+32 + RECT.top], 0
2551
    push  eax ebx
2552
        push    eax ebx
2552
    mov   eax,[Screen_Max_X]
2553
        mov     eax, [Screen_Max_X]
2553
    mov   ebx,[Screen_Max_Y]
2554
        mov     ebx, [Screen_Max_Y]
2554
    mov   [draw_data+32 + RECT.right],eax
2555
        mov     [draw_data+32 + RECT.right], eax
2555
    mov   [draw_data+32 + RECT.bottom],ebx
2556
        mov     [draw_data+32 + RECT.bottom], ebx
2556
    pop   ebx eax
2557
        pop     ebx eax
Line 2557... Line 2558...
2557
    mov   byte [REDRAW_BACKGROUND], 1
2558
        inc     byte[REDRAW_BACKGROUND]
Line 2558... Line 2559...
2558
    ret
2559
        ret
Line 2661... Line 2662...
2661
	jne	.exit
2662
        jne     .exit
2662
	movzx	eax, byte [BTN_COUNT]
2663
        movzx   eax, byte [BTN_COUNT]
2663
	test	eax, eax
2664
        test    eax, eax
2664
	jz	.exit
2665
        jz      .exit
2665
	mov	eax, [BTN_BUFF]
2666
        mov     eax, [BTN_BUFF]
2666
	shl	eax, 8
-
 
2667
; // Alver 22.06.2008 // {
-
 
2668
	mov	  al, byte [btn_down_determ]
-
 
2669
	and	  al,0xFE					; delete left button bit
2667
        and     al, 0xFE                                    ; delete left button bit
2670
; } \\ Alver \\
-
 
2671
	mov	[BTN_COUNT], byte 0
2668
        mov     [BTN_COUNT], byte 0
2672
	mov	[esp + 32], eax
2669
        mov     [esp + 32], eax
2673
.exit:
2670
.exit:
2674
	ret
2671
        ret
Line 2757... Line 2754...
2757
 
2754
 
2758
    ; Window state
2755
    ; Window state
2759
	mov	al, [ecx+window_data+WDATA.fl_wstate]
2756
        mov     al, [ecx+window_data+WDATA.fl_wstate]
Line -... Line 2757...
-
 
2757
        stosb
-
 
2758
 
-
 
2759
    ; Event mask (+71)
-
 
2760
        mov     EAX, dword [ECX+CURRENT_TASK+TASKDATA.event_mask]
2760
	stosb
2761
        stosd
2761
 
2762
 
Line 2762... Line 2763...
2762
	pop	esi
2763
        pop     esi
2763
	pop	edi
2764
        pop     edi
Line 2771... Line 2772...
2771
 
2772
 
2772
align 4
2773
align 4
2773
sys_clock:
2774
sys_clock:
2774
	cli
2775
        cli
-
 
2776
  ; Mikhail Lisovin  xx Jan 2005
2775
  ; Mikhail Lisovin  xx Jan 2005
2777
  @@:
2776
  @@:	mov   al, 10
2778
        mov     al, 10
2777
	out   0x70, al
2779
        out     0x70, al
2778
	in    al, 0x71
2780
        in      al, 0x71
2779
	test  al, al
2781
        test    al, al
2780
	jns   @f
2782
        jns     @f
Line 2808... Line 2810...
2808
align 4
2810
align 4
Line 2809... Line 2811...
2809
 
2811
 
Line 2810... Line 2812...
2810
sys_date:
2812
sys_date:
-
 
2813
 
2811
 
2814
        cli
2812
	cli
2815
  @@:
2813
  @@:	mov   al, 10
2816
        mov     al, 10
2814
	out   0x70, al
2817
        out     0x70, al
2815
	in    al, 0x71
2818
        in      al, 0x71
2816
	test  al, al
2819
        test    al, al
Line 2889... Line 2892...
2889
	mov	eax, [Screen_Max_X]
2892
        mov     eax, [Screen_Max_X]
2890
	mov	[edx + RECT.right], eax
2893
        mov     [edx + RECT.right], eax
2891
	mov	eax, [Screen_Max_Y]
2894
        mov     eax, [Screen_Max_Y]
2892
	mov	[edx + RECT.bottom], eax
2895
        mov     [edx + RECT.bottom], eax
Line 2893... Line -...
2893
 
-
 
2894
	mov	edi, [TASK_BASE]
-
 
2895
	or	[edi - twdw + WDATA.fl_wdrawn], 1   ; no new position & buttons from app
-
 
2896
	call	sys_window_mouse
-
 
2897
	ret
-
 
2898
 
2896
 
2899
  srl1:
2897
  srl1:
Line 2900... Line -...
2900
	ret
-
 
2901
 
-
 
2902
 
-
 
2903
sys_drawwindow:
-
 
2904
 
-
 
2905
    mov   eax,edx
-
 
2906
    shr   eax,16+8
-
 
2907
    and   eax,15
-
 
2908
 
-
 
2909
;    cmp   eax,0   ; type I    - original style
-
 
2910
    jne   nosyswI
-
 
2911
    inc   [mouse_pause]
-
 
2912
    call  [_display.disable_mouse]
-
 
2913
    call  sys_set_window
-
 
2914
    call  [_display.disable_mouse]
-
 
2915
    call  drawwindow_I
-
 
2916
    ;dec   [mouse_pause]
-
 
2917
    ;call   [draw_pointer]
-
 
2918
    ;ret
-
 
2919
    jmp   draw_window_caption.2
-
 
2920
  nosyswI:
-
 
2921
 
-
 
2922
    cmp   al,1	  ; type II   - only reserve area, no draw
-
 
2923
    jne   nosyswII
-
 
2924
    inc   [mouse_pause]
-
 
2925
    call  [_display.disable_mouse]
-
 
2926
    call  sys_set_window
-
 
2927
    call  [_display.disable_mouse]
-
 
2928
    call  sys_window_mouse
-
 
2929
    dec   [mouse_pause]
-
 
2930
    call   [draw_pointer]
-
 
2931
    ret
-
 
2932
  nosyswII:
-
 
2933
 
-
 
2934
    cmp   al,2	  ; type III  - new style
-
 
2935
    jne   nosyswIII
-
 
2936
    inc   [mouse_pause]
-
 
2937
    call  [_display.disable_mouse]
-
 
2938
    call  sys_set_window
-
 
2939
    call  [_display.disable_mouse]
-
 
2940
    call  drawwindow_III
-
 
2941
    ;dec   [mouse_pause]
-
 
2942
    ;call   [draw_pointer]
-
 
2943
    ;ret
-
 
2944
    jmp   draw_window_caption.2
-
 
2945
  nosyswIII:
-
 
2946
 
-
 
2947
    cmp   al,3	  ; type IV - skinned window
-
 
2948
    je	  draw_skin_window
-
 
2949
    cmp   al,4	  ; type V - skinned window not sized! {not_sized_skin_window}
-
 
2950
    jne   nosyswV
-
 
2951
  draw_skin_window:
-
 
2952
 
-
 
2953
    inc   [mouse_pause]
-
 
2954
    call  [_display.disable_mouse]
-
 
2955
    call  sys_set_window
-
 
2956
    call  [_display.disable_mouse]
-
 
2957
    mov   eax, [TASK_COUNT]
-
 
2958
    movzx eax, word [WIN_POS + eax*2]
-
 
2959
    cmp   eax, [CURRENT_TASK]
-
 
2960
    setz  al
-
 
2961
    movzx eax, al
-
 
2962
    push  eax
-
 
2963
    call  drawwindow_IV
-
 
2964
    ;dec   [mouse_pause]
-
 
2965
    ;call   [draw_pointer]
-
 
2966
    ;ret
-
 
2967
    jmp   draw_window_caption.2
-
 
2968
  nosyswV:
-
 
2969
 
-
 
2970
    ret
-
 
2971
 
-
 
2972
 
-
 
2973
draw_window_caption:
-
 
2974
	inc	[mouse_pause]
-
 
2975
	call	[_display.disable_mouse]
-
 
2976
 
-
 
2977
	xor	eax,eax
-
 
2978
	mov	edx,[TASK_COUNT]
-
 
2979
	movzx	edx,word[WIN_POS+edx*2]
-
 
2980
	cmp	edx,[CURRENT_TASK]
-
 
2981
	jne	@f
-
 
2982
	inc	eax
-
 
2983
    @@: mov	edx,[CURRENT_TASK]
-
 
2984
	shl	edx,5
-
 
2985
	add	edx,window_data
-
 
2986
	movzx	ebx,[edx+WDATA.fl_wstyle]
-
 
2987
	and	bl,0x0F
-
 
2988
	cmp	bl,3
-
 
2989
	je	.draw_caption_style_3		;{for 3 and 4 style write caption}
-
 
2990
	cmp	bl,4
-
 
2991
	je	.draw_caption_style_3
-
 
2992
 
-
 
2993
	jmp	.not_style_3
-
 
2994
  .draw_caption_style_3:
-
 
2995
 
-
 
2996
	push	edx
-
 
2997
	call	drawwindow_IV_caption
-
 
2998
	add	esp,4
-
 
2999
	jmp	.2
-
 
3000
 
-
 
3001
  .not_style_3:
-
 
3002
	cmp	bl,2
-
 
3003
	jne	.not_style_2
-
 
3004
 
-
 
3005
	call	drawwindow_III_caption
-
 
3006
	jmp	.2
-
 
3007
 
-
 
3008
  .not_style_2:
-
 
3009
	cmp	bl,0
-
 
3010
	jne	.2
-
 
3011
 
-
 
3012
	call	drawwindow_I_caption
-
 
3013
 
-
 
3014
;--------------------------------------------------------------
-
 
3015
  .2:	;jmp     @f
-
 
3016
	mov	edi,[CURRENT_TASK]
-
 
3017
	shl	edi,5
-
 
3018
	test	[edi+window_data+WDATA.fl_wstyle],WSTYLE_HASCAPTION
-
 
3019
	jz	@f
-
 
3020
	mov	edx,[edi*8+SLOT_BASE+APPDATA.wnd_caption]
-
 
3021
	or	edx,edx
-
 
3022
	jz	@f
-
 
3023
 
-
 
3024
	movzx	eax,[edi+window_data+WDATA.fl_wstyle]
-
 
3025
	and	al,0x0F
-
 
3026
	cmp	al,3
-
 
3027
	je	.skinned
-
 
3028
	cmp	al,4
-
 
3029
	je	.skinned
-
 
3030
 
-
 
3031
	jmp	.not_skinned
-
 
3032
  .skinned:
-
 
3033
	mov	ebp,[edi+window_data+WDATA.box.left-2]
-
 
3034
	mov	bp,word[edi+window_data+WDATA.box.top]
-
 
3035
	movzx	eax,word[edi+window_data+WDATA.box.width]
-
 
3036
	sub	ax,[_skinmargins.left]
-
 
3037
	sub	ax,[_skinmargins.right]
-
 
3038
	push	edx
-
 
3039
	cwde
-
 
3040
	cdq
-
 
3041
	mov	ebx,6
-
 
3042
	idiv	ebx
-
 
3043
	pop	edx
-
 
3044
	or	eax,eax
-
 
3045
	js	@f
-
 
3046
	mov	esi,eax
-
 
3047
	mov	ebx,dword[_skinmargins.left-2]
-
 
3048
	mov	bx,word[_skinh]
-
 
3049
	sub	bx,[_skinmargins.bottom]
-
 
3050
	sub	bx,[_skinmargins.top]
-
 
3051
	sar	bx,1
-
 
3052
	adc	bx,0
-
 
3053
	add	bx,[_skinmargins.top]
-
 
3054
	add	bx,-3
-
 
3055
	add	ebx,ebp
-
 
3056
	jmp	.dodraw
-
 
3057
 
-
 
3058
  .not_skinned:
-
 
3059
	cmp	al,1
-
 
3060
	je	@f
-
 
3061
 
-
 
3062
	mov	ebp,[edi+window_data+WDATA.box.left-2]
-
 
3063
	mov	bp,word[edi+window_data+WDATA.box.top]
-
 
3064
	movzx	eax,word[edi+window_data+WDATA.box.width]
-
 
3065
	sub	eax,16
-
 
3066
	push	edx
-
 
3067
	cwde
-
 
3068
	cdq
-
 
3069
	mov	ebx,6
-
 
3070
	idiv	ebx
-
 
3071
	pop	edx
-
 
3072
	or	eax,eax
-
 
3073
	js	@f
-
 
3074
	mov	esi,eax
-
 
3075
	mov	ebx,0x00080007
-
 
3076
	add	ebx,ebp
-
 
3077
.dodraw:
-
 
3078
	mov	ecx,[common_colours+16];0x00FFFFFF
-
 
3079
	or	ecx, 0x80000000
-
 
3080
	xor	edi,edi
-
 
3081
; // Alver 22.06.2008 // {
-
 
3082
;       call    dtext
-
 
3083
	call dtext_asciiz_esi
-
 
3084
; } \\ Alver \\
-
 
3085
 
-
 
3086
    @@:
-
 
3087
;--------------------------------------------------------------
-
 
3088
	dec	[mouse_pause]
-
 
3089
	call	[draw_pointer]
-
 
3090
	ret
-
 
3091
 
-
 
3092
iglobal
-
 
3093
align 4
-
 
3094
window_topleft dd \
-
 
3095
  1, 21,\		;type 0
-
 
3096
  0,  0,\	;type 1
-
 
3097
  5, 20,\	;type 2
-
 
3098
  5,  ?,\	;type 3 {set by skin}
-
 
3099
  5,  ? 	;type 4 {set by skin}
-
 
3100
endg
-
 
3101
 
-
 
3102
set_window_clientbox:
-
 
3103
	push	eax ecx edi
-
 
3104
 
-
 
3105
	mov	eax,[_skinh]
-
 
3106
	mov	[window_topleft+4*7],eax
-
 
3107
	mov	[window_topleft+4*9],eax
-
 
3108
 
-
 
3109
	mov	ecx,edi
-
 
3110
	sub	edi,window_data
-
 
3111
	shl	edi,3
-
 
3112
	test	[ecx+WDATA.fl_wstyle],WSTYLE_CLIENTRELATIVE
-
 
3113
	jz	@f
-
 
3114
 
-
 
3115
	movzx	eax,[ecx+WDATA.fl_wstyle]
-
 
3116
	and	eax,0x0F
-
 
3117
	mov	eax,[eax*8+window_topleft+0]
-
 
3118
	mov	[edi+SLOT_BASE+APPDATA.wnd_clientbox.left],eax
-
 
3119
	shl	eax,1
-
 
3120
	neg	eax
-
 
3121
	add	eax,[ecx+WDATA.box.width]
-
 
3122
	mov	[edi+SLOT_BASE+APPDATA.wnd_clientbox.width],eax
-
 
3123
 
-
 
3124
	movzx	eax,[ecx+WDATA.fl_wstyle]
-
 
3125
	and	eax,0x0F
-
 
3126
	push	[eax*8+window_topleft+0]
-
 
3127
	mov	eax,[eax*8+window_topleft+4]
-
 
3128
	mov	[edi+SLOT_BASE+APPDATA.wnd_clientbox.top],eax
-
 
3129
	neg	eax
-
 
3130
	sub	eax,[esp]
-
 
3131
	add	eax,[ecx+WDATA.box.height]
-
 
3132
	mov	[edi+SLOT_BASE+APPDATA.wnd_clientbox.height],eax
-
 
3133
	add	esp,4
-
 
3134
 
-
 
3135
	pop	edi ecx eax
-
 
3136
	ret
-
 
3137
    @@:
-
 
3138
	xor	eax,eax
-
 
3139
	mov	[edi+SLOT_BASE+APPDATA.wnd_clientbox.left],eax
-
 
3140
	mov	[edi+SLOT_BASE+APPDATA.wnd_clientbox.top],eax
-
 
3141
	mov	eax,[ecx+WDATA.box.width]
-
 
3142
	mov	[edi+SLOT_BASE+APPDATA.wnd_clientbox.width],eax
-
 
3143
	mov	eax,[ecx+WDATA.box.height]
-
 
3144
	mov	[edi+SLOT_BASE+APPDATA.wnd_clientbox.height],eax
-
 
3145
 
-
 
3146
	pop	edi ecx eax
-
 
3147
	ret
-
 
3148
 
-
 
3149
sys_set_window:
-
 
3150
 
-
 
3151
    mov   eax,[CURRENT_TASK]
-
 
3152
    shl   eax,5
-
 
3153
    add   eax,window_data
-
 
3154
 
-
 
3155
    ; colors
-
 
3156
    mov   [eax+WDATA.cl_workarea],edx
-
 
3157
    mov   [eax+WDATA.cl_titlebar],esi
-
 
3158
    mov   [eax+WDATA.cl_frames],edi
-
 
3159
 
-
 
3160
    mov   edi, eax
-
 
3161
 
-
 
3162
    ; check flag (?)
-
 
3163
    test  [edi+WDATA.fl_wdrawn],1
-
 
3164
    jnz   newd
-
 
3165
 
-
 
3166
    mov   eax,[timer_ticks] ;[0xfdf0]
-
 
3167
    add   eax,100
-
 
3168
    mov   [new_window_starting],eax
-
 
3169
 
-
 
3170
    movsx eax,bx
-
 
3171
    mov   [edi+WDATA.box.width],eax
-
 
3172
    movsx eax,cx
-
 
3173
    mov   [edi+WDATA.box.height],eax
-
 
3174
    sar   ebx,16
-
 
3175
    sar   ecx,16
-
 
3176
    mov   [edi+WDATA.box.left],ebx
-
 
3177
    mov   [edi+WDATA.box.top],ecx
-
 
3178
 
-
 
3179
    call  check_window_position
-
 
3180
 
-
 
3181
    push  ecx esi edi		    ; save for window fullscreen/resize
-
 
3182
    ;mov   esi,edi
-
 
3183
 
-
 
3184
	mov	cl, [edi+WDATA.fl_wstyle]
-
 
3185
	mov	eax, [edi+WDATA.cl_frames]
-
 
3186
 
-
 
3187
    sub   edi,window_data
-
 
3188
    shl   edi,3
-
 
3189
    add   edi,SLOT_BASE
-
 
3190
 
-
 
3191
	and	cl,0x0F
-
 
3192
	mov	[edi+APPDATA.wnd_caption],0
-
 
3193
	cmp	cl,3
-
 
3194
	je	set_APPDATA_wnd_caption
-
 
3195
	cmp	cl,4								; {SPraid.simba}
-
 
3196
	je	set_APPDATA_wnd_caption
-
 
3197
 
-
 
3198
	jmp	@f
-
 
3199
    set_APPDATA_wnd_caption:
-
 
3200
	mov	[edi+APPDATA.wnd_caption],eax
-
 
3201
    @@: mov	esi,[esp+0]
-
 
3202
 
-
 
3203
    add   edi, APPDATA.saved_box
-
 
3204
	movsd
-
 
3205
	movsd
-
 
3206
	movsd
-
 
3207
	movsd
-
 
3208
    pop   edi esi ecx
-
 
3209
 
-
 
3210
	mov	esi, [CURRENT_TASK]
-
 
3211
	movzx	esi, word [WIN_STACK+esi*2]
-
 
3212
	lea	esi, [WIN_POS+esi*2]
-
 
3213
	call	waredraw
-
 
3214
 
-
 
3215
;;;    mov   ebx, 1
-
 
3216
;;;    call  delay_hs
-
 
3217
    mov   eax, [edi+WDATA.box.left]
-
 
3218
    mov   ebx, [edi+WDATA.box.top]
-
 
3219
    mov   ecx, [edi+WDATA.box.width]
-
 
3220
    mov   edx, [edi+WDATA.box.height]
-
 
3221
    add   ecx, eax
-
 
3222
    add   edx, ebx
-
 
3223
    call  calculatescreen
-
 
3224
 
-
 
3225
    mov   [KEY_COUNT],byte 0	       ; empty keyboard buffer
-
 
3226
    mov   [BTN_COUNT],byte 0	       ; empty button buffer
-
 
3227
 
-
 
3228
  newd:
-
 
3229
    call  set_window_clientbox
-
 
3230
 
-
 
3231
    mov   [edi+WDATA.fl_redraw],byte 0	 ; no redraw
-
 
3232
    mov   edx,edi
-
 
3233
 
-
 
3234
    ret
-
 
3235
 
-
 
3236
syscall_windowsettings:
-
 
3237
 
-
 
3238
  .set_window_caption:
-
 
3239
	dec	ebx	; subfunction #1 - set window caption
-
 
3240
	jnz	.exit_fail
-
 
3241
 
-
 
3242
	; NOTE: only window owner thread can set its caption,
-
 
3243
	;       so there's no parameter for PID/TID
-
 
3244
 
-
 
3245
	mov	edi,[CURRENT_TASK]
-
 
3246
	shl	edi,5
-
 
3247
 
-
 
3248
	; have to check if caption is within application memory limit
-
 
3249
	; check is trivial, and if application resizes its memory,
-
 
3250
	;   caption still can become over bounds
-
 
3251
; diamond, 31.10.2006: check removed because with new memory manager
-
 
3252
; there can be valid data after APPDATA.mem_size bound
-
 
3253
;        mov     ecx,[edi*8+SLOT_BASE+APPDATA.mem_size]
-
 
3254
;        add     ecx,255 ; max caption length
-
 
3255
;        cmp     ebx,ecx
-
 
3256
;        ja      .exit_fail
-
 
3257
 
-
 
3258
	mov	[edi*8+SLOT_BASE+APPDATA.wnd_caption],ecx
-
 
3259
	or	[edi+window_data+WDATA.fl_wstyle],WSTYLE_HASCAPTION
-
 
3260
 
-
 
3261
	call	draw_window_caption
-
 
3262
 
-
 
3263
	xor	eax,eax ; eax = 0 (success)
-
 
3264
	ret
-
 
3265
 
-
 
3266
;  .get_window_caption:
-
 
3267
;        dec     eax     ; subfunction #2 - get window caption
-
 
3268
;        jnz     .exit_fail
-
 
3269
 
-
 
3270
	; not implemented yet
-
 
3271
 
-
 
3272
  .exit_fail:
-
 
3273
	xor	eax,eax
-
 
3274
	inc	eax	; eax = 1 (fail)
-
 
3275
	ret
-
 
3276
 
-
 
3277
 
-
 
3278
sys_window_move:
-
 
3279
 
-
 
3280
	mov	edi,[CURRENT_TASK]
-
 
3281
	shl	edi,5
-
 
3282
	add	edi,window_data
-
 
3283
 
-
 
3284
	test	[edi+WDATA.fl_wstate],WSTATE_MAXIMIZED
-
 
3285
	jnz	.window_move_return
-
 
3286
 
-
 
3287
	push	dword [edi + WDATA.box.left]  ; save old coordinates
-
 
3288
	push	dword [edi + WDATA.box.top]
-
 
3289
	push	dword [edi + WDATA.box.width]
-
 
3290
	push	dword [edi + WDATA.box.height]
-
 
3291
 
-
 
3292
	cmp   eax,-1		      ; set new position and size
-
 
3293
	je    .no_x_reposition
-
 
3294
	mov	[edi + WDATA.box.left], eax
-
 
3295
      .no_x_reposition:
-
 
3296
	cmp   ebx,-1
-
 
3297
	je    .no_y_reposition
-
 
3298
	mov	[edi + WDATA.box.top], ebx
-
 
3299
      .no_y_reposition:
-
 
3300
 
-
 
3301
	test	[edi+WDATA.fl_wstate],WSTATE_ROLLEDUP
-
 
3302
	jnz	.no_y_resizing
-
 
3303
 
-
 
3304
	cmp   ecx,-1
-
 
3305
	je    .no_x_resizing
-
 
3306
	mov	[edi + WDATA.box.width], ecx
-
 
3307
      .no_x_resizing:
-
 
3308
	cmp   edx,-1
-
 
3309
	je    .no_y_resizing
-
 
3310
	mov	[edi + WDATA.box.height], edx
-
 
3311
      .no_y_resizing:
-
 
3312
 
-
 
3313
	call  check_window_position
-
 
3314
	call  set_window_clientbox
-
 
3315
 
-
 
3316
	pushad			     ; save for window fullscreen/resize
-
 
3317
	mov   esi,edi
-
 
3318
	sub   edi,window_data
-
 
3319
	shr   edi,5
-
 
3320
	shl   edi,8
-
 
3321
	add   edi, SLOT_BASE + APPDATA.saved_box
-
 
3322
	mov   ecx,4
-
 
3323
	cld
-
 
3324
	rep   movsd
-
 
3325
	popad
-
 
3326
 
-
 
3327
	pushad			     ; calculcate screen at new position
-
 
3328
	mov   eax, [edi + WDATA.box.left]
-
 
3329
	mov   ebx, [edi + WDATA.box.top]
-
 
3330
	mov   ecx, [edi + WDATA.box.width]
-
 
3331
	mov   edx, [edi + WDATA.box.height]
-
 
3332
	add   ecx,eax
-
 
3333
	add   edx,ebx
-
 
3334
 
-
 
3335
	call  calculatescreen
-
 
3336
	popad
-
 
3337
 
-
 
3338
	pop   edx		    ; calculcate screen at old position
-
 
3339
	pop   ecx
-
 
3340
	pop   ebx
-
 
3341
	pop   eax
-
 
3342
	add   ecx,eax
-
 
3343
	add   edx,ebx
-
 
3344
	mov   [draw_limits.left],eax		 ; save for drawlimits
-
 
3345
	mov   [draw_limits.top],ebx
-
 
3346
	mov   [draw_limits.right],ecx
-
 
3347
	mov   [draw_limits.bottom],edx
-
 
3348
	call  calculatescreen
-
 
3349
 
-
 
3350
	mov   [edi + WDATA.fl_redraw], 1 ; flag the process as redraw
-
 
3351
 
-
 
3352
	mov   eax,edi		    ; redraw screen at old position
-
 
3353
	xor   esi,esi
-
 
3354
	call  redrawscreen
-
 
3355
 
-
 
3356
	mov   [DONT_DRAW_MOUSE],byte 0 ; mouse pointer
-
 
3357
	mov   [MOUSE_BACKGROUND],byte 0 ; no mouse under
-
 
3358
	mov   [MOUSE_DOWN],byte 0 ; react to mouse up/down
-
 
3359
 
-
 
3360
	call  [draw_pointer]
-
 
3361
 
-
 
3362
	mov   [window_move_pr],0
-
 
3363
 
-
 
3364
      .window_move_return:
-
 
3365
 
-
 
3366
	ret
-
 
3367
 
-
 
3368
uglobal
-
 
3369
  window_move_pr   dd  0x0
-
 
3370
  window_move_eax  dd  0x0
-
 
3371
  window_move_ebx  dd  0x0
-
 
3372
  window_move_ecx  dd  0x0
-
 
3373
  window_move_edx  dd  0x0
-
 
3374
endg
2898
        ret
3375
 
2899
 
3376
;ok - 100% work
2900
;ok - 100% work
3377
;nt - not tested
2901
;nt - not tested
3378
;---------------------------------------------------------------------------------------------
2902
;---------------------------------------------------------------------------------------------
Line 3548... Line 3072...
3548
    add   edi, 256
3072
        add     edi, 256
3549
    or	  [edi+SLOT_BASE+APPDATA.event_mask], dword 100000b
3073
        or      [edi+SLOT_BASE+APPDATA.event_mask], dword 100000b
3550
    loop  set_mouse_event
3074
        loop    set_mouse_event
Line 3551... Line 3075...
3551
 
3075
 
3552
mouse_not_active:
-
 
3553
    cmp   [REDRAW_BACKGROUND],byte 0		   ; background update ?
-
 
3554
    jz	  nobackgr
-
 
3555
    cmp    [background_defined], 0
-
 
3556
    jz	  nobackgr
3076
mouse_not_active:
3557
    cmp   [REDRAW_BACKGROUND], byte 2
3077
        cmp     byte[BACKGROUND_CHANGED], 0
3558
    jnz   no_set_bgr_event
3078
        jz      no_set_bgr_event
3559
    xor   edi, edi
3079
        xor     edi, edi
3560
    mov   ecx,	[TASK_COUNT]
3080
        mov     ecx, [TASK_COUNT]
3561
set_bgr_event:
3081
set_bgr_event:
3562
    add   edi, 256
3082
        add     edi, 256
3563
    or	  [edi+SLOT_BASE+APPDATA.event_mask], 16
3083
        or      [edi+SLOT_BASE+APPDATA.event_mask], 16
-
 
3084
        loop    set_bgr_event
3564
    loop  set_bgr_event
3085
        mov     byte[BACKGROUND_CHANGED], 0
-
 
3086
no_set_bgr_event:
-
 
3087
        cmp     byte[REDRAW_BACKGROUND], 0         ; background update ?
-
 
3088
        jz      nobackgr
-
 
3089
        cmp     [background_defined], 0
3565
no_set_bgr_event:
3090
        jz      nobackgr
3566
;    mov   [draw_data+32 + RECT.left],dword 0
3091
;    mov   [draw_data+32 + RECT.left],dword 0
3567
;    mov   [draw_data+32 + RECT.top],dword 0
3092
;    mov   [draw_data+32 + RECT.top],dword 0
3568
;    mov   eax,[Screen_Max_X]
3093
;    mov   eax,[Screen_Max_X]
3569
;    mov   ebx,[Screen_Max_Y]
3094
;    mov   ebx,[Screen_Max_Y]
3570
;    mov   [draw_data+32 + RECT.right],eax
3095
;    mov   [draw_data+32 + RECT.right],eax
-
 
3096
;    mov   [draw_data+32 + RECT.bottom],ebx
3571
;    mov   [draw_data+32 + RECT.bottom],ebx
3097
@@:
-
 
3098
        call    drawbackground
3572
    call  drawbackground
3099
        xor     eax, eax
-
 
3100
        xchg    al, [REDRAW_BACKGROUND]
-
 
3101
        test    al, al                             ; got new update request?
-
 
3102
        jnz     @b
-
 
3103
        mov     [draw_data+32 + RECT.left], eax
-
 
3104
        mov     [draw_data+32 + RECT.top], eax
-
 
3105
        mov     [draw_data+32 + RECT.right], eax
3573
    mov   [REDRAW_BACKGROUND],byte 0
3106
        mov     [draw_data+32 + RECT.bottom], eax
Line 3574... Line 3107...
3574
    mov   [MOUSE_BACKGROUND],byte 0
3107
        mov     [MOUSE_BACKGROUND], byte 0
Line 3575... Line 3108...
3575
 
3108
 
Line 3682... Line 3215...
3682
	 cmp   ecx,eax
3215
        cmp     ecx, eax
3683
	 jb    ricino
3216
        jb      ricino
Line 3684... Line 3217...
3684
 
3217
 
Line 3685... Line 3218...
3685
	bgli:
3218
        bgli:
3686
 
3219
 
3687
	 cmp   ecx,1
3220
        cmp     dword[esp], 1
3688
	 jnz   .az
-
 
3689
	 mov   al,[REDRAW_BACKGROUND]
3221
        jnz     .az
3690
	 cmp   al,2
3222
;         cmp   byte[BACKGROUND_CHANGED], 0
3691
	 jz    newdw8
3223
;         jnz   newdw8
-
 
3224
        cmp     byte[REDRAW_BACKGROUND], 0
3692
	 test  al,al
3225
        jz      .az
3693
	 jz    .az
3226
        mov     dl, 0
3694
	 lea   eax,[edi+draw_data-window_data]
3227
        lea     eax, [edi+draw_data-window_data]
3695
	 mov   ebx,[draw_limits.left]
3228
        mov     ebx, [draw_limits.left]
3696
	 cmp   ebx,[eax+RECT.left]
3229
        cmp     ebx, [eax+RECT.left]
-
 
3230
        jae     @f
3697
	 jae   @f
3231
        mov     [eax+RECT.left], ebx
3698
	 mov   [eax+RECT.left],ebx
3232
        mov     dl, 1
3699
	@@:
3233
        @@:
3700
	 mov   ebx,[draw_limits.top]
3234
        mov     ebx, [draw_limits.top]
3701
	 cmp   ebx,[eax+RECT.top]
3235
        cmp     ebx, [eax+RECT.top]
-
 
3236
        jae     @f
3702
	 jae   @f
3237
        mov     [eax+RECT.top], ebx
3703
	 mov   [eax+RECT.top],ebx
3238
        mov     dl, 1
3704
	@@:
3239
        @@:
3705
	 mov   ebx,[draw_limits.right]
3240
        mov     ebx, [draw_limits.right]
3706
	 cmp   ebx,[eax+RECT.right]
3241
        cmp     ebx, [eax+RECT.right]
-
 
3242
        jbe     @f
3707
	 jbe   @f
3243
        mov     [eax+RECT.right], ebx
3708
	 mov   [eax+RECT.right],ebx
3244
        mov     dl, 1
3709
	@@:
3245
        @@:
3710
	 mov   ebx,[draw_limits.bottom]
3246
        mov     ebx, [draw_limits.bottom]
3711
	 cmp   ebx,[eax+RECT.bottom]
3247
        cmp     ebx, [eax+RECT.bottom]
-
 
3248
        jbe     @f
3712
	 jbe   @f
3249
        mov     [eax+RECT.bottom], ebx
-
 
3250
        mov     dl, 1
3713
	 mov   [eax+RECT.bottom],ebx
3251
        @@:
3714
	@@:
3252
        add     byte[REDRAW_BACKGROUND], dl
Line 3715... Line 3253...
3715
	 jmp   newdw8
3253
        jmp     newdw8
3716
	.az:
3254
        .az:
Line 3729... Line 3267...
3729
 
3267
 
Line 3730... Line 3268...
3730
	 sub   eax,draw_data-window_data
3268
        sub     eax, draw_data-window_data
3731
 
3269
 
3732
	 cmp   dword [esp],1
3270
        cmp     dword [esp], 1
Line 3733... Line 3271...
3733
	 jne   nobgrd
3271
        jne     nobgrd
3734
	 mov   byte [REDRAW_BACKGROUND], 1
3272
        inc     byte[REDRAW_BACKGROUND]
Line 3735... Line 3273...
3735
 
3273
 
Line 3759... Line 3297...
3759
	mov   ecx, [_WinMapSize]
3297
        mov     ecx, [_WinMapSize]
3760
	shr   ecx, 2
3298
        shr     ecx, 2
3761
	rep   stosd
3299
        rep stosd
Line 3762... Line 3300...
3762
 
3300
 
-
 
3301
        mov     byte[REDRAW_BACKGROUND], 0            ; do not draw background!
Line 3763... Line 3302...
3763
	mov   byte [REDRAW_BACKGROUND], 0	       ; do not draw background!
3302
        mov     byte[BACKGROUND_CHANGED], 0
Line 3764... Line 3303...
3764
 
3303
 
3765
	ret
3304
        ret
Line 3785... Line 3324...
3785
	in    al,0x61
3324
        in      al, 0x61
3786
	and   al,0x10
3325
        and     al, 0x10
3787
	mov   ah,al
3326
        mov     ah, al
3788
	cld
3327
        cld
Line -... Line 3328...
-
 
3328
 
3789
 
3329
 cnt1:
3790
 cnt1:	in    al,0x61
3330
        in      al, 0x61
3791
	and   al,0x10
3331
        and     al, 0x10
3792
	cmp   al,ah
3332
        cmp     al, ah
Line 3793... Line 3333...
3793
	jz    cnt1
3333
        jz      cnt1
Line 3912... Line 3452...
3912
;     ret
3452
;     ret
Line 3913... Line 3453...
3913
 
3453
 
3914
 
-
 
3915
 
-
 
3916
align 4
-
 
3917
 
-
 
3918
sys_programirq:
-
 
3919
 
-
 
3920
    mov   eax, [TASK_BASE]
-
 
3921
    add   ebx, [eax + TASKDATA.mem_start]
-
 
3922
 
-
 
3923
    cmp   ecx, 16
-
 
3924
    jae   .not_owner
-
 
3925
    mov   edi, [eax + TASKDATA.pid]
-
 
3926
    cmp   edi, [irq_owner + 4 * ecx]
-
 
3927
    je	  .spril1
-
 
3928
.not_owner:
-
 
3929
    xor   ecx, ecx
-
 
3930
    inc   ecx
-
 
3931
    jmp   .end
-
 
3932
  .spril1:
-
 
3933
 
-
 
3934
    shl   ecx, 6
-
 
3935
    mov   esi, ebx
-
 
3936
    lea   edi, [irq00read + ecx]
-
 
3937
    push  16
-
 
3938
    pop   ecx
-
 
3939
 
-
 
3940
    cld
-
 
3941
    rep   movsd
-
 
3942
  .end:
-
 
3943
    mov   [esp+32], ecx
-
 
3944
    ret
-
 
3945
 
-
 
3946
 
-
 
3947
align 4
-
 
3948
 
-
 
3949
get_irq_data:
-
 
3950
     movzx esi, bh			 ; save number of subfunction, if bh = 1, return data size, otherwise, read data
-
 
3951
     xor   bh, bh
-
 
3952
     cmp   ebx, 16
-
 
3953
     jae   .not_owner
-
 
3954
     mov   edx, [4 * ebx + irq_owner]	 ; check for irq owner
-
 
3955
 
-
 
3956
     mov   eax,[TASK_BASE]
-
 
3957
 
-
 
3958
     cmp   edx,[eax+TASKDATA.pid]
-
 
3959
     je    gidril1
-
 
3960
.not_owner:
-
 
3961
     xor   edx, edx
-
 
3962
     dec   edx
-
 
3963
     jmp   gid1
-
 
3964
 
-
 
3965
  gidril1:
-
 
3966
 
-
 
3967
     shl   ebx, 12
-
 
3968
     lea   eax, [ebx + IRQ_SAVE]	 ; calculate address of the beginning of buffer + 0x0 - data size
-
 
3969
     mov   edx, [eax]			 ;                                              + 0x4 - data offset
-
 
3970
     dec   esi
-
 
3971
     jz    gid1
-
 
3972
     test  edx, edx			 ; check if buffer is empty
-
 
3973
     jz    gid1
-
 
3974
 
-
 
3975
     mov   ebx, [eax + 0x4]
-
 
3976
     mov   edi, ecx
-
 
3977
 
-
 
3978
     mov   ecx, 4000			 ; buffer size, used frequently
-
 
3979
 
-
 
3980
     cmp   ebx, ecx			 ; check for the end of buffer, if end of buffer, begin cycle again
-
 
3981
     jb    @f
-
 
3982
 
-
 
3983
     xor   ebx, ebx
-
 
3984
 
-
 
3985
   @@:
-
 
3986
 
-
 
3987
     lea   esi, [ebx + edx]		 ; calculate data size and offset
-
 
3988
     cld
-
 
3989
     cmp   esi, ecx			 ; if greater than the buffer size, begin cycle again
-
 
3990
     jbe   @f
-
 
3991
 
-
 
3992
     sub   ecx, ebx
-
 
3993
     sub   edx, ecx
-
 
3994
 
-
 
3995
     lea   esi, [eax + ebx + 0x10]
-
 
3996
     rep   movsb
-
 
3997
 
-
 
3998
     xor   ebx, ebx
-
 
3999
   @@:
-
 
4000
     lea   esi, [eax + ebx + 0x10]
-
 
4001
     mov   ecx, edx
-
 
4002
     add   ebx, edx
-
 
4003
 
-
 
4004
     rep   movsb
-
 
4005
     mov   edx, [eax]
-
 
4006
     mov   [eax], ecx			 ; set data size to zero
-
 
4007
     mov   [eax + 0x4], ebx		 ; set data offset
-
 
4008
 
-
 
4009
   gid1:
-
 
4010
     mov   [esp+32], edx		 ; eax
-
 
4011
     ret
3454
 
4012
 
3455
 
4013
 
3456
align 4
4014
set_io_access_rights:
3457
set_io_access_rights:
4015
      push edi eax
3458
        push    edi eax
Line 4020... Line 3463...
4020
;     add   edi,eax
3463
;     add   edi,eax
4021
;     mov   ebx,1
3464
;     mov   ebx,1
4022
;     shl   ebx,cl
3465
;     shl   ebx,cl
4023
     test  ebp,ebp
3466
        test    ebp, ebp
4024
;     cmp   ebp,0                ; enable access - ebp = 0
3467
;     cmp   ebp,0                ; enable access - ebp = 0
4025
     jnz   siar1
3468
        jnz     .siar1
4026
;     not   ebx
3469
;     not   ebx
4027
;     and   [edi],byte bl
3470
;     and   [edi],byte bl
4028
     btr [edi], eax
3471
        btr     [edi], eax
4029
     pop eax edi
3472
        pop     eax edi
4030
     ret
3473
        ret
4031
siar1:
3474
.siar1:
4032
     bts [edi], eax
3475
        bts     [edi], eax
4033
  ;  or    [edi],byte bl        ; disable access - ebp = 1
3476
  ;  or    [edi],byte bl        ; disable access - ebp = 1
4034
     pop eax edi
3477
        pop     eax edi
4035
     ret
3478
        ret
4036
;reserve/free group of ports
3479
;reserve/free group of ports
Line 4181... Line 3624...
4181
;     popad                         ; end disable io map
3624
;     popad                         ; end disable io map
4182
     xor   eax, eax
3625
        xor     eax, eax
4183
     ret
3626
        ret
Line 4184... Line -...
4184
 
-
 
4185
 
-
 
4186
reserve_free_irq:
-
 
4187
 
-
 
4188
     xor   esi, esi
-
 
4189
     inc   esi
-
 
4190
     cmp   ecx, 16
-
 
4191
     jae   ril1
-
 
4192
 
-
 
4193
     push  ecx
-
 
4194
     lea   ecx, [irq_owner + 4 * ecx]
-
 
4195
     mov   edx, [ecx]
-
 
4196
     mov   eax, [TASK_BASE]
-
 
4197
     mov   edi, [eax + TASKDATA.pid]
-
 
4198
     pop   eax
-
 
4199
     dec   ebx
-
 
4200
     jnz   reserve_irq
-
 
4201
 
-
 
4202
     cmp   edx, edi
-
 
4203
     jne   ril1
-
 
4204
     dec   esi
-
 
4205
     mov   [ecx], esi
-
 
4206
 
-
 
4207
     jmp   ril1
-
 
4208
 
-
 
4209
  reserve_irq:
-
 
4210
 
-
 
4211
     cmp   dword [ecx], 0
-
 
4212
     jne   ril1
-
 
4213
 
-
 
4214
     mov   ebx, [f_irqs + 4 * eax]
-
 
4215
 
-
 
4216
     stdcall attach_int_handler, eax, ebx, dword 0
-
 
4217
 
-
 
4218
     mov   [ecx], edi
-
 
4219
 
-
 
4220
     dec   esi
-
 
4221
   ril1:
-
 
4222
     mov   [esp+32], esi ; return in eax
-
 
4223
     ret
-
 
4224
 
3627
 
4225
iglobal
-
 
4226
f_irqs:
-
 
4227
     dd 0x0
-
 
4228
     dd 0x0
-
 
4229
     dd p_irq2
-
 
4230
     dd p_irq3
-
 
4231
     dd p_irq4
-
 
4232
     dd p_irq5
-
 
4233
     dd p_irq6
-
 
4234
     dd p_irq7
-
 
4235
     dd p_irq8
-
 
4236
     dd p_irq9
-
 
4237
     dd p_irq10
-
 
4238
     dd p_irq11
-
 
4239
     dd 0x0
-
 
4240
     dd 0x0
-
 
4241
     dd p_irq14
-
 
4242
     dd p_irq15
-
 
4243
 
-
 
4244
endg
3628
 
4245
 
3629
align 4
4246
drawbackground:
3630
drawbackground:
4247
       inc   [mouse_pause]
3631
        inc     [mouse_pause]
4248
       cmp   [SCR_MODE],word 0x12
3632
        cmp     [SCR_MODE], word 0x12
Line 4307... Line 3691...
4307
	inc	[mouse_pause]
3691
        inc     [mouse_pause]
4308
	call	eax
3692
        call    eax
4309
	dec	[mouse_pause]
3693
        dec     [mouse_pause]
4310
	pop	ebp esi ebp
3694
        pop     ebp esi ebp
4311
	jmp	[draw_pointer]
3695
        jmp     [draw_pointer]
4312
 
-
 
4313
syscall_putimage_palette:
-
 
4314
	mov	edi, esi
-
 
4315
	mov	esi, edx
-
 
4316
	mov	edx, ecx
-
 
4317
	mov	ecx, ebx
-
 
4318
	mov	ebx, eax
3696
align 4
4319
sys_putimage_palette:
3697
sys_putimage_palette:
4320
; ebx = pointer to image
3698
; ebx = pointer to image
4321
; ecx = [xsize]*65536 + [ysize]
3699
; ecx = [xsize]*65536 + [ysize]
4322
; edx = [xstart]*65536 + [ystart]
3700
; edx = [xstart]*65536 + [ystart]
4323
; esi = number of bits per pixel, must be 8, 24 or 32
3701
; esi = number of bits per pixel, must be 8, 24 or 32
Line 4738... Line 4116...
4738
     mov   edx,0xffffffff
4116
        mov     edx, 0xffffffff
4739
     mov   eax,0xffffffff
4117
        mov     eax, 0xffffffff
4740
     ret
4118
        ret
4741
end if
4119
end if
Line 4742... Line -...
4742
 
-
 
4743
rerouteirqs:
-
 
4744
 
-
 
4745
	cli
-
 
4746
 
-
 
4747
	mov	al,0x11 	;  icw4, edge triggered
-
 
4748
	out	0x20,al
-
 
4749
	call	pic_delay
-
 
4750
	out	0xA0,al
-
 
4751
	call	pic_delay
-
 
4752
 
-
 
4753
	mov	al,0x20 	;  generate 0x20 +
-
 
4754
	out	0x21,al
-
 
4755
	call	pic_delay
-
 
4756
	mov	al,0x28 	;  generate 0x28 +
-
 
4757
	out	0xA1,al
-
 
4758
	call	pic_delay
-
 
4759
 
-
 
4760
	mov	al,0x04 	;  slave at irq2
-
 
4761
	out	0x21,al
-
 
4762
	call	pic_delay
-
 
4763
	mov	al,0x02 	;  at irq9
-
 
4764
	out	0xA1,al
-
 
4765
	call	pic_delay
-
 
4766
 
-
 
4767
	mov	al,0x01 	;  8086 mode
-
 
4768
	out	0x21,al
-
 
4769
	call	pic_delay
-
 
4770
	out	0xA1,al
-
 
4771
	call	pic_delay
-
 
4772
 
-
 
4773
	mov	al,255		; mask all irq's
-
 
4774
	out	0xA1,al
-
 
4775
	call	pic_delay
-
 
4776
	out	0x21,al
-
 
4777
	call	pic_delay
-
 
4778
 
-
 
4779
	mov	ecx,0x1000
-
 
4780
	cld
-
 
4781
picl1:	call	pic_delay
-
 
4782
	loop	picl1
-
 
4783
 
-
 
4784
	mov	al,255		; mask all irq's
-
 
4785
	out	0xA1,al
-
 
4786
	call	pic_delay
-
 
4787
	out	0x21,al
-
 
4788
	call	pic_delay
-
 
4789
 
-
 
4790
	cli
-
 
4791
 
-
 
4792
	ret
-
 
4793
 
-
 
4794
 
-
 
4795
pic_delay:
-
 
4796
 
-
 
4797
	jmp	pdl1
-
 
4798
pdl1:	ret
-
 
4799
 
-
 
4800
 
4120
 
Line 4801... Line 4121...
4801
sys_msg_board_str:
4121
sys_msg_board_str:
4802
 
4122
 
4803
     pushad
4123
        pushad
Line 4854... Line 4174...
4854
	loop	@b
4174
        loop    @b
4855
	popad
4175
        popad
4856
	ret
4176
        ret
Line 4857... Line 4177...
4857
 
4177
 
-
 
4178
uglobal
4858
uglobal
4179
  msg_board_data:
4859
  msg_board_data: times 4096 db 0
4180
                  times 4096 db 0
4860
  msg_board_count dd 0x0
4181
  msg_board_count dd 0x0
Line 4861... Line 4182...
4861
endg
4182
endg
Line 4910... Line 4231...
4910
	mov	[esp+36], ecx
4231
        mov     [esp+36], ecx
4911
	mov	[esp+24], ecx
4232
        mov     [esp+24], ecx
4912
.smbl2:
4233
.smbl2:
4913
	ret
4234
        ret
Line -... Line 4235...
-
 
4235
 
-
 
4236
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
 
4237
;; 66 sys function.                                                ;;
-
 
4238
;; in eax=66,ebx in [0..5],ecx,edx                                 ;;
-
 
4239
;; out eax                                                         ;;
-
 
4240
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
 
4241
iglobal
-
 
4242
align 4
-
 
4243
f66call:
-
 
4244
           dd sys_process_def.1   ; 1 = set keyboard mode
-
 
4245
           dd sys_process_def.2   ; 2 = get keyboard mode
-
 
4246
           dd sys_process_def.3   ; 3 = get keyboard ctrl, alt, shift
-
 
4247
           dd sys_process_def.4
-
 
4248
           dd sys_process_def.5
-
 
4249
endg
-
 
4250
 
Line 4914... Line 4251...
4914
 
4251
 
-
 
4252
 
-
 
4253
 
-
 
4254
sys_process_def:
-
 
4255
        dec     ebx
4915
 
4256
        cmp     ebx, 5
-
 
4257
        jae     .not_support    ;if >=6 then or eax,-1
Line -... Line 4258...
-
 
4258
 
4916
 
4259
        mov     edi, [CURRENT_TASK]
4917
sys_process_def:
4260
        jmp     dword [f66call+ebx*4]
Line -... Line 4261...
-
 
4261
 
4918
	mov	edi, [CURRENT_TASK]
4262
.not_support:
4919
 
4263
        or      eax, -1
Line 4920... Line 4264...
4920
	dec	eax		; 1 = set keyboard mode
4264
        ret
Line 4921... Line -...
4921
     jne   no_set_keyboard_setup
-
 
4922
 
-
 
4923
     shl   edi,8
4265
 
4924
     mov   [edi+SLOT_BASE + APPDATA.keyboard_mode],bl
-
 
4925
 
-
 
4926
     ret
4266
.1:
4927
 
4267
        shl     edi, 8
4928
   no_set_keyboard_setup:
-
 
4929
 
4268
        mov     [edi+SLOT_BASE + APPDATA.keyboard_mode], cl
4930
	dec	eax		; 2 = get keyboard mode
-
 
4931
     jne   no_get_keyboard_setup
4269
 
4932
 
-
 
4933
     shl   edi,8
-
 
4934
     movzx eax, byte [SLOT_BASE+edi + APPDATA.keyboard_mode]
-
 
4935
 
-
 
4936
     mov   [esp+36],eax
-
 
4937
 
-
 
4938
     ret
4270
        ret
4939
 
4271
 
4940
   no_get_keyboard_setup:
4272
.2:                             ; 2 = get keyboard mode
4941
 
4273
        shl     edi, 8
4942
	dec	eax		; 3 = get keyboard ctrl, alt, shift
4274
        movzx   eax, byte [SLOT_BASE+edi + APPDATA.keyboard_mode]
4943
     jne   no_get_keyboard_cas
4275
        mov     [esp+32], eax
4944
 
4276
        ret
4945
;     xor   eax,eax
4277
;     xor   eax,eax
4946
;     movzx eax,byte [shift]
-
 
-
 
4278
;     movzx eax,byte [shift]
4947
;     movzx ebx,byte [ctrl]
4279
;     movzx ebx,byte [ctrl]
4948
;     shl   ebx,2
4280
;     shl   ebx,2
4949
;     add   eax,ebx
4281
;     add   eax,ebx
4950
;     movzx ebx,byte [alt]
-
 
4951
;     shl   ebx,3
4282
;     movzx ebx,byte [alt]
4952
;     add   eax,ebx
-
 
4953
 
4283
;     shl   ebx,3
Line 4954... Line -...
4954
 ;// mike.dld [
-
 
4955
     mov   eax, [kb_state]
-
 
4956
 ;// mike.dld ]
-
 
4957
 
-
 
4958
     mov   [esp+36],eax
4284
;     add   eax,ebx
4959
 
4285
.3:                             ;3 = get keyboard ctrl, alt, shift
4960
     ret
4286
 ;// mike.dld [
4961
 
4287
        mov     eax, [kb_state]
4962
   no_get_keyboard_cas:
4288
 ;// mike.dld ]
4963
 
4289
        mov     [esp+32], eax
4964
	dec	eax
4290
        ret
4965
	jnz	no_add_keyboard_hotkey
4291
 
4966
 
4292
.4:
4967
	mov	eax, hotkey_list
4293
        mov     eax, hotkey_list
4968
@@:
4294
@@:
4969
	cmp	dword [eax+8], 0
4295
        cmp     dword [eax+8], 0
4970
	jz	.found_free
4296
        jz      .found_free
4971
	add	eax, 16
4297
        add     eax, 16
4972
	cmp	eax, hotkey_list+16*256
4298
        cmp     eax, hotkey_list+16*256
4973
	jb	@b
4299
        jb      @b
4974
	mov	dword [esp+36], 1
4300
        mov     dword [esp+32], 1
4975
	ret
4301
        ret
4976
.found_free:
4302
.found_free:
4977
	mov	[eax+8], edi
4303
        mov     [eax+8], edi
4978
	mov	[eax+4], ecx
4304
        mov     [eax+4], edx
4979
	movzx	ebx, bl
4305
        movzx   ecx, cl
4980
	lea	ebx, [hotkey_scancodes+ebx*4]
4306
        lea     ecx, [hotkey_scancodes+ecx*4]
4981
	mov	ecx, [ebx]
4307
        mov     edx, [ecx]
Line 4982... Line -...
4982
	mov	[eax], ecx
-
 
4983
	mov	[ebx], eax
-
 
4984
	mov	[eax+12], ebx
-
 
4985
	jecxz	@f
-
 
4986
	mov	[ecx+12], eax
4308
        mov     [eax], edx
4987
@@:
4309
        mov     [ecx], eax
4988
	and	dword [esp+36], 0
4310
        mov     [eax+12], ecx
4989
	ret
4311
        jecxz   @f
4990
 
4312
        mov     [edx+12], eax
4991
no_add_keyboard_hotkey:
4313
@@:
4992
 
4314
        and     dword [esp+32], 0
4993
	dec	eax
4315
        ret
4994
	jnz	no_del_keyboard_hotkey
4316
 
4995
 
4317
.5:
4996
	movzx	ebx, bl
4318
        movzx   ebx, cl
4997
	lea	ebx, [hotkey_scancodes+ebx*4]
4319
        lea     ebx, [hotkey_scancodes+ebx*4]
4998
	mov	eax, [ebx]
4320
        mov     eax, [ebx]
4999
.scan:
4321
.scan:
5000
	test	eax, eax
4322
        test    eax, eax
5001
	jz	.notfound
4323
        jz      .notfound
5002
	cmp	[eax+8], edi
4324
        cmp     [eax+8], edi
5003
	jnz	.next
4325
        jnz     .next
5004
	cmp	[eax+4], ecx
4326
        cmp     [eax+4], edx
5005
	jz	.found
4327
        jz      .found
5006
.next:
4328
.next:
Line 5021... Line 4343...
5021
	xor	edx, edx
4343
        xor     edx, edx
5022
	mov	[eax+4], edx
4344
        mov     [eax+4], edx
5023
	mov	[eax+8], edx
4345
        mov     [eax+8], edx
5024
	mov	[eax+12], edx
4346
        mov     [eax+12], edx
5025
	mov	[eax], edx
4347
        mov     [eax], edx
5026
	mov	[esp+36], edx
4348
        mov     [esp+32], edx
5027
	ret
4349
        ret
Line -... Line 4350...
-
 
4350
 
-
 
4351
 
-
 
4352
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
 
4353
;; 61 sys function.                                                ;;
-
 
4354
;; in eax=61,ebx in [1..3]                                         ;;
-
 
4355
;; out eax                                                         ;;
5028
 
4356
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
 
4357
iglobal
5029
no_del_keyboard_hotkey:
4358
align 4
-
 
4359
f61call:
-
 
4360
           dd sys_gs.1   ; resolution
-
 
4361
           dd sys_gs.2   ; bits per pixel
-
 
4362
           dd sys_gs.3   ; bytes per scanline
Line 5030... Line 4363...
5030
     ret
4363
endg
Line 5031... Line 4364...
5031
 
4364
 
-
 
4365
 
-
 
4366
align 4
-
 
4367
 
-
 
4368
sys_gs:                         ; direct screen access
-
 
4369
        dec     ebx
-
 
4370
        cmp     ebx, 2
-
 
4371
        ja      .not_support
-
 
4372
        jmp     dword [f61call+ebx*4]
Line 5032... Line 4373...
5032
 
4373
.not_support:
5033
align 4
-
 
5034
 
4374
        or      [esp+32], dword -1
5035
sys_gs: 			; direct screen access
4375
        ret
5036
 
4376
 
5037
     cmp  eax,1 		; resolution
4377
 
5038
     jne  no_gs1
4378
.1:                             ; resolution
5039
     mov  eax,[Screen_Max_X]
4379
        mov     eax, [Screen_Max_X]
5040
     shl  eax,16
-
 
5041
     mov  ax,[Screen_Max_Y]
-
 
5042
     add  eax,0x00010001
4380
        shl     eax, 16
5043
     mov  [esp+36],eax
-
 
5044
     ret
4381
        mov     ax, [Screen_Max_Y]
5045
   no_gs1:
4382
        add     eax, 0x00010001
5046
 
4383
        mov     [esp+32], eax
5047
     cmp   eax,2		; bits per pixel
-
 
5048
     jne   no_gs2
-
 
5049
     movzx eax,byte [ScreenBPP]
4384
        ret
5050
     mov   [esp+36],eax
-
 
5051
     ret
4385
.2:                             ; bits per pixel
5052
   no_gs2:
4386
        movzx   eax, byte [ScreenBPP]
5053
 
-
 
5054
     cmp   eax,3		; bytes per scanline
-
 
5055
     jne   no_gs3
-
 
5056
     mov   eax,[BytesPerScanLine]
-
 
5057
     mov   [esp+36],eax
-
 
5058
     ret
-
 
5059
   no_gs3:
-
 
5060
 
-
 
5061
     or  [esp+36],dword -1
-
 
5062
     ret
-
 
5063
 
-
 
5064
 
-
 
5065
align 4 ; PCI functions
-
 
5066
 
4387
        mov     [esp+32], eax
Line 5067... Line -...
5067
sys_pci:
-
 
5068
 
4388
        ret
Line 5069... Line 4389...
5069
     call  pci_api
4389
.3:                             ; bytes per scanline
Line 5070... Line 4390...
5070
     mov   [esp+36],eax
4390
        mov     eax, [BytesPerScanLine]
Line 5333... Line 4653...
5333
	xor	edi, edi
4653
        xor     edi, edi
5334
	add	ebx, ebp
4654
        add     ebx, ebp
5335
	mov	ecx, edx
4655
        mov     ecx, edx
5336
	jmp	[draw_line]
4656
        jmp     [draw_line]
Line 5337... Line -...
5337
 
-
 
5338
align 4
-
 
5339
 
-
 
5340
syscall_getirqowner:			; GetIrqOwner
-
 
5341
 
-
 
5342
     cmp   ebx,16
-
 
Line 5343... Line -...
5343
     jae   .err
-
 
5344
 
-
 
5345
     cmp   [irq_rights + 4 * ebx], dword 2
-
 
5346
     je    .err
-
 
5347
 
-
 
5348
     mov   eax,[4 * ebx + irq_owner]
-
 
5349
     mov   [esp+32],eax
-
 
5350
 
-
 
5351
     ret
-
 
5352
.err:
-
 
Line 5353... Line 4657...
5353
     or    dword [esp+32], -1
4657
 
5354
     ret
-
 
5355
 
4658
 
Line 5356... Line 4659...
5356
align 4
4659
 
5357
 
4660
align 4
5358
syscall_reserveportarea:		; ReservePortArea and FreePortArea
4661
syscall_reserveportarea:                ; ReservePortArea and FreePortArea
Line 5359... Line 4662...
5359
 
4662
 
5360
     call  r_f_port_area
-
 
5361
     mov   [esp+32],eax
4663
        call    r_f_port_area
5362
     ret
4664
        mov     [esp+32], eax
5363
 
4665
        ret
5364
align 4
4666
 
5365
 
4667
align 4
Line 5526... Line 4828...
5526
	   call sys_cd_audio
4828
        call    sys_cd_audio
Line 5527... Line 4829...
5527
 
4829
 
5528
yes_shutdown_param:
4830
yes_shutdown_param:
Line -... Line 4831...
-
 
4831
        cli
5529
	   cli
4832
 
5530
 
4833
if ~ defined extended_primary_loader
5531
	   mov	eax, kernel_file ; load kernel.mnt to 0x7000:0
4834
        mov     eax, kernel_file ; load kernel.mnt to 0x7000:0
5532
	   push 12
4835
        push    12
5533
	   pop	esi
4836
        pop     esi
Line 5538... Line 4841...
5538
 
4841
 
5539
	   mov	esi, restart_kernel_4000+OS_BASE+0x10000 ; move kernel re-starter to 0x4000:0
4842
        mov     esi, restart_kernel_4000+OS_BASE+0x10000 ; move kernel re-starter to 0x4000:0
5540
	   mov	edi,OS_BASE+0x40000
4843
        mov     edi, OS_BASE+0x40000
5541
	   mov	ecx,1000
4844
        mov     ecx, 1000
-
 
4845
        rep movsb
Line 5542... Line 4846...
5542
	   rep	movsb
4846
end if
5543
 
4847
 
5544
	   mov	esi,OS_BASE+0x2F0000	; restore 0x0 - 0xffff
4848
        mov     esi, BOOT_VAR    ; restore 0x0 - 0xffff
5545
	   mov	edi, OS_BASE
4849
        mov     edi, OS_BASE
5546
	   mov	ecx,0x10000/4
4850
        mov     ecx, 0x10000/4
Line 5547... Line 4851...
5547
	   cld
4851
        cld
Line 5548... Line -...
5548
	   rep movsd
-
 
5549
 
-
 
5550
	   call restorefatchain
4852
        rep movsd
Line 5551... Line 4853...
5551
 
4853
 
5552
	   mov al, 0xFF
4854
        call    restorefatchain
5553
	   out 0x21, al
4855