将存储在FAT表(FAT12文件系统)集群数量从软盘读 [英] Converting the cluster number stored in FAT table (of FAT12 filesystem) for reading from a floppy disk

查看:570
本文介绍了将存储在FAT表(FAT12文件系统)集群数量从软盘读的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在写一个FAT12文件系统中的两阶段引导程序。引导程序的加载阶段1从软盘这是FAT12文件系统的阶段2。现在我有转换簇号(即我从FAT表获得)含有的轨道,磁头和扇区号的格式问题。我下面的教程 http://www.brokenthorn.com/Resources/OSDev6.html制作的引导程序。

I'm writing a two stage bootloader for a FAT12 filesystem. The stage1 of the bootloader loads the stage2 from a floppy disk which is in FAT12 filesystem. Now I am having problem converting the cluster number (that I obtain from the FAT table) to a format containing the track, head and sector number. I was following the tutorial http://www.brokenthorn.com/Resources/OSDev6.html for making the bootloader.

在这里,我困惑的是,在本教程从FAT中获得的簇号首先被转化为LBA(线性块地址)格式,然后读取扇区到内存中之前转换为CHS(柱面磁头扇区)格式。

My confusion here is that in the tutorial the Cluster Number obtained from the FAT is converted to LBA(Linear Block Address) format first and then converted to CHS(Cylinder Head Sector) Format before reading the sector into memory.

为什么我不能直接转换簇号为CHS格式?请问FAT表不存储群集号线?我想确切地知道我是缺少在这里?

Why can't I directly convert the Cluster Number into CHS format?? Does the FAT table not store the Cluster Numbers linearly?? I want to know exactly what i am missing here??

在本教程中使用引导程序的源$ C ​​$ C的链路在链路的 http://www.brokenthorn.com/Resources/OSDev6.html

The link to the source code of the bootloader used in the tutorial is at the end of the page of the link http://www.brokenthorn.com/Resources/OSDev6.html.

推荐答案

的簇编号是线性的,而是 - 如已经pviously提到$ P $ - 是相对于数据区,簇2是数据的第一簇区。从磁盘读取,然而,在磁盘扇区的条款,并且每个FAT群集可能包含多个部门 - 这就是转换为LBA是 - 从一个簇号转换为一个扇区号(所以,从所需的集群数量减去2 - 考虑到作为数据区域的第一个簇,然后乘以每个群集磁盘的扇区数簇2,然后将数据区之前添加使用的磁盘扇区数,拿出我们在哪里存储数据的绝对磁盘扇区(S)。

The cluster numbers are linear but - as has been previously mentioned - are relative to the data area, with cluster 2 being the first cluster of the data area. Reads from the disk, however, are in terms of disk sectors, and each FAT cluster may contain multiple sectors - this is what the conversion to LBA is for - to convert from a cluster number to a sector number (so, subtract 2 from the required cluster number - to account for cluster 2 being the first cluster of the data area, then multiply by the number of disk sectors per cluster, and then add the number of disk sectors in use before the data area, to come up with the absolute disk sector(s) where our data is stored.

旧BIOS INT 0x13功能没有在绝对扇区而言磁盘虽然读 - 他们阅读一个specifc扇区,由一个特定的头,在特定气缸( http://en.wikipedia.org/wiki/Cylinder-head-sector )。因此,如果你使用这些功能,你需要采取的工作哪些柱面/磁头/扇区对应于你想读的绝对部门的增加一步。另一种方法是 - 如果有的话 - 使用的延伸阅读的INT 0x13函数,该函数绝对扇区(LBA)直接解决了

The older BIOS int 0x13 functions didn't read from the disk in terms of absolute sectors though - they read a specifc sector, by a specific head, on a specific cylinder (http://en.wikipedia.org/wiki/Cylinder-head-sector). Therefore if you use these functions you need to take the added step of working out which cylinder/head/sector corresponds to the absolute sector you want to read. An alternative is - if available - to use the extended read int 0x13 function, which takes absolute sector (LBA) addresses directly.

这篇关于将存储在FAT表(FAT12文件系统)集群数量从软盘读的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆