83Plus:Software:usb8x/Asm Interface/MSD/DOS createFile
Minimum usb8x version: 0.10
Creates a new file in specified directory of size 0.
- BC points to the starting cluster of the directory to create file in (obtained with [[../FAT_getStartingCluster|FAT_getStartingCluster]])
- HL points to an ASCIIZ string of the filename (ex. "test.txt")
- File is created with size 0
- C set if problems
- AF, BC, DE, HL
- OP registers
The file created date/time attributes are set according to the 84+/SE clock.
Example code to create "readme.txt" in "test" directory:
ld hl,sDirectory U_CALL FAT_getStartingCluster push hl pop bc ;BC contains starting cluster ld hl,sFilename U_CALL DOS_createFile ... sFilename: DB "readme.txt",0 sDirectory: DB "/test",0
To read/write to this file, you must then open the file with [[../DOS_openFile|DOS_openFile]].
It looks like most FAT file routines will clobber the OP registers due to calling FAT_getEntryInfo. Yes, all six of them.
- [[../FAT_getStartingCluster|FAT_getStartingCluster]] - Get starting cluster of specified directory
- [[../DOS_openFile|DOS_openFile]] - Open file for reading and writing