Subversion Repositories Kolibri OS

Rev

Rev 425 | Rev 593 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

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