Rev 709 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 709 | Rev 1376 | ||
---|---|---|---|
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
2 | ;; ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2008. 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 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
7 | 7 | ||
8 | $Revision: 709 $ |
8 | $Revision: 1376 $ |
9 | 9 | ||
10 | 10 | ||
11 | ;**************************************************** |
11 | ;**************************************************** |
12 | ; ïîèñê ëîãè÷åñêèõ äèñêîâ íà îáíàðóæåííûõ HDD |
12 | ; ïîèñê ëîãè÷åñêèõ äèñêîâ íà îáíàðóæåííûõ HDD |
13 | ; è çàíåñåíèå äàííûõ â îáëàñòü òàáëèöû |
13 | ; è çàíåñåíèå äàííûõ â îáëàñòü òàáëèöû |
14 | ; àâòîð Mario79 |
14 | ; àâòîð Mario79 |
15 | ;**************************************************** |
15 | ;**************************************************** |
16 | mov [transfer_adress],DRIVE_DATA+0xa |
16 | mov [transfer_adress],DRIVE_DATA+0xa |
17 | search_partitions_ide0: |
17 | search_partitions_ide0: |
18 | test [DRIVE_DATA+1],byte 0x40 |
18 | test [DRIVE_DATA+1],byte 0x40 |
19 | jz search_partitions_ide1 |
19 | jz search_partitions_ide1 |
20 | mov [hdbase],0x1f0 |
20 | mov [hdbase],0x1f0 |
21 | mov [hdid],0x0 |
21 | mov [hdid],0x0 |
22 | mov [hdpos],1 |
22 | mov [hdpos],1 |
23 | mov [fat32part],1 |
23 | mov [fat32part],1 |
24 | search_partitions_ide0_1: |
24 | search_partitions_ide0_1: |
25 | call set_FAT32_variables |
25 | call set_FAT32_variables |
26 | cmp [problem_partition],0 |
26 | cmp [problem_partition],0 |
27 | jne search_partitions_ide1 |
27 | jne search_partitions_ide1 |
28 | inc byte [DRIVE_DATA+2] |
28 | inc byte [DRIVE_DATA+2] |
29 | call partition_data_transfer |
29 | call partition_data_transfer |
30 | add [transfer_adress],100 |
30 | add [transfer_adress],100 |
31 | inc [fat32part] |
31 | inc [fat32part] |
32 | jmp search_partitions_ide0_1 |
32 | jmp search_partitions_ide0_1 |
33 | 33 | ||
34 | search_partitions_ide1: |
34 | search_partitions_ide1: |
35 | test [DRIVE_DATA+1],byte 0x10 |
35 | test [DRIVE_DATA+1],byte 0x10 |
36 | jz search_partitions_ide2 |
36 | jz search_partitions_ide2 |
37 | mov [hdbase],0x1f0 |
37 | mov [hdbase],0x1f0 |
38 | mov [hdid],0x10 |
38 | mov [hdid],0x10 |
39 | mov [hdpos],2 |
39 | mov [hdpos],2 |
40 | mov [fat32part],1 |
40 | mov [fat32part],1 |
41 | search_partitions_ide1_1: |
41 | search_partitions_ide1_1: |
42 | call set_FAT32_variables |
42 | call set_FAT32_variables |
43 | cmp [problem_partition],0 |
43 | cmp [problem_partition],0 |
44 | jne search_partitions_ide2 |
44 | jne search_partitions_ide2 |
45 | inc byte [DRIVE_DATA+3] |
45 | inc byte [DRIVE_DATA+3] |
46 | call partition_data_transfer |
46 | call partition_data_transfer |
47 | add [transfer_adress],100 |
47 | add [transfer_adress],100 |
48 | inc [fat32part] |
48 | inc [fat32part] |
49 | jmp search_partitions_ide1_1 |
49 | jmp search_partitions_ide1_1 |
50 | 50 | ||
51 | search_partitions_ide2: |
51 | search_partitions_ide2: |
52 | test [DRIVE_DATA+1],byte 0x4 |
52 | test [DRIVE_DATA+1],byte 0x4 |
53 | jz search_partitions_ide3 |
53 | jz search_partitions_ide3 |
54 | mov [hdbase],0x170 |
54 | mov [hdbase],0x170 |
55 | mov [hdid],0x0 |
55 | mov [hdid],0x0 |
56 | mov [hdpos],3 |
56 | mov [hdpos],3 |
57 | mov [fat32part],1 |
57 | mov [fat32part],1 |
58 | search_partitions_ide2_1: |
58 | search_partitions_ide2_1: |
59 | call set_FAT32_variables |
59 | call set_FAT32_variables |
60 | cmp [problem_partition],0 |
60 | cmp [problem_partition],0 |
61 | jne search_partitions_ide3 |
61 | jne search_partitions_ide3 |
62 | inc byte [DRIVE_DATA+4] |
62 | inc byte [DRIVE_DATA+4] |
63 | call partition_data_transfer |
63 | call partition_data_transfer |
64 | add [transfer_adress],100 |
64 | add [transfer_adress],100 |
65 | inc [fat32part] |
65 | inc [fat32part] |
66 | jmp search_partitions_ide2_1 |
66 | jmp search_partitions_ide2_1 |
67 | 67 | ||
68 | search_partitions_ide3: |
68 | search_partitions_ide3: |
69 | test [DRIVE_DATA+1],byte 0x1 |
69 | test [DRIVE_DATA+1],byte 0x1 |
70 | jz end_search_partitions_ide |
70 | jz end_search_partitions_ide |
71 | mov [hdbase],0x170 |
71 | mov [hdbase],0x170 |
72 | mov [hdid],0x10 |
72 | mov [hdid],0x10 |
73 | mov [hdpos],4 |
73 | mov [hdpos],4 |
74 | mov [fat32part],1 |
74 | mov [fat32part],1 |
75 | search_partitions_ide3_1: |
75 | search_partitions_ide3_1: |
76 | call set_FAT32_variables |
76 | call set_FAT32_variables |
77 | cmp [problem_partition],0 |
77 | cmp [problem_partition],0 |
78 | jne end_search_partitions_ide |
78 | jne end_search_partitions_ide |
79 | inc byte [DRIVE_DATA+5] |
79 | inc byte [DRIVE_DATA+5] |
80 | call partition_data_transfer |
80 | call partition_data_transfer |
81 | add [transfer_adress],100 |
81 | add [transfer_adress],100 |
82 | inc [fat32part] |
82 | inc [fat32part] |
83 | jmp search_partitions_ide3_1 |
83 | jmp search_partitions_ide3_1 |
84 | 84 | ||
85 | end_search_partitions_ide: |
85 | end_search_partitions_ide: |
86 | mov [hdpos], 80h |
86 | mov [hdpos], 80h |
87 | mov ecx, [NumBiosDisks] |
87 | mov ecx, [NumBiosDisks] |
88 | test ecx, ecx |
88 | test ecx, ecx |
89 | jz end_search_partitions |
89 | jz end_search_partitions |
90 | start_search_partitions_bd: |
90 | start_search_partitions_bd: |
91 | push ecx |
91 | push ecx |
92 | mov eax, [hdpos] |
92 | mov eax, [hdpos] |
93 | and [BiosDiskPartitions+(eax-80h)*4], 0 |
93 | and [BiosDiskPartitions+(eax-80h)*4], 0 |
94 | mov [fat32part], 1 |
94 | mov [fat32part], 1 |
95 | search_partitions_bd: |
95 | search_partitions_bd: |
96 | call set_FAT32_variables |
96 | call set_FAT32_variables |
97 | cmp [problem_partition], 0 |
97 | cmp [problem_partition], 0 |
98 | jne end_search_partitions_bd |
98 | jne end_search_partitions_bd |
99 | mov eax, [hdpos] |
99 | mov eax, [hdpos] |
100 | inc [BiosDiskPartitions+(eax-80h)*4] |
100 | inc [BiosDiskPartitions+(eax-80h)*4] |
101 | call partition_data_transfer |
101 | call partition_data_transfer |
102 | add [transfer_adress], 100 |
102 | add [transfer_adress], 100 |
103 | inc [fat32part] |
103 | inc [fat32part] |
104 | jmp search_partitions_bd |
104 | jmp search_partitions_bd |
105 | end_search_partitions_bd: |
105 | end_search_partitions_bd: |
106 | pop ecx |
106 | pop ecx |
107 | inc [hdpos] |
107 | inc [hdpos] |
108 | loop start_search_partitions_bd |
108 | loop start_search_partitions_bd |
109 | jmp end_search_partitions |
109 | jmp end_search_partitions |
110 | 110 | ||
111 | partition_data_transfer: |
111 | partition_data_transfer: |
112 | mov edi,[transfer_adress] |
112 | mov edi,[transfer_adress] |
113 | mov esi,PARTITION_START |
113 | mov esi,PARTITION_START |
114 | mov ecx,(file_system_data_size+3)/4 |
114 | mov ecx,(file_system_data_size+3)/4 |
115 | rep movsd |
115 | rep movsd |
116 | ret |
116 | ret |
117 | uglobal |
117 | uglobal |
118 | transfer_adress dd 0 |
118 | transfer_adress dd 0 |
119 | endg |
119 | endg |
120 | partition_data_transfer_1: |
120 | partition_data_transfer_1: |
121 | ; cli |
121 | ; cli |
122 | push edi |
122 | push edi |
123 | mov edi,PARTITION_START |
123 | mov edi,PARTITION_START |
124 | mov esi,[transfer_adress] |
124 | mov esi,[transfer_adress] |
125 | mov ecx,(file_system_data_size+3)/4 |
125 | mov ecx,(file_system_data_size+3)/4 |
126 | rep movsd |
126 | rep movsd |
127 | pop edi |
127 | pop edi |
128 | ; sti |
128 | ; sti |
129 | ret |
129 | ret |
130 | 130 | ||
131 | end_search_partitions: |
131 | end_search_partitions: |
132 | 132 | ||
133 | ;PARTITION_START dd 0x3f |
133 | ;PARTITION_START dd 0x3f |
134 | ;PARTITION_END dd 0 |
134 | ;PARTITION_END dd 0 |
135 | ;SECTORS_PER_FAT dd 0x1f3a |
135 | ;SECTORS_PER_FAT dd 0x1f3a |
136 | ;NUMBER_OF_FATS dd 0x2 |
136 | ;NUMBER_OF_FATS dd 0x2 |
137 | ;SECTORS_PER_CLUSTER dd 0x8 |
137 | ;SECTORS_PER_CLUSTER dd 0x8 |
138 | ;BYTES_PER_SECTOR dd 0x200 ; Note: if BPS <> 512 need lots of changes |
138 | ;BYTES_PER_SECTOR dd 0x200 ; Note: if BPS <> 512 need lots of changes |
139 | ;ROOT_CLUSTER dd 2 ; first rootdir cluster |
139 | ;ROOT_CLUSTER dd 2 ; first rootdir cluster |
140 | ;FAT_START dd 0 ; start of fat table |
140 | ;FAT_START dd 0 ; start of fat table |
141 | ;ROOT_START dd 0 ; start of rootdir (only fat16) |
141 | ;ROOT_START dd 0 ; start of rootdir (only fat16) |
142 | ;ROOT_SECTORS dd 0 ; count of rootdir sectors (only fat16) |
142 | ;ROOT_SECTORS dd 0 ; count of rootdir sectors (only fat16) |
143 | ;DATA_START dd 0 ; start of data area (=first cluster 2) |
143 | ;DATA_START dd 0 ; start of data area (=first cluster 2) |
144 | ;LAST_CLUSTER dd 0 ; last availabe cluster |
144 | ;LAST_CLUSTER dd 0 ; last availabe cluster |
145 | ;ADR_FSINFO dd 0 ; used only by fat32 |
145 | ;ADR_FSINFO dd 0 ; used only by fat32 |
146 | ; |
146 | ; |
147 | ;fatRESERVED dd 0x0FFFFFF6 |
147 | ;fatRESERVED dd 0x0FFFFFF6 |
148 | ;fatBAD dd 0x0FFFFFF7 |
148 | ;fatBAD dd 0x0FFFFFF7 |
149 | ;fatEND dd 0x0FFFFFF8 |
149 | ;fatEND dd 0x0FFFFFF8 |
150 | ;fatMASK dd 0x0FFFFFFF |
150 | ;fatMASK dd 0x0FFFFFFF |
151 | ; |
151 | ; |
152 | ;fat_type db 0 ; 0=none, 16=fat16, 32=fat32> |
152 | ;fat_type db 0 ; 0=none, 16=fat16, 32=fat32> |