Subversion Repositories Kolibri OS

Rev

Rev 2 | Rev 321 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2 Rev 5
1
;****************************************************
1
;****************************************************
2
;     ïîèñê ëîãè÷åñêèõ äèñêîâ íà îáíàðóæåííûõ HDD
2
;     ïîèñê ëîãè÷åñêèõ äèñêîâ íà îáíàðóæåííûõ HDD
3
;     è çàíåñåíèå äàííûõ â îáëàñòü òàáëèöû
3
;     è çàíåñåíèå äàííûõ â îáëàñòü òàáëèöû
4
;     àâòîð Mario79
4
;     àâòîð Mario79
5
;****************************************************
5
;****************************************************
6
      mov   [transfer_adress],0x4000a
6
      mov   [transfer_adress],0x4000a
7
 search_partitions_ide0:
7
 search_partitions_ide0:
8
      test  [0x40001],byte 0x40
8
      test  [0x40001],byte 0x40
9
      jz   search_partitions_ide1
9
      jz   search_partitions_ide1
10
        mov   [hdbase],0x1f0
10
        mov   [hdbase],0x1f0
11
        mov   [hdid],0x0
11
        mov   [hdid],0x0
12
        mov   [hdpos],1
12
        mov   [hdpos],1
13
      mov  [fat32part],1
13
      mov  [fat32part],1
14
 search_partitions_ide0_1:
14
 search_partitions_ide0_1:
15
      call  set_FAT32_variables
15
      call  set_FAT32_variables
16
      cmp   [problem_partition],0
16
      cmp   [problem_partition],0
17
      jne   search_partitions_ide1
17
      jne   search_partitions_ide1
18
      inc   byte [0x40002]
18
      inc   byte [0x40002]
19
      call  partition_data_transfer
19
      call  partition_data_transfer
20
      add   [transfer_adress],100
20
      add   [transfer_adress],100
21
      inc   [fat32part]
21
      inc   [fat32part]
22
      jmp   search_partitions_ide0_1
22
      jmp   search_partitions_ide0_1
23
 
23
 
24
 search_partitions_ide1:
24
 search_partitions_ide1:
25
      test  [0x40001],byte 0x10
25
      test  [0x40001],byte 0x10
26
      jz   search_partitions_ide2
26
      jz   search_partitions_ide2
27
        mov   [hdbase],0x1f0
27
        mov   [hdbase],0x1f0
28
        mov   [hdid],0x10
28
        mov   [hdid],0x10
29
        mov   [hdpos],2
29
        mov   [hdpos],2
30
      mov  [fat32part],1
30
      mov  [fat32part],1
31
 search_partitions_ide1_1:
31
 search_partitions_ide1_1:
32
      call  set_FAT32_variables
32
      call  set_FAT32_variables
33
      cmp   [problem_partition],0
33
      cmp   [problem_partition],0
34
      jne   search_partitions_ide2
34
      jne   search_partitions_ide2
35
      inc   byte [0x40003]
35
      inc   byte [0x40003]
36
      call  partition_data_transfer
36
      call  partition_data_transfer
37
      add   [transfer_adress],100
37
      add   [transfer_adress],100
38
      inc   [fat32part]
38
      inc   [fat32part]
39
      jmp   search_partitions_ide1_1
39
      jmp   search_partitions_ide1_1
40
 
40
 
41
 search_partitions_ide2:
41
 search_partitions_ide2:
42
      test  [0x40001],byte 0x4
42
      test  [0x40001],byte 0x4
43
      jz   search_partitions_ide3
43
      jz   search_partitions_ide3
44
        mov   [hdbase],0x170
44
        mov   [hdbase],0x170
45
        mov   [hdid],0x0
45
        mov   [hdid],0x0
46
        mov   [hdpos],3
46
        mov   [hdpos],3
47
      mov  [fat32part],1
47
      mov  [fat32part],1
48
 search_partitions_ide2_1:
48
 search_partitions_ide2_1:
49
      call  set_FAT32_variables
49
      call  set_FAT32_variables
50
      cmp   [problem_partition],0
50
      cmp   [problem_partition],0
51
      jne   search_partitions_ide3
51
      jne   search_partitions_ide3
52
      inc   byte [0x40004]
52
      inc   byte [0x40004]
53
      call  partition_data_transfer
53
      call  partition_data_transfer
54
      add   [transfer_adress],100
54
      add   [transfer_adress],100
55
      inc   [fat32part]
55
      inc   [fat32part]
56
      jmp   search_partitions_ide2_1
56
      jmp   search_partitions_ide2_1
57
 
57
 
58
 search_partitions_ide3:
58
 search_partitions_ide3:
59
      test  [0x40001],byte 0x1
59
      test  [0x40001],byte 0x1
60
      jz   end_search_partitions_ide
60
      jz   end_search_partitions_ide
61
        mov   [hdbase],0x170
61
        mov   [hdbase],0x170
62
        mov   [hdid],0x10
62
        mov   [hdid],0x10
63
        mov   [hdpos],4
63
        mov   [hdpos],4
64
      mov  [fat32part],1
64
      mov  [fat32part],1
65
 search_partitions_ide3_1:
65
 search_partitions_ide3_1:
66
      call  set_FAT32_variables
66
      call  set_FAT32_variables
67
      cmp   [problem_partition],0
67
      cmp   [problem_partition],0
68
      jne   end_search_partitions_ide
68
      jne   end_search_partitions_ide
69
      inc   byte [0x40005]
69
      inc   byte [0x40005]
70
      call  partition_data_transfer
70
      call  partition_data_transfer
71
      add   [transfer_adress],100
71
      add   [transfer_adress],100
72
      inc   [fat32part]
72
      inc   [fat32part]
73
      jmp   search_partitions_ide3_1
73
      jmp   search_partitions_ide3_1
74
 
74
 
75
 
75
 
76
partition_data_transfer: 
76
partition_data_transfer: 
77
     mov edi,[transfer_adress]
77
     mov edi,[transfer_adress]
78
     mov esi,PARTITION_START
78
     mov esi,PARTITION_START
79
     xor ecx,ecx
79
     xor ecx,ecx
80
     mov cx,69   ;100
80
     mov cx,69   ;100
81
     rep movsb
81
     rep movsb
82
     ret
82
     ret
83
transfer_adress dd 0
83
transfer_adress dd 0
84
partition_data_transfer_1:
84
partition_data_transfer_1:
85
     cli 
85
     cli
-
 
86
     push edi
86
     mov edi,PARTITION_START
87
     mov edi,PARTITION_START
87
     mov esi,[transfer_adress]
88
     mov esi,[transfer_adress]
88
     xor ecx,ecx
89
     xor ecx,ecx
89
     mov cx,69  ;100
90
     mov cx,69  ;100
90
     rep movsb
91
     rep movsb
-
 
92
     pop  edi
91
     sti
93
     sti
92
     ret
94
     ret
93
 
95
 
94
 end_search_partitions_ide:
96
 end_search_partitions_ide:
95
 
97
 
96
;PARTITION_START      dd 0x3f
98
;PARTITION_START      dd 0x3f
97
;PARTITION_END        dd 0
99
;PARTITION_END        dd 0
98
;SECTORS_PER_FAT      dd 0x1f3a
100
;SECTORS_PER_FAT      dd 0x1f3a
99
;NUMBER_OF_FATS       dd 0x2
101
;NUMBER_OF_FATS       dd 0x2
100
;SECTORS_PER_CLUSTER  dd 0x8
102
;SECTORS_PER_CLUSTER  dd 0x8
101
;BYTES_PER_SECTOR     dd 0x200   ; Note: if BPS <> 512 need lots of changes
103
;BYTES_PER_SECTOR     dd 0x200   ; Note: if BPS <> 512 need lots of changes
102
;ROOT_CLUSTER         dd 2       ; first rootdir cluster
104
;ROOT_CLUSTER         dd 2       ; first rootdir cluster
103
;FAT_START            dd 0       ; start of fat table
105
;FAT_START            dd 0       ; start of fat table
104
;ROOT_START           dd 0       ; start of rootdir (only fat16)
106
;ROOT_START           dd 0       ; start of rootdir (only fat16)
105
;ROOT_SECTORS         dd 0       ; count of rootdir sectors (only fat16)
107
;ROOT_SECTORS         dd 0       ; count of rootdir sectors (only fat16)
106
;DATA_START           dd 0       ; start of data area (=first cluster 2)
108
;DATA_START           dd 0       ; start of data area (=first cluster 2)
107
;LAST_CLUSTER         dd 0       ; last availabe cluster
109
;LAST_CLUSTER         dd 0       ; last availabe cluster
108
;ADR_FSINFO           dd 0       ; used only by fat32
110
;ADR_FSINFO           dd 0       ; used only by fat32
109
;
111
;
110
;fatRESERVED          dd 0x0FFFFFF6
112
;fatRESERVED          dd 0x0FFFFFF6
111
;fatBAD               dd 0x0FFFFFF7
113
;fatBAD               dd 0x0FFFFFF7
112
;fatEND               dd 0x0FFFFFF8
114
;fatEND               dd 0x0FFFFFF8
113
;fatMASK              dd 0x0FFFFFFF
115
;fatMASK              dd 0x0FFFFFFF
114
;
116
;
115
;fat_type             db 0       ; 0=none, 16=fat16, 32=fat32
117
;fat_type             db 0       ; 0=none, 16=fat16, 32=fat32