Subversion Repositories Kolibri OS

Rev

Rev 8091 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2288 clevermous 1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
10051 ace_dent 3
;; Copyright (C) KolibriOS team 2004-2024. All rights reserved. ;;
2288 clevermous 4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7
 
8
 
3742 clevermous 9
read_ramdisk:
4772 mario79 10
; READ RAMDISK IMAGE FROM HD (only for IDE0, IDE1, IDE2, IDE3)
2288 clevermous 11
 
8089 dunkaist 12
        cmp     byte [BOOT.rd_load_from], RD_LOAD_FROM_HD
4772 mario79 13
        jne     no_sys_on_hd.1
2288 clevermous 14
 
3742 clevermous 15
        xor     ebp, ebp
16
.hd_loop:
17
        lea     eax, [ebp+'0']
18
        mov     [read_image_fsinfo.name_digit], al
19
        movzx   eax, byte [DRIVE_DATA+2+ebp]
20
        test    eax, eax
21
        jz      .next_hd
22
        push    eax
23
        mov     esi, 1
24
.partition_loop:
25
        mov     eax, esi
26
        push    -'0'
27
@@:
28
        xor     edx, edx
29
        div     [_10]
30
        push    edx
31
        test    eax, eax
32
        jnz     @b
33
        mov     edi, read_image_fsinfo.partition
34
@@:
35
        pop     eax
36
        add     al, '0'
37
        stosb
38
        jnz     @b
39
        mov     byte [edi-1], '/'
40
        push    esi edi
41
        mov     esi, bootpath1
42
        mov     ecx, bootpath1.len
43
        rep movsb
2288 clevermous 44
        call    read_image
45
        test    eax, eax
3742 clevermous 46
        jz      .yes
47
        cmp     eax, 6
48
        jz      .yes
49
        pop     edi
50
        push    edi
51
        mov     esi, bootpath2
52
        mov     ecx, bootpath2.len
53
        rep movsb
2288 clevermous 54
        call    read_image
55
        test    eax, eax
3742 clevermous 56
        jz      .yes
57
        cmp     eax, 6
58
        jz      .yes
59
        pop     edi esi
60
        inc     esi
61
        cmp     esi, [esp]
62
        jbe     .partition_loop
63
        pop     eax
64
.next_hd:
65
        inc     ebp
66
        cmp     ebp, 4
67
        jb      .hd_loop
68
        jmp     no_sys_on_hd
69
.yes:
4772 mario79 70
        DEBUGF 1, "K : RD found: %s\n", read_image_fsinfo.name
3742 clevermous 71
        pop     edi esi eax
4772 mario79 72
 
73
        call    register_ramdisk
3742 clevermous 74
        jmp     yes_sys_on_hd
4772 mario79 75
;-----------------------------------------------------------------------------
2643 clevermous 76
iglobal
77
align 4
78
read_image_fsinfo:
79
        dd      0               ; function: read
80
        dq      0               ; offset: zero
3744 clevermous 81
        dd      1474560         ; size
2643 clevermous 82
        dd      RAMDISK         ; buffer
4772 mario79 83
.name   db      '/hd'
3742 clevermous 84
.name_digit db  '0'
85
        db      '/'
86
.partition:
87
        rb      64      ; should be enough for '255/KOLIBRI/KOLIBRI.IMG'
88
 
89
bootpath1       db      'KOLIBRI.IMG',0
90
.len = $ - bootpath1
91
bootpath2       db      'KOLIBRI/KOLIBRI.IMG',0
92
.len = $ - bootpath2
2643 clevermous 93
endg
94
 
2288 clevermous 95
read_image:
2643 clevermous 96
        mov     ebx, read_image_fsinfo
97
        pushad
3296 clevermous 98
        call    file_system_lfn_protected
2643 clevermous 99
        popad
2288 clevermous 100
        ret
101
 
102
no_sys_on_hd:
4772 mario79 103
        DEBUGF 1, "K : RD not found\n"
104
.1:
2288 clevermous 105
        ; test_to_format_ram_disk (need if not using ram disk)
8089 dunkaist 106
        cmp     byte [BOOT.rd_load_from], RD_LOAD_FROM_FORMAT
2288 clevermous 107
        jne     not_format_ram_disk
108
        ; format_ram_disk
109
        mov     edi, RAMDISK
110
        mov     ecx, 0x1080
111
        xor     eax, eax
10051 ace_dent 112
@@:
2288 clevermous 113
        stosd
114
        loop    @b
115
 
116
        mov     ecx, 0x58F7F
117
        mov     eax, 0xF6F6F6F6
10051 ace_dent 118
@@:
2288 clevermous 119
        stosd
120
        loop    @b
10051 ace_dent 121
 
2288 clevermous 122
        mov     [RAMDISK+0x200], dword 0xFFFFF0         ; fat table
123
        mov     [RAMDISK+0x4200], dword 0xFFFFF0
10051 ace_dent 124
 
2288 clevermous 125
not_format_ram_disk:
126
yes_sys_on_hd: