Subversion Repositories Kolibri OS

Rev

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

Rev 3589 Rev 3626
Line 69... Line 69...
69
format binary as "mnt"
69
format binary as "mnt"
Line 70... Line 70...
70
 
70
 
71
include 'macros.inc'
71
include 'macros.inc'
Line 72... Line 72...
72
include 'struct.inc'
72
include 'struct.inc'
Line 73... Line 73...
73
 
73
 
-
 
74
$Revision: 3626 $
Line 74... Line 75...
74
$Revision: 3589 $
75
 
75
 
76
 
76
 
77
USE_COM_IRQ     equ 1      ; make irq 3 and irq 4 available for PCI devices
77
USE_COM_IRQ     equ 1      ; make irq 3 and irq 4 available for PCI devices
78
VESA_1_2_VIDEO  equ 0      ; enable vesa 1.2 bank switch functions
Line 228... Line 229...
228
        dw     11011111b *256 +10010010b
229
        dw     11011111b *256 +10010010b
229
        db     0x00
230
        db     0x00
Line 230... Line 231...
230
 
231
 
Line -... Line 232...
-
 
232
include "data16.inc"
-
 
233
 
-
 
234
if ~ lang eq sp
-
 
235
diff16 "end of bootcode",0,$+0x10000
231
include "data16.inc"
236
end if
232
 
237
 
Line 233... Line 238...
233
use32
238
use32
234
org $+0x10000
239
org $+0x10000
Line 404... Line 409...
404
        mov     [display_height_standard], eax
409
        mov     [display_height_standard], eax
405
        dec     eax
410
        dec     eax
406
        mov     [Screen_Max_Y], eax
411
        mov     [Screen_Max_Y], eax
407
        mov     [screen_workarea.bottom], eax
412
        mov     [screen_workarea.bottom], eax
408
        movzx   eax, word [BOOT_VAR+BOOT_VESA_MODE]; screen mode
413
        movzx   eax, word [BOOT_VAR+BOOT_VESA_MODE] ; screen mode
409
        mov     [SCR_MODE], eax
414
        mov     dword [SCR_MODE], eax
410
;        mov     eax, [BOOT_VAR+0x9014]    ; Vesa 1.2 bnk sw add
415
;        mov     eax, [BOOT_VAR+0x9014]    ; Vesa 1.2 bnk sw add
411
;        mov     [BANK_SWITCH], eax
416
;        mov     [BANK_SWITCH], eax
412
        mov     [BytesPerScanLine], word 640*4      ; Bytes PerScanLine
417
        mov     eax, 640 *4                         ; Bytes PerScanLine
413
        cmp     [SCR_MODE], word 0x13       ; 320x200
418
        cmp     [SCR_MODE], word 0x13       ; 320x200
414
        je      @f
419
        je      @f
415
        cmp     [SCR_MODE], word 0x12       ; VGA 640x480
420
        cmp     [SCR_MODE], word 0x12       ; VGA 640x480
416
        je      @f
421
        je      @f
417
        movzx   eax, word[BOOT_VAR+BOOT_PITCH]      ; for other modes
422
        movzx   eax, word[BOOT_VAR+BOOT_PITCH]      ; for other modes
418
        mov     [BytesPerScanLine], ax
-
 
419
        mov     [_display.pitch], eax
-
 
420
@@:
423
@@:
-
 
424
        mov     [_display.pitch], eax
421
        mov     eax, [_display.width]
425
        mov     eax, [_display.width]
422
        mul     [_display.height]
426
        mul     [_display.height]
423
        mov     [_WinMapSize], eax
427
        mov     [_WinMapSize], eax
Line 424... Line 428...
424
 
428
 
Line 656... Line 660...
656
        mov     esi, boot_inittimer
660
        mov     esi, boot_inittimer
657
        call    boot_log
661
        call    boot_log
658
; Initialize system timer (IRQ0)
662
; Initialize system timer (IRQ0)
659
        call    PIT_init
663
        call    PIT_init
Line -... Line 664...
-
 
664
 
-
 
665
; CALCULATE FAT CHAIN FOR RAMDISK
-
 
666
 
-
 
667
        call    calculatefatchain
660
 
668
 
661
        mov     esi, boot_initapic
669
        mov     esi, boot_initapic
662
        call    boot_log
670
        call    boot_log
663
; Try to Initialize APIC
671
; Try to Initialize APIC
Line 712... Line 720...
712
;!!!!!!!!!!!!!!!!!!!!!!!
720
;!!!!!!!!!!!!!!!!!!!!!!!
713
include 'boot/rdload.inc'
721
include 'boot/rdload.inc'
714
;!!!!!!!!!!!!!!!!!!!!!!!
722
;!!!!!!!!!!!!!!!!!!!!!!!
715
end if
723
end if
716
;    mov    [dma_hdd],1
724
;    mov    [dma_hdd],1
717
; CALCULATE FAT CHAIN FOR RAMDISK
-
 
718
 
-
 
719
        call    calculatefatchain
-
 
Line 720... Line 725...
720
 
725
 
721
if 0
726
if 0
722
        mov     ax, [OS_BASE+0x10000+bx_from_load]
727
        mov     ax, [OS_BASE+0x10000+bx_from_load]
723
        cmp     ax, 'r1'; if using not ram disk, then load librares and parameters {SPraid.simba}
728
        cmp     ax, 'r1'; if using not ram disk, then load librares and parameters {SPraid.simba}
Line 1239... Line 1244...
1239
        call    wakeup_osloop
1244
        call    wakeup_osloop
Line 1240... Line 1245...
1240
 
1245
 
1241
        xor     eax, eax
1246
        xor     eax, eax
Line 1242... Line -...
1242
        mov     [BTN_ADDR], dword BUTTON_INFO ; address of button list
-
 
1243
 
1247
        mov     [BTN_ADDR], dword BUTTON_INFO ; address of button list
1244
        mov     byte [MOUSE_BUFF_COUNT], al              ; mouse buffer
1248
 
1245
        mov     byte [KEY_COUNT], al              ; keyboard buffer
1249
        mov     byte [KEY_COUNT], al              ; keyboard buffer
Line 1246... Line -...
1246
        mov     byte [BTN_COUNT], al              ; button buffer
-
 
1247
;        mov   [MOUSE_X],dword 100*65536+100    ; mouse x/y
-
 
1248
 
1250
        mov     byte [BTN_COUNT], al              ; button buffer
1249
     ;!! IP 04.02.2005:
1251
;        mov   [MOUSE_X],dword 100*65536+100    ; mouse x/y
Line 1250... Line 1252...
1250
;        mov     byte [DONT_SWITCH], al; change task if possible
1252
 
1251
        pop     eax
1253
        pop     eax
Line 2034... Line 2036...
2034
 
2036
 
2035
        mov     eax, [TASK_BASE]
2037
        mov     eax, [TASK_BASE]
2036
        mov     [eax+TASKDATA.state], 3; terminate this program
2038
        mov     [eax+TASKDATA.state], 3; terminate this program
Line 2037... Line 2039...
2037
        call    wakeup_osloop
2039
        call    wakeup_osloop
2038
 
-
 
2039
    waitterm:            ; wait here for termination
2040
 
2040
        mov     ebx, 100
2041
.waitterm:            ; wait here for termination
2041
        call    delay_hs
2042
        call    change_task
2042
        jmp     waitterm
2043
        jmp     .waitterm
2043
;------------------------------------------------------------------------------
2044
;------------------------------------------------------------------------------
2044
align 4
2045
align 4
2045
restore_default_cursor_before_killing:
2046
restore_default_cursor_before_killing:
Line 2323... Line 2324...
2323
  full_table:
2324
  full_table:
2324
;     cmp  ecx,2
2325
;     cmp  ecx,2
2325
        dec     ecx
2326
        dec     ecx
2326
        jnz     exit_for_anyone
2327
        jnz     exit_for_anyone
2327
        call    for_all_tables
2328
        call    for_all_tables
2328
        mov     ecx, 16384
2329
        mov     ecx, DRIVE_DATA_SIZE/4
2329
        cld
2330
        cld
2330
        rep movsd
2331
        rep movsd
2331
        ret
2332
        ret
2332
;------------------------------------------------------------------------------
2333
;------------------------------------------------------------------------------
2333
sysfn_lastkey:          ; 18.12 = return 0 (backward compatibility)
2334
sysfn_lastkey:          ; 18.12 = return 0 (backward compatibility)
Line 2491... Line 2492...
2491
        ja      .exit
2492
        ja      .exit
Line 2492... Line 2493...
2492
 
2493
 
2493
        pushfd
2494
        pushfd
2494
        cli
2495
        cli
2495
        mov     eax, ecx
2496
        mov     eax, ecx
2496
        mov     ecx, [BytesPerScanLine]
2497
        mov     ecx, [_display.pitch]
2497
        mov     [_display.width], eax
2498
        mov     [_display.width], eax
2498
        dec     eax
2499
        dec     eax
2499
        mov     [_display.height], edx
2500
        mov     [_display.height], edx
2500
        dec     edx
2501
        dec     edx
Line 3517... Line 3518...
3517
        mov     eax, [BG_Rect_X_left_right]
3518
        mov     eax, [BG_Rect_X_left_right]
3518
        mov     edx, [BG_Rect_Y_top_bottom]
3519
        mov     edx, [BG_Rect_Y_top_bottom]
3519
        cmp     [edi+SLOT_BASE+APPDATA.draw_bgr_x], 0
3520
        cmp     [edi+SLOT_BASE+APPDATA.draw_bgr_x], 0
3520
        jz      .set
3521
        jz      .set
3521
.join:
3522
.join:
3522
        cmp     word [edi+SLOT_BASE+APPDATA.draw_bgr_x+2], ax
-
 
3523
        jbe     @f
-
 
3524
        mov     word [edi+SLOT_BASE+APPDATA.draw_bgr_x+2], ax
-
 
3525
@@:
-
 
3526
        shr     eax, 16
-
 
3527
        cmp     word [edi+SLOT_BASE+APPDATA.draw_bgr_x], ax
3523
        cmp     word [edi+SLOT_BASE+APPDATA.draw_bgr_x], ax
3528
        jae     @f
3524
        jae     @f
3529
        mov     word [edi+SLOT_BASE+APPDATA.draw_bgr_x], ax
3525
        mov     word [edi+SLOT_BASE+APPDATA.draw_bgr_x], ax
3530
@@:
3526
@@:
-
 
3527
        shr     eax, 16
3531
        cmp     word [edi+SLOT_BASE+APPDATA.draw_bgr_y+2], dx
3528
        cmp     word [edi+SLOT_BASE+APPDATA.draw_bgr_x+2], ax
3532
        jbe     @f
3529
        jbe     @f
3533
        mov     word [edi+SLOT_BASE+APPDATA.draw_bgr_y+2], dx
3530
        mov     word [edi+SLOT_BASE+APPDATA.draw_bgr_x+2], ax
3534
@@:
3531
@@:
3535
        shr     edx, 16
-
 
3536
        cmp     word [edi+SLOT_BASE+APPDATA.draw_bgr_y], dx
3532
        cmp     word [edi+SLOT_BASE+APPDATA.draw_bgr_y], dx
3537
        jae     @f
3533
        jae     @f
3538
        mov     word [edi+SLOT_BASE+APPDATA.draw_bgr_y], dx
3534
        mov     word [edi+SLOT_BASE+APPDATA.draw_bgr_y], dx
3539
@@:
3535
@@:
-
 
3536
        shr     edx, 16
-
 
3537
        cmp     word [edi+SLOT_BASE+APPDATA.draw_bgr_y+2], dx
-
 
3538
        jbe     @f
-
 
3539
        mov     word [edi+SLOT_BASE+APPDATA.draw_bgr_y+2], dx
-
 
3540
@@:
3540
        jmp     .common
3541
        jmp     .common
3541
.set:
3542
.set:
3542
        mov     [edi+SLOT_BASE+APPDATA.draw_bgr_x], eax
3543
        mov     [edi+SLOT_BASE+APPDATA.draw_bgr_x], eax
3543
        mov     [edi+SLOT_BASE+APPDATA.draw_bgr_y], edx
3544
        mov     [edi+SLOT_BASE+APPDATA.draw_bgr_y], edx
3544
.common:
3545
.common:
Line 3848... Line 3849...
3848
        call    delay_hs
3849
        call    delay_hs
3849
        call    protect_from_terminate
3850
        call    protect_from_terminate
3850
        ret
3851
        ret
3851
endp
3852
endp
Line -... Line 3853...
-
 
3853
 
-
 
3854
if 1
-
 
3855
align 4
-
 
3856
delay_hs:     ; delay in 1/100 secs
-
 
3857
; ebx = delay time
-
 
3858
 
-
 
3859
        pushad
-
 
3860
        push    ebx
-
 
3861
        xor     esi, esi
-
 
3862
        mov     ecx, MANUAL_DESTROY
-
 
3863
        call    create_event
-
 
3864
        test    eax, eax
-
 
3865
        jz      .done
-
 
3866
 
-
 
3867
        mov     ebx, edx
-
 
3868
        mov     ecx, [esp]
-
 
3869
        push    edx
-
 
3870
        push    eax
-
 
3871
        call    wait_event_timeout
-
 
3872
        pop     eax
-
 
3873
        pop     ebx
-
 
3874
        call    destroy_event
-
 
3875
.done:
-
 
3876
        add     esp, 4
-
 
3877
        popad
-
 
3878
        ret
-
 
3879
 
-
 
3880
else
3852
 
3881
 
3853
align 4
3882
align 4
3854
delay_hs:     ; delay in 1/100 secs
3883
delay_hs:     ; delay in 1/100 secs
3855
; ebx = delay time
3884
; ebx = delay time
3856
        push    ecx
3885
        push    ecx
Line 3872... Line 3901...
3872
align 4
3901
align 4
3873
zerodelay:
3902
zerodelay:
3874
        pop     edx
3903
        pop     edx
3875
        pop     ecx
3904
        pop     ecx
3876
        ret
3905
        ret
-
 
3906
end if
-
 
3907
 
3877
;-----------------------------------------------------------------------------
3908
;-----------------------------------------------------------------------------
3878
align 16        ;very often call this subrutine
3909
align 16        ;very often call this subrutine
3879
memmove:       ; memory move in bytes
3910
memmove:       ; memory move in bytes
3880
; eax = from
3911
; eax = from
3881
; ebx = to
3912
; ebx = to
Line 4649... Line 4680...
4649
 
4680
 
4650
        pushad
4681
        pushad
4651
   @@:
4682
   @@:
4652
        cmp     [esi], byte 0
4683
        cmp     [esi], byte 0
4653
        je      @f
4684
        je      @f
4654
        mov     eax, 1
4685
        mov     ebx, 1
4655
        movzx   ebx, byte [esi]
4686
        movzx   ecx, byte [esi]
4656
        call    sys_msg_board
4687
        call    sys_msg_board
4657
        inc     esi
4688
        inc     esi
4658
        jmp     @b
4689
        jmp     @b
4659
   @@:
4690
   @@:
Line 4690... Line 4721...
4690
        push    eax
4721
        push    eax
4691
        and     al, 0xF
4722
        and     al, 0xF
4692
        cmp     al, 10
4723
        cmp     al, 10
4693
        sbb     al, 69h
4724
        sbb     al, 69h
4694
        das
4725
        das
4695
        mov     bl, al
4726
        mov     cl, al
4696
        xor     eax, eax
4727
        xor     ebx, ebx
4697
        inc     eax
4728
        inc     ebx
4698
        call    sys_msg_board
4729
        call    sys_msg_board
4699
        pop     eax
4730
        pop     eax
4700
        pop     ecx
4731
        pop     ecx
4701
        loop    @b
4732
        loop    @b
4702
        popad
4733
        popad
Line 4709... Line 4740...
4709
  msg_board_count dd 0x0
4740
  msg_board_count dd 0x0
4710
endg
4741
endg
Line 4711... Line 4742...
4711
 
4742
 
Line 4712... Line 4743...
4712
sys_msg_board:
4743
sys_msg_board:
4713
 
4744
 
-
 
4745
; ebx=1 : write :  bl byte to write
-
 
4746
; ebx=2 :  read :  ebx=0 -> no data, ebx=1 -> data in al
-
 
4747
 
-
 
4748
        push    eax ebx                 ; Save eax and ebx, since we're restoring their order required.
Line 4714... Line 4749...
4714
; eax=1 : write :  bl byte to write
4749
        mov     eax, ebx
4715
; eax=2 :  read :  ebx=0 -> no data, ebx=1 -> data in al
4750
        mov     ebx, ecx
4716
 
4751
 
Line 4752... Line 4787...
4752
        add     word [msg_board_pos+2], 6
4787
        add     word [msg_board_pos+2], 6
4753
        cmp     bl, 10
4788
        cmp     bl, 10
4754
        jnz     @f
4789
        jnz     @f
4755
        mov     word [msg_board_pos+2], 234
4790
        mov     word [msg_board_pos+2], 234
4756
        add     word [msg_board_pos], 10
4791
        add     word [msg_board_pos], 10
4757
        mov     ax, [Screen_Max_Y]
4792
        mov     ax, word [Screen_Max_Y]
4758
        cmp     word [msg_board_pos], ax
4793
        cmp     word [msg_board_pos], ax
4759
        jbe     @f
4794
        jbe     @f
4760
        mov     word [msg_board_pos], 10
4795
        mov     word [msg_board_pos], 10
4761
@@:
4796
@@:
4762
end if
4797
end if
Line 4768... Line 4803...
4768
        popa
4803
        popa
4769
end if
4804
end if
4770
        inc     ecx
4805
        inc     ecx
4771
        and     ecx, msg_board_data_size - 1
4806
        and     ecx, msg_board_data_size - 1
4772
        mov     [msg_board_count], ecx
4807
        mov     [msg_board_count], ecx
-
 
4808
 
-
 
4809
        pop     ebx eax
4773
        ret
4810
        ret
4774
.smbl1:
4811
.smbl1:
4775
        cmp     eax, 2
4812
        cmp     eax, 2
4776
        jne     .smbl2
4813
        jne     .smbl2
4777
        test    ecx, ecx
4814
        test    ecx, ecx
4778
        jz      .smbl21
4815
        jz      .smbl21
-
 
4816
 
-
 
4817
        add     esp, 8                  ; Returning data in ebx and eax, so no need to restore them.
4779
        mov     eax, msg_board_data+1
4818
        mov     eax, msg_board_data+1
4780
        mov     ebx, msg_board_data
4819
        mov     ebx, msg_board_data
4781
        movzx   edx, byte [ebx]
4820
        movzx   edx, byte [ebx]
4782
        call    memmove
4821
        call    memmove
4783
        dec     [msg_board_count]
4822
        dec     [msg_board_count]
4784
        mov     [esp + 36], edx ;eax
4823
        mov     [esp + 32], edx ;eax
4785
        mov     [esp + 24], dword 1
4824
        mov     [esp + 20], dword 1
4786
        ret
4825
        ret
4787
.smbl21:
4826
.smbl21:
4788
        mov     [esp+36], ecx
4827
        mov     [esp+32], ecx
4789
        mov     [esp+24], ecx
4828
        mov     [esp+20], ecx
4790
.smbl2:
4829
.smbl2:
-
 
4830
        pop     ebx eax
4791
        ret
4831
        ret
Line 4792... Line 4832...
4792
 
4832
 
4793
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4833
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4794
;; 66 sys function.                                                ;;
4834
;; 66 sys function.                                                ;;
Line 4967... Line 5007...
4967
 
5007
 
4968
 
5008
 
4969
.1:                             ; resolution
5009
.1:                             ; resolution
4970
        mov     eax, [Screen_Max_X]
5010
        mov     eax, [Screen_Max_X]
4971
        shl     eax, 16
5011
        shl     eax, 16
4972
        mov     ax, [Screen_Max_Y]
5012
        mov     ax, word [Screen_Max_Y]
4973
        add     eax, 0x00010001
5013
        add     eax, 0x00010001
4974
        mov     [esp+32], eax
5014
        mov     [esp+32], eax
4975
        ret
5015
        ret
4976
.2:                             ; bits per pixel
5016
.2:                             ; bits per pixel
4977
        mov     eax, [_display.bpp]
5017
        mov     eax, [_display.bpp]
4978
        mov     [esp+32], eax
5018
        mov     [esp+32], eax
4979
        ret
5019
        ret
4980
.3:                             ; bytes per scanline
5020
.3:                             ; bytes per scanline
4981
        mov     eax, [BytesPerScanLine]
5021
        mov     eax, [_display.pitch]
Line 4982... Line 5022...
4982
        mov     [esp+32], eax
5022
        mov     [esp+32], eax
Line 5066... Line 5106...
5066
.drectr:
5106
.drectr:
5067
        ret
5107
        ret
Line 5068... Line 5108...
5068
 
5108
 
5069
align 4
5109
align 4
5070
syscall_getscreensize:                  ; GetScreenSize
5110
syscall_getscreensize:                  ; GetScreenSize
5071
        mov     ax, [Screen_Max_X]
5111
        mov     ax, word [Screen_Max_X]
5072
        shl     eax, 16
5112
        shl     eax, 16
5073
        mov     ax, [Screen_Max_Y]
5113
        mov     ax, word [Screen_Max_Y]
5074
        mov     [esp + 32], eax
5114
        mov     [esp + 32], eax
Line 5075... Line 5115...
5075
        ret
5115
        ret
Line 5387... Line 5427...
5387
        inc     ecx
5427
        inc     ecx
5388
        mov     edi, BPSLine_calc_area
5428
        mov     edi, BPSLine_calc_area
5389
        cld
5429
        cld
5390
@@:
5430
@@:
5391
        stosd
5431
        stosd
5392
        add     eax, [BytesPerScanLine]
5432
        add     eax, [_display.pitch]
5393
        dec     ecx
5433
        dec     ecx
5394
        jnz     @r
5434
        jnz     @r
5395
        ret
5435
        ret
5396
;------------------------------------------------------------------------------
5436
;------------------------------------------------------------------------------
5397
align 4
5437
align 4
Line 5410... Line 5450...
5410
        pushfd
5450
        pushfd
5411
        cli
5451
        cli
Line 5412... Line 5452...
5412
 
5452
 
5413
        mov     [Screen_Max_X], eax
5453
        mov     [Screen_Max_X], eax
5414
        mov     [Screen_Max_Y], edx
5454
        mov     [Screen_Max_Y], edx
Line 5415... Line 5455...
5415
        mov     [BytesPerScanLine], ecx
5455
        mov     [_display.pitch], ecx
5416
 
5456
 
Line 5417... Line 5457...
5417
        mov     [screen_workarea.right], eax
5457
        mov     [screen_workarea.right], eax
Line 5536... Line 5576...
5536
        cmp     byte [BOOT_VAR+0x9030], 1
5576
        cmp     byte [BOOT_VAR+0x9030], 1
5537
        jne     @F
5577
        jne     @F
5538
        ret
5578
        ret
5539
@@:
5579
@@:
5540
        call    stop_all_services
5580
        call    stop_all_services
5541
        push    3                ; stop playing cd
-
 
5542
        pop     eax
5581
        movi    eax, 3
5543
        call    sys_cd_audio
5582
        call    sys_cd_audio
Line 5544... Line 5583...
5544
 
5583
 
5545
yes_shutdown_param:
5584
yes_shutdown_param:
Line 5546... Line 5585...
5546
        cli
5585
        cli
5547
 
5586
 
5548
if ~ defined extended_primary_loader
-
 
5549
        mov     eax, kernel_file ; load kernel.mnt to 0x7000:0
5587
if ~ defined extended_primary_loader
5550
        push    12
5588
        mov     eax, kernel_file ; load kernel.mnt to 0x7000:0
5551
        pop     esi
5589
        movi    esi, 12
5552
        xor     ebx, ebx
5590
        xor     ebx, ebx
5553
        or      ecx, -1
5591
        or      ecx, -1
Line 5768... Line 5806...
5768
        stc
5806
        stc
5769
.ok:
5807
.ok:
5770
        ret
5808
        ret
5771
end if
5809
end if
Line -... Line 5810...
-
 
5810
 
-
 
5811
if ~ lang eq sp
-
 
5812
diff16 "end of .text segment",0,$
-
 
5813
end if
5772
 
5814
 
Line 5773... Line 5815...
5773
include "data32.inc"
5815
include "data32.inc"
Line 5774... Line 5816...
5774
 
5816