Ok... I'm seriously confused! For single-sector files, there is no problem, it points to the EOF indicator without a hitch. Then, on multi-sector files, the so-called 'next cluster' value I get is an insanely huge number (or one that points to a null entry).
For instance, a file I created to test the file i/o routines is called MultSect.txt and spans two sectors. According to the cluster information in the directory entry (which I have no problem reading), it's offset in the FAT is at 299... That can't be right, but at offset 298 there's '800C' and at offset 300 there's 'C9F0'. IIRC, I'm meant to flip these bytes, but that still points me to unusual places
. Any ideas?
Edit: here's the output from my OS, just so you can see what I'm talking about:
Working EOF on a single-sector file:
Code: Select all
Initializing Mattise... M
Floppy 1: 1.44MB 3.5in floppy
Floppy 2: No floppy drive.
Welcome to Mattise!
Version 1.0
Please enter your username and password to login...
Username: isemat
Password: *******
Reading sector 338... (the data area start is at 37)
Reading cluster at offset 302
EOF (ffff)
Welcome, isemat!
isemat@localhost> $
Not working on multi-sector file:
Code: Select all
isemat@localhost> $ read MULTSECTTXT M
Reading sector 336... (the data area start is at 37)
Reading cluster at offset 300
65481 (ffc9),Reading cluster at offset 65481
How did we get pointed to a null entry?
Hello, this is a file that spans two sectors.
While most of the file reads in the Mattise
filesystem read consecutive sectors, it is
useful to be able to read more than one sector
==============================================
==============================================
==============================================
==============================================
isemat@localhost> $
I just looked at the document Microsoft released on FAT, and it's left more questions than answers... Can someone out there please help me???