Read bytes from a file into memory
Function AddressDescription
DOS_READ 0112Read bytes from a file into memory


Read bytes from a file into memory, advancing the file pointer in the process.

This routine does not consider any soft-EOF in the file. Attempting to read past the EOF will produce an error.

Entry Parameters

Register Content
B File number 0…15
C Page number for addresses 0xC000…0xFFFF
DE Number of bytes to read. 0 means 64K
HL Address of where to write the bytes to

Exit Parameters

If OK:
Carry true
A corrupt
DE corrupt
Carry false
A = Error code
DE = Number of bytes remaining unread
BC HL IX corrupt, all other registers preserved.

The value of C is only used when HL is within the upper 16K of memory (0xC000…0xFFFF). If HL is in this range then C is the RAM bank to use. For most purposes C should be set to 0 which is the default RAM bank mapped to that region.

Last modified November 24, 2021: Start of +3DOS documentation (253d8cc)