gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > GBAMP_CF example?

#52941 - Dannon - Sun Sep 04, 2005 9:39 pm

Can anyone start me off using the GBAMP reader code that chism wrote, I have everything initiaised I just can't seem to get it to read anything, what function do I call after I have run FAT_InitFIles(), can I run FAT_GetFilename or FAT_GetDirEntry? Do I need to setup an instance of the DIR_ENT struct if I am using FAT_GetDirEntry? Some simple example code would be great to look at, thanks

#52942 - Mighty Max - Sun Sep 04, 2005 9:43 pm

Here is a part of the code im using. It only needs the FAT_InitFiles() called first.

Code:

long NumberOfFilesInDir(char *dir) {
   FAT_CWD(dir) ;
   char filename[13] ;
   filename[12]=0 ;
   if (FAT_FindFirstFile(&filename[0])==0) {
      return 0 ;
   } ;
   long files = 1 ;
   while (FAT_FindNextFile(&filename[0])!=0) {
      files++ ;
   } ;
   return files ;
} ;


PS: Don't forget to set the WAIT_CR like chishm describes.
_________________
GBAMP Multiboot

#52943 - Dannon - Sun Sep 04, 2005 10:01 pm

I can now do the obvious thing and see how many files there are in a specified place, thanks this has helped a lot