Difference between revisions of "83Plus:Software:usb8x/Asm Interface/MSD/DOS getDirEntry"

From WikiTI
Jump to: navigation, search
 
m (Typo and clarification)
 
(2 intermediate revisions by the same user not shown)
Line 4: Line 4:
 
'''Minimum usb8x version:''' 0.10
 
'''Minimum usb8x version:''' 0.10
  
Gets directory entry for a specified file/folder.
+
Gets directory entry for a specified file/folder. A directory entry is useful for certain functions such as [[../DOS_getFileSize|DOS_getFileSize]].
  
 
=== Inputs ===
 
=== Inputs ===
* HL is the stating cluster of a directory (obtained with [[../FAT_getStartingCluster|FAT_getStartingCluster]])
+
* HL is the starting cluster of a directory (obtained with [[../FAT_getStartingCluster|FAT_getStartingCluster]])
 
* BC is the entry number of a file
 
* BC is the entry number of a file
  
Line 18: Line 18:
  
 
== Notes ==
 
== Notes ==
This works with both file and folder names. It also works especially well with DOS_getNextFile. This function is useful if you need to get the directory entry for a file just found with [[../DOS_getNextFile|DOS_getNextFile]].
+
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.
Example code to get directory entry for first file in the root directory:
+
 
 +
This works with both file and folder names. Example code to get directory entry for first file in the root directory:
 
<code>
 
<code>
 
  ld hl,sDirectory
 
  ld hl,sDirectory

Latest revision as of 13:52, 25 September 2006

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