DOS_OPEN

Open and/or Create a file
Function AddressDescription
DOS_OPEN 0106Open and/or Create a file

Synopsys

Create and/or open a file

Entry Parameters

Register Content
B File number 0…15
C Access mode required
D Create action
E Open action
HL Address of filename, no wildcards. Terminated with 0xFF

Exit Parameters

If file newly created:
Carry true
Zero true
A corrupt
If existing file opened:
Carry true
Zero false
A corrupt
Otherwise:
Carry false
A=Error code
Always:
BC DE HL IX corrupt, all other registers preserved.
Open Action
0Error - File already exists.
1 Open the file, read the header (if any).
Position file pointer after header.
2 Open the file, ignore any header.
Position file pointer at 000000h (0).
3 Assume given filename is 'filename.type'.
  1. Erase 'filename.BAK' (if it exists).
  2. Rename 'filename.type' to 'filename.BAK'.
  3. Follow create action.
4 Erase existing version.
Follow create action.
Create Action
0Error - File does not exists.
1 Create and open new file with a header.
Position file pointer after header.
2 Create and open new file without a header.
Position file pointer at 000000h (0).
Note: The original +3 Manual doesn't mention that the filename needs to be terminated with a 0xFF byte.

This was only discovered during testing by looking at the ROM 2 disassembly.

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