📄 fat32readfile.c
字号:
#ifndef _FAT32_DEFINE
#include "FAT32.c"
#endif
WORD FAT32ReadFile(BYTE fp);
WORD FAT32ReadFile(BYTE fp)
{
register WORD tmp;
if (FCB[fp].ByteCnt==FCB[fp].Size) return(0);
else
{
FCB[fp].ByteCnt+=IDE.BytesPerSec;
if (FCB[fp].ByteCnt<=FCB[fp].Size) tmp=IDE.BytesPerSec;
else
{
FCB[fp].ByteCnt-=IDE.BytesPerSec;
tmp=FCB[fp].Size-FCB[fp].ByteCnt;
FCB[fp].ByteCnt=FCB[fp].Size;
}
if (FCB[fp].ClusSecCnt==FAT32.SecPerClus) //读下一簇
{
FCB[fp].LastCluster=FAT32NextCluster(FCB[fp].LastCluster);
if (FCB[fp].LastCluster==0x0fffffff) return(0);
IDEReadSector(ClusterToSector(FCB[fp].LastCluster));
FCB[fp].ClusSecCnt=1;
}
else if (FCB[fp].ClusSecCnt==0) //读第一簇
{
IDEReadSector(ClusterToSector(FCB[fp].LastCluster));
FCB[fp].ClusSecCnt++;
}
else //读当前簇下一扇区
{
IDEReadSector(ClusterToSector(FCB[fp].LastCluster)+FCB[fp].ClusSecCnt);
FCB[fp].ClusSecCnt++;
}
}
return(tmp);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -