Paul's 8051 Code Library: Understanding the FAT32 Filesystem
Free 8051 source code: IDE Hard Drive Interface ... The Number of Sectors field can be checked to make sure you do not access (particularly write) beyond the end of the space that is allocated for the parition....