Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
I have my Floppy Driver working and I have set up a read for the Boot Information. This all work fine. I am now trying to implement File finding, but I have run into a problem The code I created to scan through the root dir in 32bit pieces should work but nothing ever is in it. I know the problem is not my Move function as I use it for the Disk Info Function. Am I missing something special that must be done to read the Root Dir.
- I know root Dir entries are 32bits
- I know there are 16 of them per sector
- I know the root dir starts on sector 19
- I know that the root dir is 14 sectors long
TDirectory = packed record
Filename : array[1..8] of char;
Extention : array[1..3] of char;
Attrib : Byte;
Reserved : Word;
CreationTime : Word;
CreationDate : Word;
LastAccessD : Word;
Ignore : Word;
LastWriteT : Word;
LastWriteD : Word;
StartCluster : Word;
FileSize : array[1..4] of byte;
end;
TRoot = array[0..224] of TDirectory;
function FindFile(FName : string) : word;
var
k, l : integer;
Found : boolean = false;
begin
//14 sectors
FloppyRead(0, 19, true, 14);
Move(Buffer,DirSec,(SizeOf(DirSec)));
ClearScreen;
GoToXY(0,1);
for k := 1 to 224 do
begin
Found := True;
l := 0;
while (Found = True) and (l <= Length(FName)) do
begin
Inc(l);
if DirSec[k].Filename[l] <> FName[l] then
Found := False;
end;
if Found = True then
begin
PrintString(#10'File ' + FName + 'Found in Sector: ' + IntToStr((k div 16)+1) + ' Entry: ' );
Exit;
end;
end;
Any advice will help
Gizmic OS
Currently - Busy with FAT12 driver and VFS
you should put in mind that the files names on the disk are written in capital letters,
for example: MYFILE TXT,
Also the file name is limited to 8 chars and the extension is limited to 3 chars,
and when the file name is shorter than 8 chars the rest chars will be 0x20 (blank),like
in the example above.
hope this help.
The man who follows the crowd will usually get no further than the crowd.
The man who walks alone is likely to find himself in places
no one has ever been before.