Rev 425 | Rev 465 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 425 | Rev 431 | ||
---|---|---|---|
1 | $Revision: 425 $ |
1 | $Revision: 431 $ |
- | 2 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
- | 3 | ;; ;; |
|
- | 4 | ;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; |
|
- | 5 | ;; Distributed under terms of the GNU General Public License ;; |
|
- | 6 | ;; ;; |
|
- | 7 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
- | 8 | ||
2 | ; READ RAMDISK IMAGE FROM HD |
9 | ; READ RAMDISK IMAGE FROM HD |
3 | 10 | ||
4 | cmp [boot_dev],1 |
11 | cmp [boot_dev],1 |
5 | jne no_sys_on_hd |
12 | jne no_sys_on_hd |
6 | 13 | ||
7 | test [DRIVE_DATA+1],byte 0x40 |
14 | test [DRIVE_DATA+1],byte 0x40 |
8 | jz position_2 |
15 | jz position_2 |
9 | mov [hdbase],0x1f0 |
16 | mov [hdbase],0x1f0 |
10 | mov [hdid],0x0 |
17 | mov [hdid],0x0 |
11 | mov [hdpos],1 |
18 | mov [hdpos],1 |
12 | mov [fat32part],0 |
19 | mov [fat32part],0 |
13 | position_1_1: |
20 | position_1_1: |
14 | inc [fat32part] |
21 | inc [fat32part] |
15 | call search_and_read_image |
22 | call search_and_read_image |
16 | cmp [image_retrieved],1 |
23 | cmp [image_retrieved],1 |
17 | je yes_sys_on_hd |
24 | je yes_sys_on_hd |
18 | movzx eax,byte [DRIVE_DATA+2] |
25 | movzx eax,byte [DRIVE_DATA+2] |
19 | cmp [fat32part],eax |
26 | cmp [fat32part],eax |
20 | jle position_1_1 |
27 | jle position_1_1 |
21 | position_2: |
28 | position_2: |
22 | test [DRIVE_DATA+1],byte 0x10 |
29 | test [DRIVE_DATA+1],byte 0x10 |
23 | jz position_3 |
30 | jz position_3 |
24 | mov [hdbase],0x1f0 |
31 | mov [hdbase],0x1f0 |
25 | mov [hdid],0x10 |
32 | mov [hdid],0x10 |
26 | mov [hdpos],2 |
33 | mov [hdpos],2 |
27 | mov [fat32part],0 |
34 | mov [fat32part],0 |
28 | position_2_1: |
35 | position_2_1: |
29 | inc [fat32part] |
36 | inc [fat32part] |
30 | call search_and_read_image |
37 | call search_and_read_image |
31 | cmp [image_retrieved],1 |
38 | cmp [image_retrieved],1 |
32 | je yes_sys_on_hd |
39 | je yes_sys_on_hd |
33 | movzx eax,byte [DRIVE_DATA+3] |
40 | movzx eax,byte [DRIVE_DATA+3] |
34 | cmp eax,[fat32part] |
41 | cmp eax,[fat32part] |
35 | jle position_2_1 |
42 | jle position_2_1 |
36 | position_3: |
43 | position_3: |
37 | test [DRIVE_DATA+1],byte 0x4 |
44 | test [DRIVE_DATA+1],byte 0x4 |
38 | jz position_4 |
45 | jz position_4 |
39 | mov [hdbase],0x170 |
46 | mov [hdbase],0x170 |
40 | mov [hdid],0x0 |
47 | mov [hdid],0x0 |
41 | mov [hdpos],3 |
48 | mov [hdpos],3 |
42 | mov [fat32part],0 |
49 | mov [fat32part],0 |
43 | position_3_1: |
50 | position_3_1: |
44 | inc [fat32part] |
51 | inc [fat32part] |
45 | call search_and_read_image |
52 | call search_and_read_image |
46 | cmp [image_retrieved],1 |
53 | cmp [image_retrieved],1 |
47 | je yes_sys_on_hd |
54 | je yes_sys_on_hd |
48 | movzx eax,byte [DRIVE_DATA+4] |
55 | movzx eax,byte [DRIVE_DATA+4] |
49 | cmp eax,[fat32part] |
56 | cmp eax,[fat32part] |
50 | jle position_3_1 |
57 | jle position_3_1 |
51 | position_4: |
58 | position_4: |
52 | test [DRIVE_DATA+1],byte 0x1 |
59 | test [DRIVE_DATA+1],byte 0x1 |
53 | jz no_sys_on_hd |
60 | jz no_sys_on_hd |
54 | mov [hdbase],0x170 |
61 | mov [hdbase],0x170 |
55 | mov [hdid],0x10 |
62 | mov [hdid],0x10 |
56 | mov [hdpos],4 |
63 | mov [hdpos],4 |
57 | mov [fat32part],0 |
64 | mov [fat32part],0 |
58 | position_4_1: |
65 | position_4_1: |
59 | inc [fat32part] |
66 | inc [fat32part] |
60 | call search_and_read_image |
67 | call search_and_read_image |
61 | cmp [image_retrieved],1 |
68 | cmp [image_retrieved],1 |
62 | je yes_sys_on_hd |
69 | je yes_sys_on_hd |
63 | movzx eax,byte [DRIVE_DATA+5] |
70 | movzx eax,byte [DRIVE_DATA+5] |
64 | cmp eax,[fat32part] |
71 | cmp eax,[fat32part] |
65 | jle position_4_1 |
72 | jle position_4_1 |
66 | jmp yes_sys_on_hd |
73 | jmp yes_sys_on_hd |
67 | 74 | ||
68 | search_and_read_image: |
75 | search_and_read_image: |
69 | call set_FAT32_variables |
76 | call set_FAT32_variables |
70 | mov edx, bootpath |
77 | mov edx, bootpath |
71 | call read_image |
78 | call read_image |
72 | test eax, eax |
79 | test eax, eax |
73 | jz image_present |
80 | jz image_present |
74 | mov edx, bootpath2 |
81 | mov edx, bootpath2 |
75 | call read_image |
82 | call read_image |
76 | test eax, eax |
83 | test eax, eax |
77 | jz image_present |
84 | jz image_present |
78 | ret |
85 | ret |
79 | image_present: |
86 | image_present: |
80 | mov [image_retrieved],1 |
87 | mov [image_retrieved],1 |
81 | ret |
88 | ret |
82 | 89 | ||
83 | read_image: |
90 | read_image: |
84 | mov eax, hdsysimage |
91 | mov eax, hdsysimage |
85 | mov ebx, 1474560/512 |
92 | mov ebx, 1474560/512 |
86 | mov ecx, RAMDISK |
93 | mov ecx, RAMDISK |
87 | mov esi, 0 |
94 | mov esi, 0 |
88 | mov edi, 12 |
95 | mov edi, 12 |
89 | call file_read |
96 | call file_read |
90 | ret |
97 | ret |
91 | 98 | ||
92 | image_retrieved db 0 |
99 | image_retrieved db 0 |
93 | counter_of_partitions db 0 |
100 | counter_of_partitions db 0 |
94 | no_sys_on_hd: |
101 | no_sys_on_hd: |
95 | yes_sys_on_hd: |
102 | yes_sys_on_hd: |