83Plus:Software:usb8x/Asm Interface/MSD/DOS getDirEntry

From WikiTI
Revision as of 13:52, 25 September 2006 by Brandonw (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Synopsis

Name: DOS_getDirEntry

Minimum usb8x version: 0.10

Gets directory entry for a specified file/folder. A directory entry is useful for certain functions such as [[../DOS_getFileSize|DOS_getFileSize]].

Inputs

  • HL is the starting cluster of a directory (obtained with [[../FAT_getStartingCluster|FAT_getStartingCluster]])
  • BC is the entry number of a file

Outputs

  • HL points to the directory entry of the file/directory
  • C set if problems

Destroys

  • AF, BC, DE, HL

Notes

The "directory entry" for a file is a 32-byte block of memory containing all the good stuff about a file/directory, such as file size, where it's located, the dates/times for various actions and other attributes. It is sometimes used as an input and output for mass storage entry points.

This works with both file and folder names. Example code to get directory entry for first file in the root directory:

ld hl,sDirectory
U_CALL FAT_getStartingCluster
ld bc,-1
U_CALL DOS_getDirEntry
...
sDirectory: DB "/",0

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_getNextFile|DOS_getNextFile]] - Get first/next file in a specified directory