83Plus:Software:usb8x/Asm Interface/MSD/FAT findFileInCluster

From WikiTI
Jump to: navigation, search

Synopsis

Name: FAT_findFileInCluster

Minimum usb8x version: 0.10

Gets directory entry for a file/folder in specified directory.

Inputs

  • HL is the starting cluster of the directory to search in (obtained with [[../FAT_getStartingCluster|FAT_getStartingCluster]])
  • DE points to the name of a file/directory, 11-character format (obtained with [[../FAT_nameConvertTo11|FAT_nameConvertTo11]] if necessary)

Outputs

  • HL points to the directory entry for the found file/folder
  • C set if not found

Destroys

  • AF, BC, DE, HL

Notes

This works with both file and folder names and is a lower-level way of searching for a file/folder in a directory. It is less likely to be used than [[../FAT_lookupPath|FAT_lookupPath]] or [[../DOS_getDirEntry|DOS_getDirEntry]]. Example code to find "test.txt" in the root directory:

ld hl,0000h ;0000h is always starting cluster for root directory
ld de,sFilename
U_CALL FAT_findFileInCluster
...
sFilename: DB "TEST    TXT"

If you are writing an application, you must copy the strings you use to RAM first, or else usb8x will not be able to see them.

See Also

  • [[../FAT_lookupPath|FAT_lookupPath]] - Find whether specified file/directory exists
  • [[../DOS_getDirEntry|DOS_getDirEntry]] - Get directory entry for file/folder in specified directory