FAT 32

Description of your first forum.
Post Reply
User avatar
drone84
Posts: 10
Joined: Sat Apr 13, 2019 2:05 pm
Location: On Earth

FAT 32

Post by drone84 » Sat Sep 07, 2019 9:45 pm

I started to write code to implement the FAT32 file system (I copy past the FAT 12 code and renamed the function ...). The FAT12 could find a file and get the first data chunk.

The plan will be to use the fat with the IDE (Hard Drive / Compact Flash) and SD card. I'm planing to implement : Open, Close, Read, Write. I will limit the FAT to work only on one file at the time for now as it will make my life easyer.
The under-laying functionality needed to work on file are :

- Read the MBR (Master Boot Record, it's also a musician artist) to get the position of the Boot sector we are interested on
- Read the Boot Sector to locate the FAT and the Root directory.
- Read the Root Directory to get the file and folder name, the cluster associated with it and other meta data
- Read the FAT to find where to read the next data cluster
Give me anything with electronic and I will make it crash/bug
User avatar
drone84
Posts: 10
Joined: Sat Apr 13, 2019 2:05 pm
Location: On Earth

Re: FAT 32

Post by drone84 » Sun Sep 08, 2019 11:22 pm

So far I can read the MBR, the Boot Sector, and the Root Directory with the first data cluster associated with the file/folder

Now I need to test the FAT function to get the next cluster from the current cluster. The 5E in the picture mean : deleted file.

Image
Give me anything with electronic and I will make it crash/bug
User avatar
PJW
Posts: 25
Joined: Wed Apr 24, 2019 12:44 am

Re: FAT 32

Post by PJW » Mon Sep 09, 2019 2:07 am

It's great to see this!
User avatar
stef
Posts: 75
Joined: Thu Jan 01, 1970 12:00 am
Location: Somewhere in the Universe
Contact:

Re: FAT 32

Post by stef » Mon Sep 09, 2019 6:32 am

drone84 wrote:
Sun Sep 08, 2019 11:22 pm
So far I can read the MBR, the Boot Sector, and the Root Directory with the first data cluster associated with the file/folder

Now I need to test the FAT function to get the next cluster from the current cluster. The 5E in the picture mean : deleted file.

Image
Dude, this is awesome, keep working at this and I could actually remove the CH376S by the time I ship the Rev C

Keep us updated, this is great work!

Cheers

Stefany
Mistress of All Villainy
bzuidgeest
Posts: 41
Joined: Wed May 01, 2019 6:51 pm

Re: FAT 32

Post by bzuidgeest » Tue Sep 10, 2019 2:34 pm

It is great work, but I'm not sure you should remove the ch376 (and I am not saying that because I was working to implement it in de IDE :), things change).
The ch376 is a somewhat low threshold chip, "easy" to get going and if people want to do stuff or experiments without the standard kernel, it allows them easy access to a simple storage medium including fat support without any added libraries or memory use and such. Might not be the greatest chip but it works...

@Drone84
Extra question. I see this working on the IDE in the screenshots. Does this mean you also added IDE support to the IDE? I might be mistaken, but I did not think this was already added?
User avatar
drone84
Posts: 10
Joined: Sat Apr 13, 2019 2:05 pm
Location: On Earth

Re: FAT 32

Post by drone84 » Wed Sep 11, 2019 12:15 am

Small update before going to bet. I can now read the directory entry to search for a file or folder name. I also coded/debugged the function to look in the fat to get he next data cluster if you give him the current cluster.


Image
Give me anything with electronic and I will make it crash/bug
User avatar
drone84
Posts: 10
Joined: Sat Apr 13, 2019 2:05 pm
Location: On Earth

Re: FAT 32

Post by drone84 » Wed Sep 11, 2019 12:20 am

bzuidgeest wrote:
Tue Sep 10, 2019 2:34 pm
It is great work, but I'm not sure you should remove the ch376 (and I am not saying that because I was working to implement it in de IDE :), things change).
The ch376 is a somewhat low threshold chip, "easy" to get going and if people want to do stuff or experiments without the standard kernel, it allows them easy access to a simple storage medium including fat support without any added libraries or memory use and such. Might not be the greatest chip but it works...

@Drone84
Extra question. I see this working on the IDE in the screenshots. Does this mean you also added IDE support to the IDE? I might be mistaken, but I did not think this was already added?

I haven't coded any IDE, I just took an 100MB image disc and I edited the FAT and the Boot sector to store data in only a few kB. I includes in the code as raw data the new "Disc".

We have IDE emulation in the emulator ??? :shock:
Give me anything with electronic and I will make it crash/bug
bzuidgeest
Posts: 41
Joined: Wed May 01, 2019 6:51 pm

Re: FAT 32

Post by bzuidgeest » Wed Sep 11, 2019 7:32 pm

Sorry! I created some confusion in my question. I was talking about the FoenixIDE and IDE as the hard disk interface at the same time. That's not helpful :D

In your screenshot I see you are testing your fat code in foenixIDE (as in development environment), since the foenixIDE had no IDE (harddisk interface) emulation, I wondered if you had implemented that IDE interlace emulation. But from your answer I understand you are testing from a disk image file. So that answers it.
User avatar
drone84
Posts: 10
Joined: Sat Apr 13, 2019 2:05 pm
Location: On Earth

Re: FAT 32

Post by drone84 » Sun Sep 22, 2019 7:15 pm

Small update for the fat : it's working(ish). I can search for a file in the root directory (first folder of the absorbance like C:\ or G:\) and if the name match (short name : 8.3 exactly) well it load the first cluster of 512 Byte on the screen.

Image

From the user point of vue it's fairly easy to use :

Code: Select all

file_to_load_f32    .text "TEXT_T~1TXT"

...

JSL FAT32_init                 ; need to be called only once
JSL FAT32_Open_File       ; need to be called when you want to ... open a file ...  :geek: 
CMP #1
BNE FAT32_test__Faill_To_Find_file
JSL FAT32_Read_File
JSL FAT32_Print_Cluster
Give me anything with electronic and I will make it crash/bug
User avatar
stef
Posts: 75
Joined: Thu Jan 01, 1970 12:00 am
Location: Somewhere in the Universe
Contact:

Re: FAT 32

Post by stef » Sun Sep 22, 2019 7:38 pm

drone84 wrote:
Sun Sep 22, 2019 7:15 pm
Small update for the fat : it's working(ish). I can search for a file in the root directory (first folder of the absorbance like C:\ or G:\) and if the name match (short name : 8.3 exactly) well it load the first cluster of 512 Byte on the screen.

Image

From the user point of vue it's fairly easy to use :

Code: Select all

file_to_load_f32    .text "TEXT_T~1TXT"

...

JSL FAT32_init                 ; need to be called only once
JSL FAT32_Open_File       ; need to be called when you want to ... open a file ...  :geek: 
CMP #1
BNE FAT32_test__Faill_To_Find_file
JSL FAT32_Read_File
JSL FAT32_Print_Cluster
Drone84, this is freakin Awesome! Now, you are talking! We will be able to throw out the CH376S chip!

Thanks!
S
Mistress of All Villainy
Post Reply