Subversion Repositories Kolibri OS

Rev

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

Rev 3296 Rev 3742
Line 1... Line 1...
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
2
;;                                                              ;;
3
;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2013. All rights reserved. ;;
4
;; Distributed under terms of the GNU General Public License    ;;
4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 7... Line 7...
7
 
7
 
Line -... Line 8...
-
 
8
$Revision: 3742 $
8
$Revision: 3296 $
9
 
Line 9... Line 10...
9
 
10
 
10
 
11
read_ramdisk:
Line 11... Line -...
11
; READ RAMDISK IMAGE FROM HD
-
 
12
 
-
 
13
        cmp     [boot_dev+OS_BASE+0x10000], 1
-
 
14
        jne     no_sys_on_hd
12
; READ RAMDISK IMAGE FROM HD
15
 
-
 
16
        test    [DRIVE_DATA+1], byte 0x40
-
 
17
        jz      position_2
13
 
18
        mov     [hdbase], 0x1f0
14
        cmp     [boot_dev+OS_BASE+0x10000], 1
19
        mov     [hdid], 0x0
-
 
20
        mov     [hdpos], 1
15
        jne     no_sys_on_hd
21
        mov     [fat32part], 0
-
 
22
  position_1_1:
16
 
23
        inc     [fat32part]
17
        xor     ebp, ebp
24
        call    search_and_read_image
-
 
25
        cmp     [image_retrieved], 1
-
 
26
        je      yes_sys_on_hd
-
 
27
        movzx   eax, byte [DRIVE_DATA+2]
18
.hd_loop:
28
        cmp     [fat32part], eax
-
 
29
        jle     position_1_1
19
        lea     eax, [ebp+'0']
30
  position_2:
20
        mov     [read_image_fsinfo.name_digit], al
31
        test    [DRIVE_DATA+1], byte 0x10
-
 
32
        jz      position_3
21
        movzx   eax, byte [DRIVE_DATA+2+ebp]
33
        mov     [hdbase], 0x1f0
-
 
34
        mov     [hdid], 0x10
-
 
35
        mov     [hdpos], 2
-
 
36
        mov     [fat32part], 0
-
 
37
  position_2_1:
-
 
38
        inc     [fat32part]
22
        test    eax, eax
39
        call    search_and_read_image
23
        jz      .next_hd
40
        cmp     [image_retrieved], 1
24
        push    eax
41
        je      yes_sys_on_hd
-
 
42
        movzx   eax, byte [DRIVE_DATA+3]
-
 
43
        cmp     eax, [fat32part]
25
        mov     esi, 1
44
        jle     position_2_1
26
.partition_loop:
45
  position_3:
27
        mov     eax, esi
46
        test    [DRIVE_DATA+1], byte 0x4
-
 
47
        jz      position_4
-
 
48
        mov     [hdbase], 0x170
28
        push    -'0'
49
        mov     [hdid], 0x0
-
 
50
        mov     [hdpos], 3
-
 
51
        mov     [fat32part], 0
29
@@:
52
  position_3_1:
-
 
53
        inc     [fat32part]
30
        xor     edx, edx
54
        call    search_and_read_image
-
 
55
        cmp     [image_retrieved], 1
31
        div     [_10]
56
        je      yes_sys_on_hd
-
 
57
        movzx   eax, byte [DRIVE_DATA+4]
-
 
58
        cmp     eax, [fat32part]
32
        push    edx
59
        jle     position_3_1
33
        test    eax, eax
60
  position_4:
34
        jnz     @b
61
        test    [DRIVE_DATA+1], byte 0x1
-
 
62
        jz      no_sys_on_hd
-
 
63
        mov     [hdbase], 0x170
35
        mov     edi, read_image_fsinfo.partition
64
        mov     [hdid], 0x10
-
 
65
        mov     [hdpos], 4
-
 
66
        mov     [fat32part], 0
-
 
67
  position_4_1:
36
@@:
68
        inc     [fat32part]
-
 
69
        call    search_and_read_image
37
        pop     eax
70
        cmp     [image_retrieved], 1
38
        add     al, '0'
71
        je      yes_sys_on_hd
-
 
72
        movzx   eax, byte [DRIVE_DATA+5]
-
 
73
        cmp     eax, [fat32part]
39
        stosb
74
        jle     position_4_1
40
        jnz     @b
75
        jmp     yes_sys_on_hd
41
        mov     byte [edi-1], '/'
76
 
42
        push    esi edi
-
 
43
        mov     esi, bootpath1
-
 
44
        mov     ecx, bootpath1.len
77
  search_and_read_image:
45
        rep movsb
-
 
46
        call    read_image
-
 
47
        test    eax, eax
78
        call    set_FAT32_variables
48
        jz      .yes
-
 
49
        cmp     eax, 6
-
 
50
        jz      .yes
79
        mov     edx, bootpath
51
        pop     edi
80
        call    read_image
52
        push    edi
-
 
53
        mov     esi, bootpath2
-
 
54
        mov     ecx, bootpath2.len
81
        test    eax, eax
55
        rep movsb
-
 
56
        call    read_image
82
        jz      image_present
57
        test    eax, eax
83
        mov     edx, bootpath2
58
        jz      .yes
84
        call    read_image
59
        cmp     eax, 6
-
 
60
        jz      .yes
-
 
61
        pop     edi esi
85
        test    eax, eax
62
        inc     esi
-
 
63
        cmp     esi, [esp]
-
 
64
        jbe     .partition_loop
-
 
65
        pop     eax
-
 
66
.next_hd:
-
 
67
        inc     ebp
-
 
68
        cmp     ebp, 4
Line 86... Line 69...
86
        jz      image_present
69
        jb      .hd_loop
87
        ret
70
        jmp     no_sys_on_hd
88
    image_present:
71
.yes:
89
        mov     [image_retrieved], 1
72
        pop     edi esi eax
90
        ret
73
        jmp     yes_sys_on_hd
91
 
74
 
92
iglobal
75
iglobal
-
 
76
align 4
-
 
77
read_image_fsinfo:
93
align 4
78
        dd      0               ; function: read
-
 
79
        dq      0               ; offset: zero
-
 
80
        dd      1474560/512     ; size
-
 
81
        dd      RAMDISK         ; buffer
-
 
82
        db      '/hd'
-
 
83
.name_digit db  '0'
94
read_image_fsinfo:
84
        db      '/'
-
 
85
.partition:
95
        dd      0               ; function: read
86
        rb      64      ; should be enough for '255/KOLIBRI/KOLIBRI.IMG'
Line 96... Line 87...
96
        dq      0               ; offset: zero
87
 
97
        dd      1474560/512     ; size
88
bootpath1       db      'KOLIBRI.IMG',0
98
        dd      RAMDISK         ; buffer
89
.len = $ - bootpath1
99
        db      0
90
bootpath2       db      'KOLIBRI/KOLIBRI.IMG',0
100
        dd      hdsysimage+OS_BASE+0x10000
91
.len = $ - bootpath2
101
endg
92
endg
Line 102... Line -...
102
 
-
 
103
read_image:
-
 
104
        mov     ebx, read_image_fsinfo
93
 
105
        pushad
94
read_image:
106
        call    file_system_lfn_protected
95
        mov     ebx, read_image_fsinfo
107
        popad
96
        pushad
108
        ret
97
        call    file_system_lfn_protected