码迷,mamicode.com
首页 > 其他好文 > 详细

FAT12

时间:2019-11-14 09:43:12      阅读:85      评论:0      收藏:0      [点我收藏+]

标签:ble   ati   src   com   necessary   tables   str   cat   files   

FAT12 is one of FAT file system families,mostly used on 1.44MB floppy disk。

FAT ‘s full name is File Allocation System

 

FAT12 has 4 key parts as follows:

  1. boot sector
  2. FAT tables
  3. root directory entry
  4. data area

技术图片 

 

Boot sector:

Store data and code that necessary for OS or other users to use it. The data is BPB, BIOS Parameter Block。

regularly, BPB take 25 Bytes, some attributes :

技术图片

As you can see, in fat12, it has 512 Bytes every sector, and a cluster has ONLY one sector.

 

And you can write your program into the code area of boot , for example, you can use it to create you OS with a tool--Bochs.

 

FAT tables:

  FAT tables is very important.

  It take Sector 1 to Sector 18, 18 sectors totally. And it‘s has two copies,--FAT1, FAT2

  it was splited into little entries. Every entry has 12 bits. 

  Why 12 bits, because 1.44MB floppy need 12 bits to address: 2^11< 1.44MB < 2^12

  every 12-bit entry is one-to-one-correspondence to a cluster in data area.  So it just like contents of books, which can locate to the chapters.

 

  12 bits means a value, it has special meaning:

 

 

 技术图片

 

 

 

 

Root Directory Entry:

  A file system must has root, FAT12 has root directories.

  We know that there are two types things in a file system: 1. File, 2. Directory

  So how to express and store them???

 

  In FAT12, every directory has a sector to store it‘s sub-directories or files. As for the sector, if it‘s root directory or file(parallel to the root dir), it‘s stored in Root Dorectory Area. Others are stored in data area.

  enery Dir or file has a entry, which is 32 bytes:

技术图片

 

 

 

 

   so: a dir has 16 sub-dir or files at most. 

  Where is the cluster of sub-dir?

    A entry has attr "First Logicial Cluster", which point to the next cluster. As for a dir , it‘s cluster No of  it‘s entries of sub-files, sub-dir. As for File, if it‘s size < 512Bytes, over. if not ,it has another cluster, and the logical cluster points to it.

    (Note: A file take integer clusters)

 

Data Area:

  The main area of data, store file/dir entries and file data.

 

 

 

总结:

  文件系统由根目录开始,每个目录/文件有一个表项,存储了相关的信息,其中,根目录/根文件的表项存在根目录区,而其他普通的则存在数据区。

  对于每个表项,占32位,其中有第一逻辑簇号FLC,目录的FLC指向另一个簇,里面存的的文件和子目录的表项,一个目录最多有16个子目录和文件。文件的GLC指向的簇里存储了文件的内容,如果文件大于512字节,需要另一个存,用当前簇号去FAT表中取出下一簇号即可重定位到下一簇。

 

 

 

 

 

 

 

 

 

 

 

 

 

 

FAT12

标签:ble   ati   src   com   necessary   tables   str   cat   files   

原文地址:https://www.cnblogs.com/XT-xutao/p/11854448.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!