Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
431 serge 1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
709 diamond 3
;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;;
431 serge 4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
593 mikedld 7
 
8
$Revision: 848 $
9
 
10
 
11
;****************************************************
1 ha 12
;     поиск логических дисков на обнаруженных HDD
13
;     и занесение данных в область таблицы
14
;     автор Mario79
15
;****************************************************
412 serge 16
      mov   [transfer_adress],DRIVE_DATA+0xa
1 ha 17
 search_partitions_ide0:
412 serge 18
      test  [DRIVE_DATA+1],byte 0x40
1 ha 19
      jz   search_partitions_ide1
20
        mov   [hdbase],0x1f0
21
        mov   [hdid],0x0
22
        mov   [hdpos],1
23
      mov  [fat32part],1
24
 search_partitions_ide0_1:
25
      call  set_FAT32_variables
848 serge 26
 
1 ha 27
      cmp   [problem_partition],0
28
      jne   search_partitions_ide1
412 serge 29
      inc   byte [DRIVE_DATA+2]
1 ha 30
      call  partition_data_transfer
31
      add   [transfer_adress],100
32
      inc   [fat32part]
33
      jmp   search_partitions_ide0_1
34
 
35
 search_partitions_ide1:
412 serge 36
      test  [DRIVE_DATA+1],byte 0x10
1 ha 37
      jz   search_partitions_ide2
38
        mov   [hdbase],0x1f0
39
        mov   [hdid],0x10
40
        mov   [hdpos],2
41
      mov  [fat32part],1
42
 search_partitions_ide1_1:
43
      call  set_FAT32_variables
44
      cmp   [problem_partition],0
45
      jne   search_partitions_ide2
412 serge 46
      inc   byte [DRIVE_DATA+3]
1 ha 47
      call  partition_data_transfer
48
      add   [transfer_adress],100
49
      inc   [fat32part]
50
      jmp   search_partitions_ide1_1
51
 
52
 search_partitions_ide2:
412 serge 53
      test  [DRIVE_DATA+1],byte 0x4
1 ha 54
      jz   search_partitions_ide3
55
        mov   [hdbase],0x170
56
        mov   [hdid],0x0
57
        mov   [hdpos],3
58
      mov  [fat32part],1
59
 search_partitions_ide2_1:
60
      call  set_FAT32_variables
61
      cmp   [problem_partition],0
62
      jne   search_partitions_ide3
412 serge 63
      inc   byte [DRIVE_DATA+4]
1 ha 64
      call  partition_data_transfer
65
      add   [transfer_adress],100
66
      inc   [fat32part]
67
      jmp   search_partitions_ide2_1
68
 
69
 search_partitions_ide3:
412 serge 70
      test  [DRIVE_DATA+1],byte 0x1
1 ha 71
      jz   end_search_partitions_ide
72
        mov   [hdbase],0x170
73
        mov   [hdid],0x10
74
        mov   [hdpos],4
75
      mov  [fat32part],1
76
 search_partitions_ide3_1:
77
      call  set_FAT32_variables
78
      cmp   [problem_partition],0
79
      jne   end_search_partitions_ide
412 serge 80
      inc   byte [DRIVE_DATA+5]
1 ha 81
      call  partition_data_transfer
82
      add   [transfer_adress],100
83
      inc   [fat32part]
84
      jmp   search_partitions_ide3_1
85
 
709 diamond 86
end_search_partitions_ide:
87
        mov     [hdpos], 80h
88
        mov     ecx, [NumBiosDisks]
89
        test    ecx, ecx
90
        jz      end_search_partitions
91
start_search_partitions_bd:
92
        push    ecx
93
        mov     eax, [hdpos]
94
        and     [BiosDiskPartitions+(eax-80h)*4], 0
95
        mov     [fat32part], 1
96
search_partitions_bd:
97
        call    set_FAT32_variables
98
        cmp     [problem_partition], 0
99
        jne     end_search_partitions_bd
100
        mov     eax, [hdpos]
101
        inc     [BiosDiskPartitions+(eax-80h)*4]
102
        call    partition_data_transfer
103
        add     [transfer_adress], 100
104
        inc     [fat32part]
105
        jmp     search_partitions_bd
106
end_search_partitions_bd:
107
        pop     ecx
108
        inc     [hdpos]
109
        loop    start_search_partitions_bd
110
        jmp     end_search_partitions
412 serge 111
 
112
partition_data_transfer:
1 ha 113
     mov edi,[transfer_adress]
114
     mov esi,PARTITION_START
321 diamond 115
     mov ecx,(file_system_data_size+3)/4
116
     rep movsd
1 ha 117
     ret
321 diamond 118
uglobal
1 ha 119
transfer_adress dd 0
321 diamond 120
endg
1 ha 121
partition_data_transfer_1:
321 diamond 122
;     cli
5 halyavin 123
     push edi
1 ha 124
     mov edi,PARTITION_START
125
     mov esi,[transfer_adress]
321 diamond 126
     mov ecx,(file_system_data_size+3)/4
127
     rep movsd
5 halyavin 128
     pop  edi
321 diamond 129
;     sti
1 ha 130
     ret
131
 
709 diamond 132
 end_search_partitions:
1 ha 133
 
134
;PARTITION_START      dd 0x3f
135
;PARTITION_END        dd 0
136
;SECTORS_PER_FAT      dd 0x1f3a
137
;NUMBER_OF_FATS       dd 0x2
138
;SECTORS_PER_CLUSTER  dd 0x8
139
;BYTES_PER_SECTOR     dd 0x200   ; Note: if BPS <> 512 need lots of changes
140
;ROOT_CLUSTER         dd 2       ; first rootdir cluster
141
;FAT_START            dd 0       ; start of fat table
142
;ROOT_START           dd 0       ; start of rootdir (only fat16)
143
;ROOT_SECTORS         dd 0       ; count of rootdir sectors (only fat16)
144
;DATA_START           dd 0       ; start of data area (=first cluster 2)
145
;LAST_CLUSTER         dd 0       ; last availabe cluster
146
;ADR_FSINFO           dd 0       ; used only by fat32
147
;
148
;fatRESERVED          dd 0x0FFFFFF6
149
;fatBAD               dd 0x0FFFFFF7
150
;fatEND               dd 0x0FFFFFF8
151
;fatMASK              dd 0x0FFFFFFF
152
;
153
;fat_type             db 0       ; 0=none, 16=fat16, 32=fat32
154