Subversion Repositories Kolibri OS

Rev

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

Rev 8091 Rev 9942
Line 9... Line 9...
9
;;  KolibriOS 16-bit loader,                                    ;;
9
;;  KolibriOS 16-bit loader,                                    ;;
10
;;                        based on bootcode for MenuetOS        ;;
10
;;                        based on bootcode for MenuetOS        ;;
11
;;                                                              ;;
11
;;                                                              ;;
12
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
12
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 13... Line 13...
13
 
13
 
Line 14... Line 14...
14
$Revision: 8091 $
14
$Revision: 9942 $
15
 
15
 
16
 
16
 
Line 91... Line 91...
91
        cmp     al, 27          ; If ESC was pressed, do not change the value
91
        cmp     al, 27          ; If ESC was pressed, do not change the value
92
        jz      .esc_pressed
92
        jz      .esc_pressed
93
        mov     [variable_to_set], al
93
        mov     [variable_to_set], al
94
}
94
}
Line -... Line 95...
-
 
95
 
-
 
96
clear_status_field:
-
 
97
        mov     si, space_msg
-
 
98
        mov     byte [si+80], 0
-
 
99
        _setcursor 16,0
-
 
100
        call    printplain
-
 
101
        _setcursor 16,0
-
 
102
        ret
95
 
103
 
96
boot_read_floppy:
104
boot_read_floppy:
97
        push    si
105
        push    si
98
        xor     si, si
106
        xor     si, si
99
        mov     ah, 2   ; read
107
        mov     ah, 2   ; read
Line 274... Line 282...
274
        pop     ds
282
        pop     ds
275
else
283
else
276
        cld
284
        cld
277
        push    0
285
        push    0
278
        pop     es
286
        pop     es
279
; \begin{diamond}[02.12.2005]
-
 
280
; if bootloader sets ax = 'KL', then ds:si points to loader block
287
; if bootloader sets ax = 'KL', then ds:si points to loader block
281
        cmp     ax, 'KL'
288
        cmp     ax, 'KL'
282
        jnz     @f
289
        jnz     @f
283
        mov     word [cs:cfgmanager.loader_block], si
290
        mov     word [cs:cfgmanager.loader_block], si
284
        mov     word [cs:cfgmanager.loader_block+2], ds
291
        mov     word [cs:cfgmanager.loader_block+2], ds
285
        mov     word [es:BOOT_LO.kernel_restart], kernel_restart_bootblock
292
        mov     word [es:BOOT_LO.kernel_restart], kernel_restart_bootblock
286
@@:
293
@@:
287
; \end{diamond}[02.12.2005]
-
 
288
 
-
 
289
; if bootloader sets cx = 'HA' and dx = 'RD', then bx contains identifier of source disk
294
; if bootloader sets cx = 'HA' and dx = 'RD', then bx contains identifier of source disk
290
; (see comment to BOOT_LO.sys_disk and loader_doc.txt)
295
; (see comment to BOOT_LO.sys_disk and loader_doc.txt)
291
        mov     word [es:BOOT_LO.sys_disk], 'r1'  ; default value: /rd/1
296
        mov     word [es:BOOT_LO.sys_disk], 'r1'  ; default value: /rd/1
292
        cmp     cx, 'HA'
297
        cmp     cx, 'HA'
293
        jnz     no_hd_load
298
        jnz     no_hd_load
Line 418... Line 423...
418
        in      al, 64h
423
        in      al, 64h
419
        test    al, 1
424
        test    al, 1
420
        loopz   @b
425
        loopz   @b
421
        in      al, 0x60
426
        in      al, 0x60
Line 422... Line -...
422
 
-
 
423
;;;/diamond today   5.02.2008
427
 
424
; set keyboard typematic rate & delay
428
; set keyboard typematic rate & delay
425
        mov     al, 0xf3
429
        mov     al, 0xf3
426
        out     0x60, al
430
        out     0x60, al
427
        xor     cx, cx
431
        xor     cx, cx
Line 492... Line 496...
492
; DISPLAY VESA INFORMATION
496
; DISPLAY VESA INFORMATION
493
        call    print_vesa_info
497
        call    print_vesa_info
494
        call    calc_vmodes_table
498
        call    calc_vmodes_table
495
        call    check_first_parm   ;check and enable cursor_pos
499
        call    check_first_parm   ;check and enable cursor_pos
Line 496... Line -...
496
 
-
 
497
; \begin{diamond}[30.11.2005]
500
 
498
cfgmanager:
501
cfgmanager:
499
; settings:
502
; settings:
500
; a) preboot_graph = graphical mode
503
; a) preboot_graph = graphical mode
501
;    preboot_gprobe = probe this mode?
504
;    preboot_gprobe = probe this mode?
Line 935... Line 938...
935
.loadc:
938
.loadc:
936
        pop     eax
939
        pop     eax
937
.cont:
940
.cont:
938
        push    cs
941
        push    cs
939
        pop     ds
942
        pop     ds
-
 
943
 
-
 
944
        push    es
940
        mov     si, space_msg
945
        les     bx, [.loader_block]
-
 
946
        cmp     byte [es:bx+7], 0      ; get write error flag
941
        mov     byte [si+80], 0
947
        pop     es
942
        _setcursor 16,0
948
        jz      .load
-
 
949
        call    clear_status_field
-
 
950
        mov     si, write_err_msg
943
        call    printplain
951
        call    print
-
 
952
.wait_any_key:
-
 
953
        xor     ax, ax
944
        _setcursor 16,0
954
        int     16h
-
 
955
        test    ax, ax
-
 
956
        jz      .wait_any_key
-
 
957
 
945
.load:
958
.load:
-
 
959
        call    clear_status_field
946
end if
960
end if
947
; \end{diamond}[02.12.2005]
-
 
Line 948... Line 961...
948
 
961
 
Line 949... Line 962...
949
; ASK GRAPHICS MODE
962
; ASK GRAPHICS MODE
Line 997... Line 1010...
997
        cmp     byte [es:BOOT_LO.rd_load_from], RD_LOAD_FROM_FLOPPY
1010
        cmp     byte [es:BOOT_LO.rd_load_from], RD_LOAD_FROM_FLOPPY
998
        jne     no_sys_on_floppy
1011
        jne     no_sys_on_floppy
999
        mov     si, diskload
1012
        mov     si, diskload
1000
        call    print
1013
        call    print
1001
        xor     ax, ax            ; reset drive
1014
        xor     ax, ax          ; reset drive
1002
        xor     dx, dx
1015
        xor     dx, dx          ; 1st floppy disk (0)
1003
        int     0x13
1016
        int     0x13
1004
; do we boot from CD-ROM?
1017
; do we boot from CD-ROM?
1005
        mov     ah, 41h
1018
        mov     ah, 41h         ; check extended mode
1006
        mov     bx, 55AAh
1019
        mov     bx, 55AAh       ; test 2 bytes to check that this function is supported
1007
        xor     dx, dx
1020
        xor     dx, dx          ; 1st floppy disk (0)
1008
        int     0x13
1021
        int     0x13
1009
        jc      .nocd
1022
        jc      .nocd           ; extended mode not supported
1010
        cmp     bx, 0AA55h
1023
        cmp     bx, 0AA55h
1011
        jnz     .nocd
1024
        jnz     .nocd           ; extended mode not supported
1012
        mov     ah, 48h
1025
        mov     ah, 48h         ; extended read drive parameters
1013
        push    ds
1026
        push    ds
1014
        push    es
1027
        push    es
1015
        pop     ds
1028
        pop     ds
1016
        mov     si, 0xa000
1029
        mov     si, 0xa000
1017
        mov     word [si], 30
1030
        mov     word [si], 30   ; size of result buffer
1018
        int     0x13
1031
        int     0x13
1019
        pop     ds
1032
        pop     ds
1020
        jc      .nocd
1033
        jc      .nocd           ; error getting parameters
1021
        push    ds
1034
        push    ds
1022
        lds     si, [es:si+26]
1035
        lds     si, [es:si+26]  ; pointer to Enhanced Disk Drive (EDD) configuration parameters
1023
        test    byte [ds:si+10], 40h
1036
        test    byte [ds:si+10], 40h ; check ATAPI device
1024
        pop     ds
1037
        pop     ds
1025
        jz      .nocd
1038
        jz      .nocd
-
 
1039
 
1026
; yes - read all floppy by 18 sectors
1040
; yes - read all floppy by 18 sectors
Line 1027... Line 1041...
1027
 
1041
 
1028
; TODO: !!!! read only first sector and set variables !!!!!
1042
; TODO: !!!! read only first sector and set variables !!!!!
1029
; ...
1043
; ...