Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1065 Lrz 1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
3
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7
 
8
 
9
; READ RAMDISK IMAGE FROM HD
10
 
11
        cmp   [boot_dev+OS_BASE+0x10000],1
12
        jne   no_sys_on_hd
13
 
14
        test  [DRIVE_DATA+1],byte 0x40
15
        jz    position_2
16
        mov   [hdbase],0x1f0
17
        mov   [hdid],0x0
18
        mov   [hdpos],1
19
        mov   [fat32part],0
20
  position_1_1:
21
        inc   [fat32part]
22
        call  search_and_read_image
23
        cmp   [image_retrieved],1
24
        je    yes_sys_on_hd
25
        movzx eax,byte [DRIVE_DATA+2]
26
        cmp   [fat32part],eax
27
        jle     position_1_1
28
  position_2:
29
        test  [DRIVE_DATA+1],byte 0x10
30
        jz    position_3
31
        mov   [hdbase],0x1f0
32
        mov   [hdid],0x10
33
        mov   [hdpos],2
34
        mov   [fat32part],0
35
  position_2_1:
36
        inc   [fat32part]
37
        call  search_and_read_image
38
        cmp   [image_retrieved],1
39
        je    yes_sys_on_hd
40
        movzx eax,byte [DRIVE_DATA+3]
41
        cmp   eax,[fat32part]
42
        jle     position_2_1
43
  position_3:
44
        test  [DRIVE_DATA+1],byte 0x4
45
        jz    position_4
46
        mov   [hdbase],0x170
47
        mov   [hdid],0x0
48
        mov   [hdpos],3
49
        mov   [fat32part],0
50
  position_3_1:
51
        inc   [fat32part]
52
        call  search_and_read_image
53
        cmp   [image_retrieved],1
54
        je    yes_sys_on_hd
55
        movzx eax,byte [DRIVE_DATA+4]
56
        cmp   eax,[fat32part]
57
        jle     position_3_1
58
  position_4:
59
        test  [DRIVE_DATA+1],byte 0x1
60
        jz    no_sys_on_hd
61
        mov   [hdbase],0x170
62
        mov   [hdid],0x10
63
        mov   [hdpos],4
64
        mov   [fat32part],0
65
  position_4_1:
66
        inc   [fat32part]
67
        call  search_and_read_image
68
        cmp   [image_retrieved],1
69
        je    yes_sys_on_hd
70
        movzx eax,byte [DRIVE_DATA+5]
71
        cmp   eax,[fat32part]
72
        jle     position_4_1
73
        jmp   yes_sys_on_hd
74
 
75
  search_and_read_image:
76
        call  set_FAT32_variables
77
        mov   edx, bootpath
78
        call  read_image
79
        test  eax, eax
80
        jz   image_present
81
        mov   edx, bootpath2
82
        call  read_image
83
        test  eax, eax
84
        jz   image_present
85
        ret
86
    image_present:
87
        mov   [image_retrieved],1
88
        ret
89
 
90
read_image:
91
        mov   eax, hdsysimage+OS_BASE+0x10000
92
        mov   ebx, 1474560/512
93
        mov   ecx, RAMDISK
94
        mov   esi, 0
95
        mov   edi, 12
96
        call  file_read
97
        ret
98
 
99
image_retrieved  db 0
100
counter_of_partitions db 0
101
no_sys_on_hd:
102
        ; test_to_format_ram_disk (need if not using ram disk)
103
        cmp   [boot_dev+OS_BASE+0x10000],3
104
        jne not_format_ram_disk
105
        ; format_ram_disk
106
        mov edi, RAMDISK
107
        mov ecx, 0x1080
108
        xor eax,eax
109
@@:
110
		stosd
111
        loop @b
112
 
113
        mov ecx, 0x58F7F
114
        mov eax,0xF6F6F6F6
115
@@:
116
		stosd
117
        loop @b
118
 
119
        mov [RAMDISK+0x200],dword 0xFFFFF0		; fat table
120
        mov [RAMDISK+0x4200],dword 0xFFFFF0
121
 
122
not_format_ram_disk:
123
yes_sys_on_hd: