FAT12 FAT16 FAT32 学习

本文详细介绍了FAT文件系统的三种类型:FAT12、FAT16和FAT32,并阐述了它们之间的基本差异及其适用场景。文章还深入探讨了BIOS参数块(BPB)的作用及演变过程,包括其在不同版本MS-DOS中的变化。

Currently there are three FAT file system types: FAT12, FAT16 and FAT32. The basic difference in these FAT
sub types, and the reason for the names, is the size, in bits, of the entries in the actual FAT
structure on the disk. There are 12 bits in a FAT12 FAT entry, 16 bits in a FAT16 FAT entry
and 32 bits in a FAT32 FAT entry. 

Contents
Notational Conventions in this Document................................................................................. 6
General Comments (Applicable to FAT File System All Types)............................................... 6
Boot Sector and BPB ................................................................................................................ 6
FAT Data Structure ................................................................................................................. 12
FAT Type Determination......................................................................................................... 13
FAT Volume Initialization ........................................................................................................ 18
FAT32 FSInfo Sector Structure and Backup Boot Sector ...................................................... 20
FAT Directory Structure .......................................................................................................... 21
Other Notes Relating to FAT Directories ................................................................................ 24
Specification Compliance........................................................................................................ 25

Notational Conventions in this Document


Numbers that have the characters “0x” at the beginning of them are hexadecimal (base 16) numbers.
Any numbers that do not have the characters “0x” at the beginning are decimal (base 10) numbers.
The code fragments in this document are written in the ‘C’ programming language. Strict typing and
syntax are not adhered to.
There are several code fragments in this document that freely mix 32-bit and 16-bit data elements. It is
assumed that you are a programmer who understands how to properly type such operations so that
data is not lost due to truncation of 32-bit values to 16-bit values. Also take note that all data types are
UNSIGNED. Do not do FAT computations with signed integer types, because the computations will
be wrong on some FAT volumes.


General Comments (Applicable to FAT File System All Types)
All of the FAT file systems were originally developed for the IBM PC machine architecture. The
importance of this is that FAT file system on disk data structure is all “little endian.” If we look at one
32-bit FAT entry stored on disk as a series of four 8-bit bytes—the first being byte[0] and the last
being byte[4]—here is where the 32 bits numbered 00 through 31 are (00 being the least significant
bit):
byte[3] 3 3 2 2 2 2 2 2
1 0 9 8 7 6 5 4
byte[2] 2 2 2 2 1 1 1 1
3 2 1 0 9 8 7 6
byte[1] 1 1 1 1 1 1 0 0
5 4 3 2 1 0 9 8
byte[0] 0 0 0 0 0 0 0 0
7 6 5 4 3 2 1 0
This is important if your machine is a “big endian” machine, because you will have to translate
between big and little endian as you move data to and from the disk.
A FAT file system volume is composed of four basic regions, which are laid out in this order on the
volume:
0 – Reserved Region
1 – FAT Region
2 – Root Directory Region (doesn’t exist on FAT32 volumes)
3 – File and Directory Data Region


Boot Sector and BPB
The first important data structure on a FAT volume is called the BPB (BIOS Parameter Block), which
is located in the first sector of the volume in the Reserved Region. This sector is sometimes called the
“boot sector” or the “reserved sector” or the “0th sector,” but the important fact is simply that it is the
first sector of the volume.
This is the first thing about the FAT file system that sometimes causes confusion. In MS-DOS version
1.x, there was not a BPB in the boot sector. In this first version of the FAT file system, there were
only two different formats, the one for single-sided and the one for double-sided 360K 5.25-inchfloppy disks. The determination of which type was on the disk was done by looking at the first byte of
the FAT (the low 8 bits of FAT[0]).
This type of media determination was superseded in MS-DOS version 2.x by putting a BPB in the
boot sector, and the old style of media determination (done by looking at the first byte of the FAT)
was no longer supported. All FAT volumes must have a BPB in the boot sector.
This brings us to the second point of confusion relating to FAT volume determination: What exactly
does a BPB look like? The BPB in the boot sector defined for MS-DOS 2.x only allowed for a FAT
volume with strictly less than 65,536 sectors (32 MB worth of 512-byte sectors). This limitation was
due to the fact that the “total sectors” field was only a 16-bit field. This limitation was addressed by
MS-DOS 3.x, where the BPB was modified to include a new 32-bit field for the total sectors value.
The next BPB change occurred with the Microsoft Windows 95 operating system, where the FAT32
type was introduced. FAT16 was limited by the maximum size of the FAT and the maximum valid
cluster size to no more than a 2 GB volume if the disk had 512-byte sectors. FAT32 addressed this
limitation on the amount of disk space that one FAT volume could occupy so that disks larger than
2 GB only had to have one partition defined.
The FAT32 BPB exactly matches the FAT12/FAT16 BPB up to and including the BPB_TotSec32
field. They differ starting at offset 36, depending on whether the media type is FAT12/FAT16 or
FAT32 (see discussion below for determining FAT type). The relevant point here is that the BPB in
the boot sector of a FAT volume should always be one that has all of the new BPB fields for either the
FAT12/FAT16 or FAT32 BPB type. Doing it this way ensures the maximum compatibility of the FAT
volume and ensures that all FAT file system drivers will understand and support the volume properly,
because it always contains all of the currently defined fields.
NOTE: In the following description, all the fields whose names start with BPB_ are part of the BPB.
All the fields whose names start with BS_ are part of the boot sector and not really part of the BPB.
The following shows the start of sector 0 of a FAT volume, which contains the BPB

 

基于径向基函数神经网络RBFNN的自适应滑模控制学习(Matlab代码实现)内容概要:本文介绍了基于径向基函数神经网络(RBFNN)的自适应滑模控制方法,并提供了相应的Matlab代码实现。该方法结合了RBF神经网络的非线性逼近能力和滑模控制的强鲁棒性,用于解决复杂系统的控制问题,尤其适用于存在不确定性和外部干扰的动态系统。文中详细阐述了控制算法的设计思路、RBFNN的结构与权重更新机制、滑模面的构建以及自适应律的推导过程,并通过Matlab仿真验证了所提方法的有效性和稳定性。此外,文档还列举了大量相关的科研方向和技术应用,涵盖智能优化算法、机器学习、电力系统、路径规划等多个领域,展示了该技术的广泛应用前景。; 适合人群:具备一定自动控制理论基础和Matlab编程能力的研究生、科研人员及工程技术人员,特别是从事智能控制、非线性系统控制及相关领域的研究人员; 使用场景及目标:①学习和掌握RBF神经网络与滑模控制相结合的自适应控制策略设计方法;②应用于电机控制、机器人轨迹跟踪、电力电子系统等存在模型不确定性或外界扰动的实际控制系统中,提升控制精度与鲁棒性; 阅读建议:建议读者结合提供的Matlab代码进行仿真实践,深入理解算法实现细节,同时可参考文中提及的相关技术方向拓展研究思路,注重理论分析与仿真验证相结合。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值