83Plus:Software:usb8x/Asm Interface/MSD/DOS fileRead
From WikiTI
Synopsis
Name: DOS_fileRead
Minimum usb8x version: 0.10
Reads bytes from an open file at current seek offset.
Inputs
- HL points to file handle of an opened file
- DE points to a buffer to store the bytes read
- BC is the number of bytes to read
Outputs
- BC is the number of bytes actually read
- C set if problems or encountered end-of-file first
Destroys
- AF, BC, DE, HL
Notes
Bit 1 of the 22nd byte (offset 21) of the file handle will be set if the end of the file was reached.
Example code to read 10 bytes to statVars:
ld hl,file_handle ld de,statVars ld bc,10 U_CALL DOS_fileRead ld a,(file_handle+21) and 00000010b jr nz,eofReached ... eofReached: ...
See Also
- [[../DOS_fileWrite|DOS_fileWrite]] - Writes bytes to a file and grows it if necessary