int 13h
与ah=02h
的顺序是什么,将从19
开始读取(C, H, S) = (0, 0, 1)
扇区,条件是(软盘)磁盘几何结构为2磁头,每磁道18个扇区和80个扇区每边都跟踪。
或更笼统地说,当磁道到达磁道0的头0时会发生什么?它会追踪1还是朝向1?在这种情况下,它甚至还能正常工作吗?
编辑:等等。这实际上是小时,分钟,秒吗?如果我们到达曲目的结尾(S大于18),那么H会增加吗?
答案 0 :(得分:2)
现代BIOS支持多磁道读写的概念,如果您在磁道末尾读取或写入,它将继续以下磁道。为了与最广泛的BIOS(旧的和新的)最兼容,您可能希望考虑不要跨越磁道边界进行读取或写入。
驱动器几何结构为每磁道18个扇区/ 2个磁头/ 80个柱面(软盘3.5英寸1.44MB),CHS(0,0,18)之后的扇区为CHS(0,1,1)。在CHS(0,1,18)处的下一个扇区是CHS(1,0,1)。在某种程度上,它类似于HH:MM:SS。
根据驱动器的几何形状,共有2880(80 * 2 * 18)个扇区。如果将扇区编号为0到2879(含),则将它们称为逻辑块地址(LBA)。
Int 13h/ah=2采用 CHS 值。您可以使用以下公式(或等效公式)将 LBA 转换为 CHS 值:
C = (LBA ÷ SPT) ÷ HPC H = (LBA ÷ SPT) mod HPC S = (LBA mod SPT) + 1 HPC = Heads per cylinder (aka Number of Heads) SPT = Sectors per Track, LBA = logical block address "mod" is the modulo operator (to get the remainder of a division)
我在将LBA转换为CHS 的其他Stackoverflow answer中已经写了关于 LBA 至 CHS 计算的更多信息。 。如果使用这些计算创建了表格,则编号将如下所示:
LBA = 0: CHS = ( 0, 0, 1) LBA = 1: CHS = ( 0, 0, 2) LBA = 2: CHS = ( 0, 0, 3) LBA = 3: CHS = ( 0, 0, 4) LBA = 4: CHS = ( 0, 0, 5) LBA = 5: CHS = ( 0, 0, 6) LBA = 6: CHS = ( 0, 0, 7) LBA = 7: CHS = ( 0, 0, 8) LBA = 8: CHS = ( 0, 0, 9) LBA = 9: CHS = ( 0, 0, 10) LBA = 10: CHS = ( 0, 0, 11) LBA = 11: CHS = ( 0, 0, 12) LBA = 12: CHS = ( 0, 0, 13) LBA = 13: CHS = ( 0, 0, 14) LBA = 14: CHS = ( 0, 0, 15) LBA = 15: CHS = ( 0, 0, 16) LBA = 16: CHS = ( 0, 0, 17) LBA = 17: CHS = ( 0, 0, 18) LBA = 18: CHS = ( 0, 1, 1) LBA = 19: CHS = ( 0, 1, 2) LBA = 20: CHS = ( 0, 1, 3) LBA = 21: CHS = ( 0, 1, 4) LBA = 22: CHS = ( 0, 1, 5) LBA = 23: CHS = ( 0, 1, 6) LBA = 24: CHS = ( 0, 1, 7) LBA = 25: CHS = ( 0, 1, 8) LBA = 26: CHS = ( 0, 1, 9) LBA = 27: CHS = ( 0, 1, 10) LBA = 28: CHS = ( 0, 1, 11) LBA = 29: CHS = ( 0, 1, 12) LBA = 30: CHS = ( 0, 1, 13) LBA = 31: CHS = ( 0, 1, 14) LBA = 32: CHS = ( 0, 1, 15) LBA = 33: CHS = ( 0, 1, 16) LBA = 34: CHS = ( 0, 1, 17) LBA = 35: CHS = ( 0, 1, 18) LBA = 36: CHS = ( 1, 0, 1) LBA = 37: CHS = ( 1, 0, 2) LBA = 38: CHS = ( 1, 0, 3) LBA = 39: CHS = ( 1, 0, 4) LBA = 40: CHS = ( 1, 0, 5) LBA = 41: CHS = ( 1, 0, 6) ... [snip] ... LBA = 2859: CHS = (79, 0, 16) LBA = 2860: CHS = (79, 0, 17) LBA = 2861: CHS = (79, 0, 18) LBA = 2862: CHS = (79, 1, 1) LBA = 2863: CHS = (79, 1, 2) LBA = 2864: CHS = (79, 1, 3) LBA = 2865: CHS = (79, 1, 4) LBA = 2866: CHS = (79, 1, 5) LBA = 2867: CHS = (79, 1, 6) LBA = 2868: CHS = (79, 1, 7) LBA = 2869: CHS = (79, 1, 8) LBA = 2870: CHS = (79, 1, 9) LBA = 2871: CHS = (79, 1, 10) LBA = 2872: CHS = (79, 1, 11) LBA = 2873: CHS = (79, 1, 12) LBA = 2874: CHS = (79, 1, 13) LBA = 2875: CHS = (79, 1, 14) LBA = 2876: CHS = (79, 1, 15) LBA = 2877: CHS = (79, 1, 16) LBA = 2878: CHS = (79, 1, 17) LBA = 2879: CHS = (79, 1, 18)