Difference between revisions of "83Plus:Software:usb8x/Asm Interface/MSD/DOS fileWrite"
From WikiTI
m |
|||
Line 19: | Line 19: | ||
== Notes == | == Notes == | ||
+ | The file's modified date/time attributes are set according to the 84+/SE clock. Avoid overuse of this function, such as calling it hundreds of times to write one byte at a time. It is much better to write all hundred bytes at once. | ||
Example code to write "This is a test" to "readme.txt" in the root directory: | Example code to write "This is a test" to "readme.txt" in the root directory: | ||
<code> | <code> |
Revision as of 01:15, 17 August 2006
Synopsis
Name: DOS_fileWrite
Minimum usb8x version: 0.10
Writes bytes to a file and grows it if necessary.
Inputs
- HL points to file handle of an opened file
- DE points to a buffer of bytes to write
- BC is the number of bytes to write
Outputs
- BC is the number of bytes actually written
- C set if problems
Destroys
- AF, BC, DE, HL
Notes
The file's modified date/time attributes are set according to the 84+/SE clock. Avoid overuse of this function, such as calling it hundreds of times to write one byte at a time. It is much better to write all hundred bytes at once.
Example code to write "This is a test" to "readme.txt" in the root directory:
ld hl,sFilename ld de,file_handle U_CALL DOS_openFile ;HL points to file handle ld de,sWrite ld bc,14 U_CALL DOS_fileWrite ... sFilename: DB "/readme.txt",0 sWrite: DB "This is a test"
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
- [[../DOS_fileRead|DOS_fileRead]] - Read bytes from a file at current seek pointer
- [[../DOS_fileSeek|DOS_fileSeek]] - Set seek pointer in file handle