【发布时间】:2012-04-18 18:35:39
【问题描述】:
我需要从预操作系统状态读取软盘,并且我有一个要读取的函数,但它似乎无法读取超过第 4 个扇区...
void get_block(blk, buf) int blk; char buf[]
{
int cyl, head, sector;
cyl = ((blk*2) / 18) / 2;
head = ((blk*2) / 18) % 2;
sector = (blk*2) % 18;
// Read first sector <<Dies here if blk > 2>>
diskr(cyl, head, sector, buf);
// Increment
if ((sector = (++sector % 18)) == 0)
if ((head = (++head % 2)) == 0)
cyl++;
// Read second sector <<Dies here if blk == 2>>
diskr(cyl, head, sector, buf+512);
}
知道为什么吗?我是否错误地从块转换?
【问题讨论】:
-
哇! ANSI C 之前!好久没看到了……
-
看看这个问题的第一个代码示例是否有帮助。他还引用了您可能想要在 Google 上搜索的内容:cboard.cprogramming.com/cplusplus-programming/…
-
@DietrichEpp:考虑到手头的任务似乎很合适:D
标签: c block head sector floppy