Subversion Repositories Kolibri OS

Rev

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

Rev 4587 Rev 4923
Line 341... Line 341...
341
        call    mutex_init
341
        call    mutex_init
342
        mov     ecx, ide_channel1_mutex
342
        mov     ecx, ide_channel1_mutex
343
        call    mutex_init
343
        call    mutex_init
344
        mov     ecx, ide_channel2_mutex
344
        mov     ecx, ide_channel2_mutex
345
        call    mutex_init
345
        call    mutex_init
-
 
346
        mov     ecx, ide_channel3_mutex
-
 
347
        call    mutex_init
-
 
348
        mov     ecx, ide_channel4_mutex
-
 
349
        call    mutex_init
-
 
350
        mov     ecx, ide_channel5_mutex
-
 
351
        call    mutex_init
-
 
352
        mov     ecx, ide_channel6_mutex
-
 
353
        call    mutex_init
346
;-----------------------------------------------------------------------------
354
;-----------------------------------------------------------------------------
347
; SAVE REAL MODE VARIABLES
355
; SAVE REAL MODE VARIABLES
348
;-----------------------------------------------------------------------------
356
;-----------------------------------------------------------------------------
349
save_variables_IDE_controller:
-
 
350
        xor     eax, eax
-
 
351
        mov     ax, [BOOT_VARS + BOOT_IDE_INTERR_16]
-
 
352
        mov     [IDE_Interrupt], ax
-
 
353
;--------------------------------------
-
 
354
        mov     ax, [BOOT_VARS + BOOT_IDE_PI_16]
-
 
355
        mov     [IDEContrProgrammingInterface], ax
-
 
356
;--------------------------------------
-
 
357
        mov     ax, [BOOT_VARS + BOOT_IDE_BASE_ADDR]
-
 
358
        mov     [IDEContrRegsBaseAddr], ax
-
 
359
;--------------------------------------
-
 
360
        mov     ax, [BOOT_VARS + BOOT_IDE_BAR0_16]
-
 
361
        cmp     ax, 0
-
 
362
        je      @f
-
 
363
        cmp     ax, 1
-
 
364
        jne     .no_PATA_BAR0
-
 
365
@@:
-
 
366
        mov     ax, 0x1F0
-
 
367
        jmp     @f
-
 
368
.no_PATA_BAR0:
-
 
369
        and     ax, 0xFFFC
-
 
370
@@:
-
 
371
        mov     [StandardATABases], ax
-
 
372
        mov     [hd_address_table], eax
-
 
373
        mov     [hd_address_table+8], eax
-
 
374
        mov     [IDE_BAR0_val], ax
-
 
375
;--------------------------------------
-
 
376
        mov     ax, [BOOT_VARS + BOOT_IDE_BAR1_16]
-
 
377
        cmp     ax, 0
-
 
378
        je      @f
-
 
379
        cmp     ax, 1
-
 
380
        jne     .no_PATA_BAR1
-
 
381
@@:
-
 
382
        mov     ax, 0x3F4
-
 
383
        jmp     @f
-
 
384
.no_PATA_BAR1:
-
 
385
        and     ax, 0xFFFC
-
 
386
@@:
-
 
387
        mov     [IDE_BAR1_val], ax
-
 
388
;--------------------------------------
-
 
389
        mov     ax, [BOOT_VARS + BOOT_IDE_BAR2_16]
-
 
390
        cmp     ax, 0
-
 
391
        je      @f
-
 
392
        cmp     ax, 1
-
 
393
        jne     .no_PATA_BAR2
-
 
394
@@:
-
 
395
        mov     ax, 0x170
-
 
396
        jmp     @f
-
 
397
.no_PATA_BAR2:
-
 
398
        and     ax, 0xFFFC
-
 
399
@@:
-
 
400
        mov     [StandardATABases+2], ax
-
 
401
        mov     [hd_address_table+16], eax
-
 
402
        mov     [hd_address_table+24], eax
-
 
403
        mov     [IDE_BAR2_val], ax
-
 
404
;--------------------------------------
-
 
405
        mov     ax, [BOOT_VARS + BOOT_IDE_BAR3_16]
-
 
406
        cmp     ax, 0
-
 
407
        je      @f
-
 
408
        cmp     ax, 1
-
 
409
        jne     .no_PATA_BAR3
-
 
410
@@:
-
 
411
        mov     ax, 0x374
-
 
412
        jmp     @f
-
 
413
.no_PATA_BAR3:
-
 
414
        and     ax, 0xFFFC
-
 
415
@@:
-
 
416
        mov     [IDE_BAR3_val], ax
-
 
417
 
-
 
418
; --------------- APM ---------------------
357
; --------------- APM ---------------------
Line 419... Line 358...
419
 
358
 
420
; init selectors
359
; init selectors
421
        mov     ebx, [BOOT_VARS+BOOT_APM_ENTRY]        ; offset of APM entry point
360
        mov     ebx, [BOOT_VARS+BOOT_APM_ENTRY]        ; offset of APM entry point
Line 740... Line 679...
740
        call    PIC_init
679
        call    PIC_init
Line 741... Line 680...
741
 
680
 
742
        mov     esi, boot_v86machine
681
        mov     esi, boot_v86machine
743
        call    boot_log
682
        call    boot_log
744
; Initialize system V86 machine
683
; Initialize system V86 machine
-
 
684
;        call    init_sys_v86
-
 
685
 
-
 
686
        xchg    bx, bx
-
 
687
 
Line 745... Line 688...
745
        call    init_sys_v86
688
        call    v86_init
746
 
689
 
747
        mov     esi, boot_inittimer
690
        mov     esi, boot_inittimer
748
        call    boot_log
691
        call    boot_log
Line 749... Line 692...
749
; Initialize system timer (IRQ0)
692
; Initialize system timer (IRQ0)
750
        call    PIT_init
693
        call    PIT_init
751
 
694
 
752
; Register ramdisk file system
-
 
Line -... Line 695...
-
 
695
; Register ramdisk file system
-
 
696
        cmp     [boot_dev+OS_BASE+0x10000], 1
-
 
697
        je      @f
753
        mov     esi, boot_initramdisk
698
 
754
        call    boot_log
699
        call    register_ramdisk
755
        call    ramdisk_init
700
;--------------------------------------
756
 
701
@@:
Line 764... Line 709...
764
; Enable timer IRQ (IRQ0) and co-processor IRQ (IRQ13)
709
; Enable timer IRQ (IRQ0) and co-processor IRQ (IRQ13)
765
; they are used: when partitions are scanned, hd_read relies on timer
710
; they are used: when partitions are scanned, hd_read relies on timer
766
        call    unmask_timer
711
        call    unmask_timer
767
        stdcall enable_irq, 2               ; @#$%! PIC
712
        stdcall enable_irq, 2               ; @#$%! PIC
768
        stdcall enable_irq, 13              ; co-processor
713
        stdcall enable_irq, 13              ; co-processor
-
 
714
 
-
 
715
; Setup serial output console (if enabled)
-
 
716
if defined debug_com_base
-
 
717
 
-
 
718
        ; reserve port so nobody else will use it
-
 
719
        xor     ebx, ebx
-
 
720
        mov     ecx, debug_com_base
-
 
721
        mov     edx, debug_com_base+7
-
 
722
        call    r_f_port_area
-
 
723
 
-
 
724
        ; enable Divisor latch
-
 
725
        mov     dx, debug_com_base+3
-
 
726
        mov     al, 1 shl 7
-
 
727
        out     dx, al
-
 
728
 
-
 
729
        ; Set speed to 115200 baud (max speed)
-
 
730
        mov     dx, debug_com_base
-
 
731
        mov     al, 0x01
-
 
732
        out     dx, al
-
 
733
 
-
 
734
        mov     dx, debug_com_base+1
-
 
735
        mov     al, 0x00
-
 
736
        out     dx, al
-
 
737
 
-
 
738
        ; No parity, 8bits words, one stop bit, dlab bit back to 0
-
 
739
        mov     dx, debug_com_base+3
-
 
740
        mov     al, 3
-
 
741
        out     dx, al
-
 
742
 
-
 
743
        ; disable interrupts
-
 
744
        mov     dx, debug_com_base+1
-
 
745
        mov     al, 0
-
 
746
        out     dx, al
-
 
747
 
-
 
748
        ; clear +  enable fifo (64 bits)
-
 
749
        mov     dx, debug_com_base+2
-
 
750
        mov     al, 0x7 + 1 shl 5
-
 
751
        out     dx, al
-
 
752
 
-
 
753
end if
-
 
754
 
-
 
755
 
769
;-----------------------------------------------------------------------------
756
;-----------------------------------------------------------------------------
770
; show SVN version of kernel on the message board
757
; show SVN version of kernel on the message board
771
;-----------------------------------------------------------------------------
758
;-----------------------------------------------------------------------------
772
        mov     eax, [version_inf.rev]
759
        mov     eax, [version_inf.rev]
773
        DEBUGF  1, "K : kernel SVN r%d\n", eax
760
        DEBUGF  1, "K : kernel SVN r%d\n", eax
Line 785... Line 772...
785
;-----------------------------------------------------------------------------
772
;-----------------------------------------------------------------------------
786
        mov     esi, boot_detectfloppy
773
        mov     esi, boot_detectfloppy
787
        call    boot_log
774
        call    boot_log
788
include 'detect/dev_fd.inc'
775
include 'detect/dev_fd.inc'
789
;-----------------------------------------------------------------------------
776
;-----------------------------------------------------------------------------
790
; START of initialisation IDE ATA code
-
 
791
;-----------------------------------------------------------------------------
-
 
792
        cmp     [IDEContrProgrammingInterface], 0
-
 
793
        je      @f
-
 
794
 
-
 
795
        mov     esi, boot_disabling_ide
-
 
796
        call    boot_log
-
 
797
;--------------------------------------
-
 
798
; Disable IDE interrupts, because the search
-
 
799
; for IDE partitions is in the PIO mode.
-
 
800
;--------------------------------------
-
 
801
.disable_IDE_interrupt:
-
 
802
; Disable interrupts in IDE controller for PIO
-
 
803
        mov     al, 2
-
 
804
        mov     dx, [IDE_BAR1_val] ;0x3F4
-
 
805
        add     dx, 2 ;0x3F6
-
 
806
        out     dx, al
-
 
807
        mov     dx, [IDE_BAR3_val] ;0x374
-
 
808
        add     dx, 2 ;0x376
-
 
809
        out     dx, al
-
 
810
@@:
-
 
811
; show base variables of IDE controller 
-
 
812
        DEBUGF  1, "K : BAR0 %x \n", [IDE_BAR0_val]:4
-
 
813
        DEBUGF  1, "K : BAR1 %x \n", [IDE_BAR1_val]:4
-
 
814
        DEBUGF  1, "K : BAR2 %x \n", [IDE_BAR2_val]:4
-
 
815
        DEBUGF  1, "K : BAR3 %x \n", [IDE_BAR3_val]:4
-
 
816
        DEBUGF  1, "K : BAR4 %x \n", [IDEContrRegsBaseAddr]:4
-
 
817
        DEBUGF  1, "K : IDEContrProgrammingInterface %x \n", [IDEContrProgrammingInterface]:4
-
 
818
        DEBUGF  1, "K : IDE_Interrupt %x \n", [IDE_Interrupt]:4
-
 
819
;-----------------------------------------------------------------------------
-
 
820
        mov     esi, boot_detecthdcd
-
 
821
        call    boot_log
-
 
822
include 'detect/dev_hdcd.inc'
-
 
823
        mov     esi, boot_getcache
-
 
824
        call    boot_log
-
 
825
include 'detect/getcache.inc'
-
 
826
        mov     esi, boot_detectpart
-
 
827
        call    boot_log
-
 
828
include 'detect/sear_par.inc'
-
 
829
;-----------------------------------------------------------------------------
-
 
830
        mov     dx, [IDEContrRegsBaseAddr]
-
 
831
; test whether it is our interrupt?
-
 
832
        add     dx, 2
-
 
833
        in      al, dx
-
 
834
        test    al, 100b
-
 
835
        jz      @f
-
 
836
; clear Bus Master IDE Status register
-
 
837
; clear Interrupt bit
-
 
838
        out     dx, al
-
 
839
@@:
-
 
840
        add     dx, 8
-
 
841
; test whether it is our interrupt?
-
 
842
        in      al, dx
-
 
843
        test    al, 100b
-
 
844
        jz      @f
-
 
845
; clear Bus Master IDE Status register
-
 
846
; clear Interrupt bit
777
; create pci-devices list
847
        out     dx, al
-
 
848
@@:
-
 
849
; read status register and remove the interrupt request
-
 
850
        mov     dx, [IDE_BAR0_val] ;0x1F0
-
 
851
        add     dx, 0x7 ;0x1F7
-
 
852
        in      al, dx
-
 
853
        mov     dx, [IDE_BAR2_val] ;0x170
-
 
854
        add     dx, 0x7 ;0x177
-
 
855
        in      al, dx
-
 
856
;-----------------------------------------------------------------------------
-
 
857
        push    eax edx
-
 
858
        mov     dx, [IDEContrRegsBaseAddr]
-
 
859
        xor     eax, eax
-
 
860
        add     dx, 2
-
 
861
        in      al, dx
-
 
862
        DEBUGF  1, "K : Primary Bus Master IDE Status Register %x\n", eax
-
 
863
 
-
 
864
        add     dx, 8
-
 
865
        in      al, dx
-
 
866
        DEBUGF  1, "K : Secondary Bus Master IDE Status Register %x\n", eax
-
 
867
        pop     edx eax
-
 
868
 
-
 
869
        cmp     [IDEContrRegsBaseAddr], 0
-
 
870
        setnz   [dma_hdd]
-
 
871
 
-
 
872
        cmp     [IDEContrProgrammingInterface], 0
-
 
873
        je      set_interrupts_for_IDE_controllers.continue
-
 
874
;-----------------------------------------------------------------------------
-
 
875
; set interrupts for IDE Controller
-
 
876
;-----------------------------------------------------------------------------
778
;-----------------------------------------------------------------------------
877
        mov     esi, boot_set_int_IDE
-
 
878
        call    boot_log
-
 
879
set_interrupts_for_IDE_controllers:
-
 
880
        mov     ax, [IDEContrProgrammingInterface]
-
 
881
        cmp     ax, 0x0180
-
 
882
        je      .pata_ide
-
 
883
 
-
 
884
        cmp     ax, 0x018a
-
 
885
        jne     .sata_ide
-
 
886
;--------------------------------------
-
 
887
.pata_ide:
-
 
888
        cmp     [IDEContrRegsBaseAddr], 0
-
 
889
        je      .end_set_interrupts
-
 
890
 
-
 
891
        stdcall attach_int_handler, 14, IDE_irq_14_handler, 0
-
 
892
        DEBUGF  1, "K : Set IDE IRQ14 return code %x\n", eax
-
 
893
        stdcall attach_int_handler, 15, IDE_irq_15_handler, 0
-
 
894
        DEBUGF  1, "K : Set IDE IRQ15 return code %x\n", eax
-
 
895
        jmp     .enable_IDE_interrupt
-
 
896
;--------------------------------------
-
 
897
.sata_ide:
-
 
898
        cmp     ax, 0x0185
-
 
899
        je      .sata_ide_1
-
 
900
 
-
 
901
        cmp     ax, 0x018f
-
 
902
        jne     .end_set_interrupts
-
 
903
;--------------------------------------
-
 
904
.sata_ide_1:
-
 
905
        cmp     [IDEContrRegsBaseAddr], 0
-
 
906
        je      .end_set_interrupts
-
 
907
 
-
 
908
        mov     ax, [IDE_Interrupt]
-
 
909
        movzx   eax, al
-
 
910
        stdcall attach_int_handler, eax, IDE_common_irq_handler, 0
-
 
911
        DEBUGF  1, "K : Set IDE IRQ%d return code %x\n", [IDE_Interrupt]:1, eax
-
 
912
;--------------------------------------
-
 
913
.enable_IDE_interrupt:
-
 
914
        mov     esi, boot_enabling_ide
779
        mov     [pci_access_enabled], 1
915
        call    boot_log
780
        call    pci_enum
916
; Enable interrupts in IDE controller for DMA
-
 
917
        mov     al, 0
-
 
918
        mov     ah, [DRIVE_DATA+1]
-
 
919
        test    ah, 10100000b
-
 
920
        jz      @f
-
 
921
 
-
 
922
        DEBUGF  1, "K : IDE CH1 PIO, because ATAPI drive present\n"
-
 
923
        jmp     .ch2_check
-
 
924
@@:
-
 
925
        mov     dx, [IDE_BAR1_val] ;0x3F4
-
 
926
        add     dx, 2 ;0x3F6
-
 
927
        out     dx, al
-
 
928
        DEBUGF  1, "K : IDE CH1 DMA enabled\n"
-
 
929
.ch2_check:
-
 
930
        test    ah, 1010b
-
 
931
        jz      @f
-
 
932
 
-
 
933
        DEBUGF  1, "K : IDE CH2 PIO, because ATAPI drive present\n"
-
 
934
        jmp     .end_set_interrupts
-
 
935
@@:
-
 
936
        mov     dx, [IDE_BAR3_val] ;0x374
-
 
937
        add     dx, 2 ;0x376
-
 
938
        out     dx, al
-
 
939
        DEBUGF  1, "K : IDE CH2 DMA enabled\n"
-
 
940
;--------------------------------------
-
 
941
.end_set_interrupts:
-
 
942
;-----------------------------------------------------------------------------
781
;-----------------------------------------------------------------------------
943
        cmp     [dma_hdd], 0
-
 
944
        je      .print_pio
-
 
945
.print_dma:
-
 
946
        DEBUGF  1, "K : IDE DMA mode\n"
782
; initialisation IDE ATA code
947
        jmp     .continue
-
 
948
 
-
 
949
.print_pio:
-
 
950
        DEBUGF  1, "K : IDE PIO mode\n"
-
 
951
.continue:
-
 
952
;-----------------------------------------------------------------------------
783
;-----------------------------------------------------------------------------
953
; END of initialisation IDE ATA code
784
include 'detect/init_ata.inc'
954
;-----------------------------------------------------------------------------
785
;-----------------------------------------------------------------------------
955
        mov     esi, boot_init_sys
-
 
956
        call    boot_log
-
 
957
        call    Parser_params
-
 
958
 
-
 
959
if ~ defined extended_primary_loader
-
 
960
; ramdisk image should be loaded by extended primary loader if it exists
-
 
961
; READ RAMDISK IMAGE FROM HD
-
 
962
 
-
 
963
;!!!!!!!!!!!!!!!!!!!!!!!
-
 
964
include 'boot/rdload.inc'
-
 
965
;!!!!!!!!!!!!!!!!!!!!!!!
-
 
966
end if
-
 
967
 
-
 
968
if 0
786
if 0
969
        mov     ax, [OS_BASE+0x10000+bx_from_load]
787
        mov     ax, [OS_BASE+0x10000+bx_from_load]
970
        cmp     ax, 'r1'; if using not ram disk, then load librares and parameters {SPraid.simba}
788
        cmp     ax, 'r1'; if using not ram disk, then load librares and parameters {SPraid.simba}
971
        je      no_lib_load
789
        je      no_lib_load
Line 1013... Line 831...
1013
;        call    build_scheduler; sys32.inc
831
;        call    build_scheduler; sys32.inc
Line 1014... Line 832...
1014
 
832
 
1015
;        mov     esi, boot_devices
833
;        mov     esi, boot_devices
Line 1016... Line -...
1016
;        call    boot_log
-
 
1017
 
-
 
1018
        mov     [pci_access_enabled], 1
834
;        call    boot_log
Line 1019... Line 835...
1019
        call    pci_enum
835
 
Line 1020... Line 836...
1020
        call    clear_pci_ide_interrupts
836
        call    clear_pci_ide_interrupts
Line 1090... Line 906...
1090
 
906
 
Line 1091... Line 907...
1091
        call    set_variables
907
        call    set_variables
Line 1092... Line 908...
1092
 
908
 
1093
; STACK AND FDC
909
; STACK AND FDC
Line 1094... Line 910...
1094
 
910
 
Line 1095... Line 911...
1095
;        call    stack_init
911
        call    stack_init
Line 1133... Line 949...
1133
 
949
 
1134
        cli
950
        cli
1135
        mov     ebp, firstapp
951
        mov     ebp, firstapp
1136
        call    fs_execute_from_sysdir
952
        call    fs_execute_from_sysdir
1137
        test    eax, eax
953
        test    eax, eax
Line 1138... Line 954...
1138
        jnz     first_app_found
954
        jns     first_app_found
1139
 
955
 
Line 1140... Line 956...
1140
        mov     esi, boot_failed
956
        mov     esi, boot_failed
Line 1184... Line 1000...
1184
;        call  kb_read
1000
;        call  kb_read
1185
     ;// mike.dld [
1001
     ;// mike.dld [
1186
        call    set_lights
1002
        call    set_lights
1187
     ;// mike.dld ]
1003
     ;// mike.dld ]
1188
        stdcall attach_int_handler, 1, irq1, 0
1004
        stdcall attach_int_handler, 1, irq1, 0
1189
        DEBUGF  1, "K : IRQ1 error code %x\n", eax
1005
        DEBUGF  1, "K : IRQ1 return code %x\n", eax
1190
.no_keyboard:
1006
.no_keyboard:
Line 1191... Line 1007...
1191
 
1007
 
Line 1192... Line 1008...
1192
; Load PS/2 mouse driver
1008
; Load PS/2 mouse driver
Line 1196... Line 1012...
1196
 
1012
 
1197
        mov     esi, boot_setmouse
1013
        mov     esi, boot_setmouse
1198
        call    boot_log
1014
        call    boot_log
Line 1199... Line -...
1199
        call    setmouse
-
 
1200
 
-
 
1201
; Setup serial output console (if enabled)
-
 
1202
if defined debug_com_base
-
 
1203
 
-
 
1204
        ; reserve port so nobody else will use it
-
 
1205
        xor     ebx, ebx
-
 
1206
        mov     ecx, debug_com_base
-
 
1207
        mov     edx, debug_com_base+7
-
 
1208
        call    r_f_port_area
-
 
1209
 
-
 
1210
        ; enable Divisor latch
-
 
1211
        mov     dx, debug_com_base+3
-
 
1212
        mov     al, 1 shl 7
-
 
1213
        out     dx, al
-
 
1214
 
-
 
1215
        ; Set speed to 115200 baud (max speed)
-
 
1216
        mov     dx, debug_com_base
-
 
1217
        mov     al, 0x01
-
 
1218
        out     dx, al
-
 
1219
 
-
 
1220
        mov     dx, debug_com_base+1
-
 
1221
        mov     al, 0x00
-
 
1222
        out     dx, al
-
 
1223
 
-
 
1224
        ; No parity, 8bits words, one stop bit, dlab bit back to 0
-
 
1225
        mov     dx, debug_com_base+3
-
 
1226
        mov     al, 3
-
 
1227
        out     dx, al
-
 
1228
 
-
 
1229
        ; disable interrupts
-
 
1230
        mov     dx, debug_com_base+1
-
 
1231
        mov     al, 0
-
 
1232
        out     dx, al
-
 
1233
 
-
 
1234
        ; clear +  enable fifo (64 bits)
-
 
1235
        mov     dx, debug_com_base+2
-
 
1236
        mov     al, 0x7 + 1 shl 5
-
 
1237
        out     dx, al
-
 
1238
 
1015
        call    setmouse
Line 1239... Line 1016...
1239
end if
1016
 
1240
; START MULTITASKING
1017
; START MULTITASKING
1241
 
1018
 
Line 1250... Line 1027...
1250
end if
1027
end if
Line 1251... Line 1028...
1251
 
1028
 
Line 1252... Line 1029...
1252
        mov     [timer_ticks_enable], 1         ; for cd driver
1029
        mov     [timer_ticks_enable], 1         ; for cd driver
-
 
1030
 
1253
 
1031
        sti
Line 1254... Line 1032...
1254
        sti
1032
 
Line 1255... Line 1033...
1255
;        call    change_task
1033
        call    mtrr_validate
Line 1339... Line 1117...
1339
        call    Wait_events
1117
        call    Wait_events
1340
        xor     eax, eax
1118
        xor     eax, eax
1341
        xchg    eax, [osloop_nonperiodic_work]
1119
        xchg    eax, [osloop_nonperiodic_work]
1342
        test    eax, eax
1120
        test    eax, eax
1343
        jz      .no_periodic
1121
        jz      .no_periodic
1344
;        call    [draw_pointer]
-
 
-
 
1122
 
1345
        call    __sys_draw_pointer
1123
        call    __sys_draw_pointer
1346
        call    window_check_events
1124
        call    window_check_events
1347
        call    mouse_check_events
1125
        call    mouse_check_events
1348
        call    checkmisc
1126
        call    checkmisc
1349
        call    checkVga_N13
1127
        call    checkVga_N13
-
 
1128
;--------------------------------------
1350
.no_periodic:
1129
.no_periodic:
1351
        call    stack_handler
1130
        call    stack_handler
1352
        call    check_fdd_motor_status
1131
        call    check_fdd_motor_status
1353
        call    check_ATAPI_device_event
1132
        call    check_ATAPI_device_event
1354
        call    check_lights_state
1133
        call    check_lights_state
1355
        call    check_timers
1134
        call    check_timers
-
 
1135
 
1356
        jmp     osloop
1136
        jmp     osloop
1357
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1137
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1358
;                                                                    ;
1138
;                                                                    ;
1359
;                      MAIN OS LOOP END                              ;
1139
;                      MAIN OS LOOP END                              ;
1360
;                                                                    ;
1140
;                                                                    ;
Line 1718... Line 1498...
1718
        mov     ecx, [esp+64+32-12+4]
1498
        mov     ecx, [esp+64+32-12+4]
1719
        and     ecx, not 0x80000000     ; force counted string
1499
        and     ecx, not 0x80000000     ; force counted string
1720
        mov     eax, [esp+64+8]         ; background color (if given)
1500
        mov     eax, [esp+64+8]         ; background color (if given)
1721
        mov     edi, [esp+64+4]
1501
        mov     edi, [esp+64+4]
1722
        jmp     dtext
1502
        jmp     dtext
-
 
1503
;-----------------------------------------------------------------------------
-
 
1504
iglobal
-
 
1505
midi_base dw 0
1723
 
1506
endg
-
 
1507
;-----------------------------------------------------------------------------
1724
align 4
1508
align 4
1725
 
-
 
1726
sys_setup:
1509
sys_setup:
1727
 
-
 
1728
; 1=roland mpu midi base , base io address
1510
;  1 = roland mpu midi base , base io address
1729
; 2=keyboard   1, base kaybap 2, shift keymap, 9 country 1eng 2fi 3ger 4rus
1511
;  2 = keyboard   1, base kaybap 2, shift keymap, 9 country 1eng 2fi 3ger 4rus
1730
; 3=cd base    1, pri.master 2, pri slave 3 sec master, 4 sec slave
1512
;  3 = not used
-
 
1513
;  4 = not used
1731
; 5=system language, 1eng 2fi 3ger 4rus
1514
;  5 = system language, 1eng 2fi 3ger 4rus
-
 
1515
;  6 = not used
1732
; 7=hd base    1, pri.master 2, pri slave 3 sec master, 4 sec slave
1516
;  7 = not used
1733
; 8=fat32 partition in hd
1517
;  8 = not used
1734
; 9
1518
;  9 = not used
1735
; 10 = sound dma channel
1519
; 10 = not used
1736
; 11 = enable lba read
1520
; 11 = enable lba read
1737
; 12 = enable pci access
1521
; 12 = enable pci access
1738
 
-
 
1739
 
-
 
-
 
1522
;-----------------------------------------------------------------------------
1740
        and     [esp+32], dword 0
1523
        and     [esp+32], dword 0
-
 
1524
; F.21.1 - set MPU MIDI base port
1741
        dec     ebx                             ; MIDI
1525
        dec     ebx
1742
        jnz     nsyse1
1526
        jnz     @f
-
 
1527
 
1743
        cmp     ecx, 0x100
1528
        cmp     ecx, 0x100
-
 
1529
        jb      @f
Line 1744... Line -...
1744
 
-
 
1745
        jb      nsyse1
1530
 
1746
        mov     esi, 65535
1531
        mov     esi, 65535
-
 
1532
        cmp     esi, ecx
Line 1747... Line -...
1747
        cmp     esi, ecx
-
 
1748
 
1533
        jb      @f
1749
        jb      nsyse1
1534
 
1750
        mov     [midi_base], cx ;bx
1535
        mov     [midi_base], cx
1751
        mov     word [mididp], cx;bx
1536
        mov     word [mididp], cx
1752
        inc     cx              ;bx
1537
        inc     cx
-
 
1538
        mov     word [midisp], cx
-
 
1539
        ret
-
 
1540
;--------------------------------------
-
 
1541
@@:
-
 
1542
; F.21.2 - set keyboard layout
Line 1753... Line -...
1753
        mov     word [midisp], cx;bx
-
 
1754
        ret
-
 
1755
 
-
 
1756
iglobal
-
 
1757
midi_base dw 0
-
 
1758
endg
-
 
1759
 
-
 
1760
   nsyse1:
1543
        dec     ebx
1761
        dec     ebx                              ; KEYBOARD
1544
        jnz     @f
1762
        jnz     nsyse2
1545
 
1763
        mov     edi, [TASK_BASE]
-
 
-
 
1546
        mov     edi, [TASK_BASE]
1764
        mov     eax, [edi+TASKDATA.mem_start]
1547
        mov     eax, [edi+TASKDATA.mem_start]
1765
        add     eax, edx
1548
        add     eax, edx
-
 
1549
; 1 = normal layout
1766
 
1550
        dec     ecx
1767
        dec     ecx
1551
        jnz     .shift
1768
        jnz     kbnobase
1552
 
1769
        mov     ebx, keymap
1553
        mov     ebx, keymap
-
 
1554
        mov     ecx, 128
1770
        mov     ecx, 128
1555
        call    memmove
-
 
1556
        ret
1771
        call    memmove
1557
;--------------------------------------
1772
        ret
1558
.shift:
Line 1773... Line 1559...
1773
   kbnobase:
1559
; 2 = layout at pressed Shift
1774
        dec     ecx
1560
        dec     ecx
1775
        jnz     kbnoshift
1561
        jnz     .alt
1776
 
1562
 
-
 
1563
        mov     ebx, keymap_shift
-
 
1564
        mov     ecx, 128
1777
        mov     ebx, keymap_shift
1565
        call    memmove
1778
        mov     ecx, 128
1566
        ret
1779
        call    memmove
1567
;--------------------------------------
-
 
1568
.alt:
1780
        ret
1569
; 3 = layout at pressed Alt
1781
   kbnoshift:
1570
        dec     ecx
1782
        dec     ecx
1571
        jnz     .country
1783
        jnz     kbnoalt
1572
 
-
 
1573
        mov     ebx, keymap_alt
1784
        mov     ebx, keymap_alt
1574
        mov     ecx, 128
-
 
1575
        call    memmove
1785
        mov     ecx, 128
1576
        ret
1786
        call    memmove
-
 
1787
        ret
-
 
1788
   kbnoalt:
-
 
1789
        sub     ecx, 6
-
 
1790
        jnz     kbnocountry
-
 
1791
        mov     word [keyboard], dx
-
 
1792
        ret
-
 
1793
   kbnocountry:
-
 
1794
        mov     [esp+32], dword 1
-
 
1795
        ret
-
 
1796
   nsyse2:
-
 
1797
        dec     ebx                         ; CD
-
 
1798
        jnz     nsyse4
-
 
1799
 
-
 
1800
        test    ecx, ecx
-
 
1801
        jz      nosesl
-
 
1802
 
-
 
1803
        cmp     ecx, 4
-
 
1804
        ja      nosesl
1577
;--------------------------------------
1805
        mov     [cd_base], cl
-
 
1806
 
-
 
1807
        dec     ecx
-
 
1808
        jnz     noprma
-
 
Line 1809... Line -...
1809
        mov     eax, [hd_address_table]
-
 
1810
        mov     [cdbase], eax   ;0x1f0
-
 
1811
        mov     [cdid], 0xa0
-
 
1812
   noprma:
-
 
1813
 
1578
.country:
1814
        dec     ecx
-
 
1815
        jnz     noprsl
-
 
1816
        mov     eax, [hd_address_table]
-
 
1817
        mov     [cdbase], eax   ;0x1f0
-
 
1818
        mov     [cdid], 0xb0
-
 
1819
   noprsl:
-
 
1820
        dec     ecx
-
 
1821
        jnz     nosema
-
 
1822
        mov     eax, [hd_address_table+16]
-
 
1823
        mov     [cdbase], eax   ;0x170
-
 
1824
        mov     [cdid], 0xa0
-
 
1825
   nosema:
-
 
1826
        dec     ecx
-
 
1827
        jnz     nosesl
1579
; country identifier
-
 
1580
        sub     ecx, 6
-
 
1581
        jnz     .error
-
 
1582
 
-
 
1583
        mov     word [keyboard], dx
-
 
1584
        ret
Line 1828... Line -...
1828
        mov     eax, [hd_address_table+16]
-
 
1829
        mov     [cdbase], eax   ;0x170
-
 
1830
        mov     [cdid], 0xb0
-
 
1831
   nosesl:
-
 
1832
        ret
-
 
1833
 
-
 
1834
iglobal
-
 
1835
cd_base db 0
-
 
1836
 
1585
;--------------------------------------
1837
endg
1586
@@:
1838
   nsyse4:
-
 
1839
 
-
 
1840
        sub     ebx, 2           ; SYSTEM LANGUAGE
1587
; F.21.5 - set system language
1841
        jnz     nsyse5
-
 
1842
        mov     [syslang], ecx
1588
        sub     ebx, 3
1843
        ret
-
 
1844
   nsyse5:
-
 
1845
 
-
 
1846
        sub     ebx, 2          ; HD BASE - obsolete
-
 
1847
        jnz     nsyse7
-
 
1848
 
-
 
1849
   nosethd:
-
 
1850
        ret
-
 
1851
 
-
 
1852
nsyse7:
-
 
1853
 
-
 
1854
;     cmp  eax,8                      ; HD PARTITION - obsolete
1589
        jnz     @f
1855
        dec     ebx
1590
 
1856
        jnz     nsyse8
1591
        mov     [syslang], ecx
1857
        ret
1592
        ret
-
 
1593
;--------------------------------------
1858
 
1594
@@:
1859
nsyse8:
1595
; F.21.11 - enable/disable low-level access to HD
-
 
1596
        and     ecx, 1
1860
;     cmp  eax,11                     ; ENABLE LBA READ
1597
        sub     ebx, 6
1861
        and     ecx, 1
-
 
1862
        sub     ebx, 3
1598
        jnz     @f
1863
        jnz     no_set_lba_read
1599
 
1864
        mov     [lba_read_enabled], ecx
1600
        mov     [lba_read_enabled], ecx
-
 
1601
        ret
1865
        ret
1602
;--------------------------------------
1866
 
1603
@@:
1867
no_set_lba_read:
-
 
-
 
1604
; F.21.12 - enable/disable low-level access to PCI
1868
;     cmp  eax,12                     ; ENABLE PCI ACCESS
1605
        dec     ebx
1869
        dec     ebx
1606
        jnz     .error
1870
        jnz     sys_setup_err
1607
 
1871
        mov     [pci_access_enabled], ecx
-
 
-
 
1608
        mov     [pci_access_enabled], ecx
1872
        ret
1609
        ret
1873
 
-
 
1874
sys_setup_err:
1610
;--------------------------------------
1875
        or      [esp+32], dword -1
-
 
1876
        ret
1611
.error:
1877
 
1612
        or      [esp+32], dword -1
1878
align 4
1613
        ret
-
 
1614
;-----------------------------------------------------------------------------
1879
 
1615
align 4
-
 
1616
sys_getsetup:
1880
sys_getsetup:
1617
;  1 = roland mpu midi base , base io address
1881
 
1618
;  2 = keyboard   1, base kaybap 2, shift keymap, 9 country 1eng 2fi 3ger 4rus
1882
; 1=roland mpu midi base , base io address
1619
;  3 = not used
1883
; 2=keyboard   1, base kaybap 2, shift keymap, 9 country 1eng 2fi 3ger 4rus
-
 
1884
; 3=cd base    1, pri.master 2, pri slave 3 sec master, 4 sec slave
1620
;  4 = not used
-
 
1621
;  5 = system language, 1eng 2fi 3ger 4rus
-
 
1622
;  6 = not used
-
 
1623
;  7 = not used
-
 
1624
;  8 = not used
1885
; 5=system language, 1eng 2fi 3ger 4rus
1625
;  9 = get hs timer tic
1886
; 7=hd base    1, pri.master 2, pri slave 3 sec master, 4 sec slave
1626
; 10 = not used
-
 
1627
; 11 = get the state "lba read"
1887
; 8=fat32 partition in hd
1628
; 12 = get the state "pci access"
1888
; 9=get hs timer tic
1629
;-----------------------------------------------------------------------------
1889
 
1630
; F.26.1 - get MPU MIDI base port
-
 
1631
        dec     ebx
1890
;     cmp  eax,1
1632
        jnz     @f
1891
        dec     ebx
1633
 
1892
        jnz     ngsyse1
1634
        movzx   eax, [midi_base]
1893
        movzx   eax, [midi_base]
1635
        mov     [esp+32], eax
Line 1894... Line 1636...
1894
        mov     [esp+32], eax
1636
        ret
1895
        ret
1637
;--------------------------------------
1896
ngsyse1:
1638
@@:
1897
;     cmp  eax,2
-
 
1898
        dec     ebx
1639
; F.26.2 - get keyboard layout
1899
        jnz     ngsyse2
1640
        dec     ebx
1900
 
1641
        jnz     @f
-
 
1642
 
1901
        mov     edi, [TASK_BASE]
1643
        mov     edi, [TASK_BASE]
1902
        mov     ebx, [edi+TASKDATA.mem_start]
1644
        mov     ebx, [edi+TASKDATA.mem_start]
1903
        add     ebx, edx
1645
        add     ebx, edx
1904
 
1646
; 1 = normal layout
-
 
1647
        dec     ecx
1905
;     cmp  ebx,1
1648
        jnz     .shift
1906
        dec     ecx
1649
 
1907
        jnz     kbnobaseret
1650
        mov     eax, keymap
1908
        mov     eax, keymap
1651
        mov     ecx, 128
Line 1909... Line 1652...
1909
        mov     ecx, 128
1652
        call    memmove
1910
        call    memmove
1653
        ret
1911
        ret
1654
;--------------------------------------
1912
kbnobaseret:
1655
.shift:
-
 
1656
; 2 = layout with pressed Shift
1913
;     cmp  ebx,2
1657
        dec     ecx
1914
        dec     ecx
1658
        jnz     .alt
1915
        jnz     kbnoshiftret
1659
 
1916
 
1660
        mov     eax, keymap_shift
Line 1917... Line 1661...
1917
        mov     eax, keymap_shift
1661
        mov     ecx, 128
1918
        mov     ecx, 128
1662
        call    memmove
1919
        call    memmove
1663
        ret
1920
        ret
1664
;--------------------------------------
-
 
1665
.alt:
1921
kbnoshiftret:
1666
; 3 = layout with pressed Alt
1922
;     cmp  ebx,3
1667
        dec     ecx
1923
        dec     ecx
1668
        jne     .country
1924
        jne     kbnoaltret
1669
 
-
 
1670
        mov     eax, keymap_alt
1925
 
1671
        mov     ecx, 128
1926
        mov     eax, keymap_alt
1672
        call    memmove
1927
        mov     ecx, 128
1673
        ret
-
 
1674
;--------------------------------------
-
 
1675
.country:
-
 
1676
; 9 = country identifier
-
 
1677
        sub     ecx, 6
-
 
1678
        jnz     .error
Line 1928... Line -...
1928
        call    memmove
-
 
1929
        ret
-
 
1930
kbnoaltret:
-
 
1931
;     cmp  ebx,9
-
 
1932
        sub     ecx, 6
-
 
1933
        jnz     ngsyse2
-
 
1934
        movzx   eax, word [keyboard]
-
 
1935
        mov     [esp+32], eax
-
 
1936
        ret
-
 
1937
 
-
 
1938
 
-
 
1939
ngsyse2:
-
 
1940
;         cmp  eax,3
1679
 
1941
        dec     ebx
1680
        movzx   eax, word [keyboard]
1942
        jnz     ngsyse3
1681
        mov     [esp+32], eax
-
 
1682
        ret
1943
        movzx   eax, [cd_base]
1683
;--------------------------------------
1944
        mov     [esp+32], eax
1684
@@:
1945
        ret
1685
; F.26.5 - get system language
1946
ngsyse3:
1686
        sub     ebx, 3
-
 
1687
        jnz     @f
1947
;         cmp  eax,5
1688
 
1948
        sub     ebx, 2
1689
        mov     eax, [syslang]
1949
        jnz     ngsyse5
1690
        mov     [esp+32], eax
-
 
1691
        ret
1950
        mov     eax, [syslang]
1692
;--------------------------------------
1951
        mov     [esp+32], eax
1693
@@:
1952
        ret
1694
; F.26.9 - get the value of the time counter
1953
ngsyse5:
1695
        sub     ebx, 4
-
 
1696
        jnz     @f
1954
;     cmp  eax,9
1697
 
1955
        sub     ebx, 4
1698
        mov     eax, [timer_ticks]
1956
        jnz     ngsyse9
1699
        mov     [esp+32], eax
-
 
1700
        ret
1957
        mov     eax, [timer_ticks];[0xfdf0]
1701
;--------------------------------------
1958
        mov     [esp+32], eax
1702
@@:
1959
        ret
1703
; F.26.11 - Find out whether low-level HD access is enabled
1960
ngsyse9:
1704
        sub     ebx, 2
-
 
1705
        jnz     @f
1961
;     cmp  eax,11
1706
 
1962
        sub     ebx, 2
1707
        mov     eax, [lba_read_enabled]
1963
        jnz     ngsyse11
1708
        mov     [esp+32], eax
-
 
1709
        ret
1964
        mov     eax, [lba_read_enabled]
1710
;--------------------------------------
1965
        mov     [esp+32], eax
1711
@@:
1966
        ret
1712
; F.26.12 - Find out whether low-level PCI access is enabled
1967
ngsyse11:
-
 
1968
;     cmp  eax,12
-
 
-
 
1713
        dec     ebx
1969
        dec     ebx
1714
        jnz     .error
1970
        jnz     ngsyse12
1715
 
1971
        mov     eax, [pci_access_enabled]
1716
        mov     eax, [pci_access_enabled]
1972
        mov     [esp+32], eax
-
 
-
 
1717
        mov     [esp+32], eax
1973
        ret
1718
        ret
1974
ngsyse12:
1719
;--------------------------------------
1975
        mov     [esp+32], dword 1
1720
.error:
1976
        ret
1721
        or      [esp+32], dword -1
1977
 
1722
        ret
1978
 
1723
;-----------------------------------------------------------------------------
1979
get_timer_ticks:
1724
get_timer_ticks:
1980
        mov     eax, [timer_ticks]
1725
        mov     eax, [timer_ticks]
1981
        ret
-
 
-
 
1726
        ret
1982
 
1727
;-----------------------------------------------------------------------------
Line 1983... Line 1728...
1983
iglobal
1728
iglobal
1984
align 4
1729
align 4
1985
mousefn dd msscreen, mswin, msbutton, msset
1730
mousefn dd msscreen, mswin, msbutton, msset
Line 2459... Line 2204...
2459
        call    wakeup_osloop
2204
        call    wakeup_osloop
2460
        ret
2205
        ret
2461
;------------------------------------------------------------------------------
2206
;------------------------------------------------------------------------------
2462
align 4
2207
align 4
2463
sysfn_getdiskinfo:      ; 18.11 = get disk info table
2208
sysfn_getdiskinfo:      ; 18.11 = get disk info table
2464
;     cmp  ecx,1
-
 
2465
        dec     ecx
2209
        dec     ecx
2466
        jnz     full_table
2210
        jnz     .exit
2467
  small_table:
2211
.small_table:
2468
        call    for_all_tables
-
 
2469
        mov     ecx, 10
-
 
2470
        cld
-
 
2471
        rep movsb
-
 
2472
        ret
-
 
2473
   for_all_tables:
-
 
2474
        mov     edi, edx
2212
        mov     edi, edx
2475
        mov     esi, DRIVE_DATA
2213
        mov     esi, DRIVE_DATA
2476
        ret
-
 
2477
  full_table:
-
 
2478
;     cmp  ecx,2
-
 
2479
        dec     ecx
-
 
2480
        jnz     exit_for_anyone
-
 
2481
        call    for_all_tables
-
 
2482
        mov     ecx, DRIVE_DATA_SIZE/4
2214
        mov     ecx, DRIVE_DATA_SIZE ;10
2483
        cld
2215
        cld
2484
        rep movsd
2216
        rep movsb
-
 
2217
.exit:
2485
        ret
2218
        ret
2486
;------------------------------------------------------------------------------
2219
;------------------------------------------------------------------------------
2487
sysfn_lastkey:          ; 18.12 = return 0 (backward compatibility)
2220
sysfn_lastkey:          ; 18.12 = return 0 (backward compatibility)
2488
        and     dword [esp+32], 0
2221
        and     dword [esp+32], 0
2489
        ret
2222
        ret
Line 2511... Line 2244...
2511
; removed here by 
2244
; removed here by 
2512
;     call  mouse_centered
2245
;     call  mouse_centered
2513
;* mouse centered - start code- Mario79
2246
;* mouse centered - start code- Mario79
2514
;mouse_centered:
2247
;mouse_centered:
2515
;        push  eax
2248
;        push  eax
2516
        mov     eax, [Screen_Max_X]
2249
        mov     eax, [_display.width]
2517
        shr     eax, 1
2250
        shr     eax, 1
2518
        mov     [MOUSE_X], ax
2251
        mov     [MOUSE_X], ax
2519
        mov     eax, [Screen_Max_Y]
2252
        mov     eax, [_display.height]
2520
        shr     eax, 1
2253
        shr     eax, 1
2521
        mov     [MOUSE_Y], ax
2254
        mov     [MOUSE_Y], ax
2522
        call    wakeup_osloop
2255
        call    wakeup_osloop
2523
;        ret
2256
;        ret
2524
;* mouse centered - end code- Mario79
2257
;* mouse centered - end code- Mario79
Line 2556... Line 2289...
2556
        ret
2289
        ret
2557
 .set_pointer_position:
2290
 .set_pointer_position:
2558
;     cmp  ecx,4  ; set mouse pointer position
2291
;     cmp  ecx,4  ; set mouse pointer position
2559
        dec     ecx
2292
        dec     ecx
2560
        jnz     .set_mouse_button
2293
        jnz     .set_mouse_button
2561
        cmp     dx, word[Screen_Max_Y]
2294
        cmp     dx, word[_display.height]
2562
        ja      .end
2295
        jae     .end
2563
        rol     edx, 16
2296
        rol     edx, 16
2564
        cmp     dx, word[Screen_Max_X]
2297
        cmp     dx, word[_display.width]
2565
        ja      .end
2298
        jae      .end
2566
        mov     [MOUSE_X], edx
2299
        mov     [MOUSE_X], edx
2567
        mov     [mouse_active], 1
2300
        mov     [mouse_active], 1
2568
        call    wakeup_osloop
2301
        call    wakeup_osloop
2569
        ret
2302
        ret
2570
 .set_mouse_button:
2303
 .set_mouse_button:
Line 2987... Line 2720...
2987
nosb8:
2720
nosb8:
2988
        cmp     ebx, 9
2721
        cmp     ebx, 9
2989
        jnz     nosb9
2722
        jnz     nosb9
2990
; ecx = [left]*65536 + [right]
2723
; ecx = [left]*65536 + [right]
2991
; edx = [top]*65536 + [bottom]
2724
; edx = [top]*65536 + [bottom]
2992
        mov     eax, [Screen_Max_X]
2725
        mov     eax, [_display.width]
2993
        mov     ebx, [Screen_Max_Y]
2726
        mov     ebx, [_display.height]
2994
; check [right]
2727
; check [right]
2995
        cmp     cx, ax
2728
        cmp     cx, ax
2996
        ja      .exit
2729
        jae     .exit
2997
; check [left]
2730
; check [left]
2998
        ror     ecx, 16
2731
        ror     ecx, 16
2999
        cmp     cx, ax
2732
        cmp     cx, ax
3000
        ja      .exit
2733
        jae     .exit
3001
; check [bottom]
2734
; check [bottom]
3002
        cmp     dx, bx
2735
        cmp     dx, bx
3003
        ja      .exit
2736
        jae     .exit
3004
; check [top]
2737
; check [top]
3005
        ror     edx, 16
2738
        ror     edx, 16
3006
        cmp     dx, bx
2739
        cmp     dx, bx
3007
        ja      .exit
2740
        jae     .exit
Line 3008... Line 2741...
3008
 
2741
 
3009
        movzx   eax, cx  ; [left]
2742
        movzx   eax, cx  ; [left]
Line 3010... Line 2743...
3010
        movzx   ebx, dx  ; [top]
2743
        movzx   ebx, dx  ; [top]
Line 3115... Line 2848...
3115
        mov     edx, [TASK_COUNT]
2848
        mov     edx, [TASK_COUNT]
3116
        cmp     ecx, edx
2849
        cmp     ecx, edx
3117
        jne     .finish
2850
        jne     .finish
3118
        cmp     [KEY_COUNT], byte 0
2851
        cmp     [KEY_COUNT], byte 0
3119
        je      .finish
2852
        je      .finish
-
 
2853
        movzx   ax, byte [KEY_BUFF + 120 + 2]
-
 
2854
        shl     eax, 8
3120
        movzx   eax, byte [KEY_BUFF]
2855
        mov     al, byte [KEY_BUFF]
3121
        shl     eax, 8
2856
        shl     eax, 8
3122
        push    eax
2857
        push    eax
3123
        dec     byte [KEY_COUNT]
2858
        dec     byte [KEY_COUNT]
3124
        and     byte [KEY_COUNT], 127
2859
        and     byte [KEY_COUNT], 127
3125
        movzx   ecx, byte [KEY_COUNT]
2860
        movzx   ecx, byte [KEY_COUNT]
3126
        add     ecx, 2
2861
        add     ecx, 2
3127
        mov     eax, KEY_BUFF + 1
2862
        mov     eax, KEY_BUFF + 1
3128
        mov     ebx, KEY_BUFF
2863
        mov     ebx, KEY_BUFF
3129
        call    memmove
2864
        call    memmove
-
 
2865
        add     eax, 120 + 2
-
 
2866
        add     ebx, 120 + 2
-
 
2867
        call    memmove
3130
        pop     eax
2868
        pop     eax
3131
;--------------------------------------
2869
;--------------------------------------
3132
align 4
2870
align 4
3133
.ret_eax:
2871
.ret_eax:
3134
        mov     [esp + 32], eax
2872
        mov     [esp + 32], eax
Line 4967... Line 4705...
4967
        add     word [msg_board_pos+2], 6
4705
        add     word [msg_board_pos+2], 6
4968
        cmp     bl, 10
4706
        cmp     bl, 10
4969
        jnz     @f
4707
        jnz     @f
4970
        mov     word [msg_board_pos+2], (42*6)
4708
        mov     word [msg_board_pos+2], (42*6)
4971
        add     word [msg_board_pos], 10
4709
        add     word [msg_board_pos], 10
4972
        mov     ax, word [Screen_Max_Y]
4710
        mov     ax, word [_display.height]
4973
        cmp     word [msg_board_pos], ax
4711
        cmp     word [msg_board_pos], ax
4974
        jbe     @f
4712
        jb      @f
4975
        mov     word [msg_board_pos], 10
4713
        mov     word [msg_board_pos], 10
4976
@@:
4714
@@:
4977
; // end if
4715
; // end if
Line 4978... Line 4716...
4978
 
4716
 
Line 5279... Line 5017...
5279
        mov     ax, word [Screen_Max_X]
5017
        mov     ax, word [Screen_Max_X]
5280
        shl     eax, 16
5018
        shl     eax, 16
5281
        mov     ax, word [Screen_Max_Y]
5019
        mov     ax, word [Screen_Max_Y]
5282
        mov     [esp + 32], eax
5020
        mov     [esp + 32], eax
5283
        ret
5021
        ret
5284
 
-
 
-
 
5022
;-----------------------------------------------------------------------------
5285
align 4
5023
align 4
-
 
5024
syscall_cdaudio:
-
 
5025
; ECX - position of CD/DVD-drive
-
 
5026
; from 0=Primary Master to 3=Secondary Slave for first IDE contr.
-
 
5027
; from 4=Primary Master to 7=Secondary Slave for second IDE contr.
-
 
5028
; from 8=Primary Master to 11=Secondary Slave for third IDE contr.
-
 
5029
        cmp     ecx, 11
-
 
5030
        ja      .exit
Line -... Line 5031...
-
 
5031
 
-
 
5032
        mov     eax, ecx
5286
 
5033
        shr     eax, 2
-
 
5034
        lea     eax, [eax*5]
-
 
5035
        mov     al, [eax+DRIVE_DATA+1]
-
 
5036
 
-
 
5037
        push    ecx ebx
-
 
5038
        mov     ebx, ecx
-
 
5039
        and     ebx, 11b
-
 
5040
        shl     ebx, 1
-
 
5041
        mov     cl, 6
-
 
5042
        sub     cl, bl
-
 
5043
        shr     al, cl
-
 
5044
        test    al, 2 ; it's not an ATAPI device
-
 
5045
        pop     ebx ecx
-
 
5046
 
Line 5287... Line 5047...
5287
syscall_cdaudio:                        ; CD
5047
        jz      .exit
5288
 
-
 
5289
        cmp     ebx, 4
5048
 
-
 
5049
        cmp     ebx, 4
5290
        jb      .audio
5050
        je      .eject
5291
        jz      .eject
5051
 
-
 
5052
        cmp     ebx, 5
-
 
5053
        je      .load
-
 
5054
;--------------------------------------
-
 
5055
.exit:
5292
        cmp     ebx, 5
5056
        ret
5293
        jnz     .ret
5057
;--------------------------------------
5294
.load:
5058
.load:
5295
        call    .reserve
-
 
5296
        call    LoadMedium
5059
        call    .reserve
5297
        ;call    .free
5060
        call    LoadMedium
5298
        jmp     .free
5061
        jmp     .free
5299
;        ret
5062
;--------------------------------------
5300
.eject:
5063
.eject:
5301
        call    .reserve
5064
        call    .reserve
5302
        call    clear_CD_cache
5065
        call    clear_CD_cache
5303
        call    allow_medium_removal
-
 
5304
        call    EjectMedium
5066
        call    allow_medium_removal
5305
;        call    .free
-
 
5306
        jmp     .free
-
 
5307
;        ret
-
 
5308
.audio:
5067
        call    EjectMedium
5309
        call    sys_cd_audio
-
 
5310
        mov     [esp+36-4], eax
-
 
5311
.ret:
-
 
5312
        ret
5068
        jmp     .free
5313
 
5069
;--------------------------------------
-
 
5070
.reserve:
-
 
5071
        call    reserve_cd
-
 
5072
 
-
 
5073
        mov     ebx, ecx
-
 
5074
        inc     ebx
5314
.reserve:
5075
        mov     [cdpos], ebx
5315
        call    reserve_cd
5076
 
5316
        mov     eax, ecx
5077
        mov     eax, ecx
5317
        shr     eax, 1
5078
        shr     eax, 1
5318
        and     eax, 1
5079
        and     eax, 1
5319
        inc     eax
5080
        inc     eax
5320
        mov     [ChannelNumber], ax
5081
        mov     [ChannelNumber], ax
5321
        mov     eax, ecx
5082
        mov     eax, ecx
5322
        and     eax, 1
5083
        and     eax, 1
5323
        mov     [DiskNumber], al
-
 
5324
        call    reserve_cd_channel
-
 
5325
        and     ebx, 3
-
 
5326
        inc     ebx
-
 
5327
        mov     [cdpos], ebx
-
 
5328
        add     ebx, ebx
-
 
5329
        mov     cl, 8
-
 
5330
        sub     cl, bl
-
 
5331
        mov     al, [DRIVE_DATA+1]
-
 
5332
        shr     al, cl
-
 
5333
        test    al, 2
5084
        mov     [DiskNumber], al
-
 
5085
        call    reserve_cd_channel
5334
        jz      .free;.err
5086
        ret
5335
        ret
5087
;--------------------------------------
5336
.free:
5088
.free:
5337
        call    free_cd_channel
5089
        call    free_cd_channel
5338
        and     [cd_status], 0
-
 
5339
        ret
-
 
5340
.err:
-
 
5341
        call    .free
-
 
5342
;        pop     eax
5090
        and     [cd_status], 0
5343
        ret
5091
        ret
5344
;-----------------------------------------------------------------------------
5092
;-----------------------------------------------------------------------------
5345
align 4
5093
align 4
5346
syscall_getpixel_WinMap:                       ; GetPixel WinMap
5094
syscall_getpixel_WinMap:                       ; GetPixel WinMap
5347
        cmp     ebx, [Screen_Max_X]
5095
        cmp     ebx, [_display.width]
5348
        jbe     @f
5096
        jb      @f
5349
        cmp     ecx, [Screen_Max_Y]
5097
        cmp     ecx, [_display.height]
5350
        jbe     @f
5098
        jb      @f
5351
        xor     eax, eax
5099
        xor     eax, eax
5352
        jmp     .store
5100
        jmp     .store
5353
;--------------------------------------
5101
;--------------------------------------
Line 5362... Line 5110...
5362
        mov     [esp + 32], eax
5110
        mov     [esp + 32], eax
5363
        ret
5111
        ret
5364
;-----------------------------------------------------------------------------
5112
;-----------------------------------------------------------------------------
5365
align 4
5113
align 4
5366
syscall_getpixel:                       ; GetPixel
5114
syscall_getpixel:                       ; GetPixel
5367
        mov     ecx, [Screen_Max_X]
5115
        mov     ecx, [_display.width]
5368
        inc     ecx
-
 
5369
        xor     edx, edx
5116
        xor     edx, edx
5370
        mov     eax, ebx
5117
        mov     eax, ebx
5371
        div     ecx
5118
        div     ecx
5372
        mov     ebx, edx
5119
        mov     ebx, edx
5373
        xchg    eax, ebx
5120
        xchg    eax, ebx
Line 5736... Line 5483...
5736
        cmp     byte [BOOT_VARS+0x9030], 1
5483
        cmp     byte [BOOT_VARS+0x9030], 1
5737
        jne     @F
5484
        jne     @F
5738
        ret
5485
        ret
5739
@@:
5486
@@:
5740
        call    stop_all_services
5487
        call    stop_all_services
5741
        movi    eax, 3
-
 
5742
        call    sys_cd_audio
-
 
Line 5743... Line 5488...
5743
 
5488
 
5744
yes_shutdown_param:
5489
yes_shutdown_param:
Line 5745... Line 5490...
5745
        cli
5490
        cli