Shop OBEX P1 Docs P2 Docs Learn Events
FSRW 2.6 root directory — Parallax Forums

FSRW 2.6 root directory

What is the maximum amount of files that can be stored and/or addressed in the root directory using FSRW 2.6?

Comments

  • I believe the limit is 512 files. 8.3 names only, FAT16 or FAT32. Individual file size up to 4GB.
  • JonnyMacJonnyMac Posts: 9,105
    edited 2015-11-15 16:57
    While it's true that FSRW only understands 8.3 names, you can in fact use long names on your SD card -- I'm doing this now. The key is to ensure that the first six characters of the file names are unique.

    I'm working on a project that uses several sounds; for example:

    100_mainmenu.wav

    Internally, I have a dat table like this:
    dat
    
      AudioFiles    byte    "100_ma~1.wav", 0                        ' 100_mainmenu.wav
    
    By prefixing the sound file name with a number I can keep the first six characters unique, and allow the program to switch to a different group of files by changing the first character of the names in my table; this is very useful in multi-lingual apps. In the example above, group 1 is English, and file 00 is the main menu audio. As you can see, the table entry uses the first six characters of the file name, with "~1" after. If you read the directory with FSRW you will see the files listed in this manner (8.3 format). Note that I only use 3-character extensions on my files.

    In my case it's easy to get to the nth file name in the list because all entries use 13 bytes (8 + 1 + 3 + 1 [terminating zerol]); when my strings are variable length I use this method to find the address of the nth item in a list (as above).
    pub str_pntr(idx, p_list)
    
    '' Returns to pointer to idx'th string in list (at p_list)
    '' -- string may be variable length
    
      repeat idx
        p_list += strsize(p_list) + 1                                ' skip current string
    
      return p_list
    
  • Jon,

    That's pretty slick!
  • That's very clever Jon.

    Correct me if I'm wrong, but doing that does limit the number of file entries available. Each 11 characters added to a long file name uses up one of the available file entry slots. While FSRW does support FAT32 in terms of the size of files and media, I don't think it allows any entries past the 512 that fit in the fixed size root directory.
  • JonnyMacJonnyMac Posts: 9,105
    edited 2015-11-16 15:27
    To be honest with you, FSRW is an object I use all the time without understanding the internals (I will ultimately learn and attempt my own driver -- FSRW code is very messy and that make me nuts). The project I'm working on has three groups of about 20 files, so I am not pushing any limits. My goal was to make file naming easier for the customer while working with 8.3 names inside FSRW.
Sign In or Register to comment.