This the multi-page printable view of this section.Click here to print.
Function | Address | Description |
---|---|---|
DOS_INITIALISE | 0100 | Initialise +3DOS |
None
Function | Address | Description |
---|---|---|
DOS_VERSION | 0103 | Return DOS issue and version numbers |
Get the DOS issue and version numbers.
None
Function | Address | Description |
---|---|---|
DOS_OPEN | 0106 | Open and/or Create a file |
Create and/or open a file
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 |
Open | Action | |||||||
---|---|---|---|---|---|---|---|---|
0 | Error - 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'.
| |||||||
4 |
Erase existing version. Follow create action. |
Create | Action | |||||||
---|---|---|---|---|---|---|---|---|
0 | Error - 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). |
This was only discovered during testing by looking at the ROM 2 disassembly.
Function | Address | Description |
---|---|---|
DOS_CLOSE | 0109 | Close a file |
Close a file
Register | Content |
---|---|
B | File number 0…15 |
Function | Address | Description |
---|---|---|
DOS_ABANDON | 010C | Abandon a file |
Abandon a file
Similar to DOS CLOSE, except that any header, or data, or directory data yet to be written to disk is discarded. This routine should only be used to force a file closed in the event that DOS CLOSE is unable to close the file (for example, if the media is damaged or permanently changed or removed).
Register | Content |
---|---|
B | File number 0…15 |
Function | Address | Description |
---|---|---|
DOS_REF_HEAD | 010F | Point to header data for this file |
Point at the header data for this file.
The header data area is 8 bytes long and may be used by the caller for any purpose whatsoever. It is available even if the file does not have a header; however, only files with a header and opened with write access will have the header data recorded on disk.
Note that +3 BASIC uses these 8 bytes (see the note under DOS OPEN which gives the details). If creating a file that will subsequently be LOADed within BASIC, then those bytes should be filled with the relevant values.
Register | Content |
---|---|
B | File number 0…15 |
The address in IX is the +3 BASIC Header structure which is 8 bytes long. (IX+0) is the file type, (IX+1) the file length and (IX+3) param 1.
Function | Address | Description |
---|---|---|
DOS_READ | 0112 | Read 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.
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 |
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.
Function | Address | Description |
---|---|---|
DOS_WRITE | 0115 | Write bytes from memory into a file |
Write bytes from memory into a file, advancing the file pointer in the process.
Register | Content |
---|---|
B | File number 0…15 |
C | Page number for addresses 0xC000…0xFFFF |
DE | Number of bytes to write. 0 means 64K |
HL | Address of where to read the bytes from |
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.
Function | Address | Description |
---|---|---|
DOS_READ_BYTE | 0118 | Read byte from a file, check for soft-EOF |
Read a byte from a file, advancing the file pointer in the process. It tests for a soft EOF (0x1A) but it is possible to read past this. Reading to the hard EOF will return an error.
Register | Content |
---|---|
B | File number 0…15 |
Function | Address | Description |
---|---|---|
DOS_WRITE_BYTE | 011B | Write byte to a file |
Write a byte to a file, advancing the file pointer in the process.
Register | Content |
---|---|
B | File number 0…15 |
C | Byte to write |
Function | Address | Description |
---|---|---|
DOS_CATALOG | 011E | Get the disk catalog |
Fills a buffer with part of the directory (sorted).
The filename specifies the drive, user and a (possibly ambiguous) filename.
Since the size of a directory is variable (and may be quite large), this routine permits the directory to be catalogued in a number of small sections. The caller passes a buffer pre-loaded with the first required filename, or zeroes for the start of the directory. The buffer is loaded with part (or all, if it fits) of the directory sorted in ASCII order. If more of the directory is required, this routine is re-called with the buffer re-initialised with the last file previously returned. This procedure is followed repeatedly until all of the directory has been catalogued.
Note that +3DOS format disks (which are the same as single-sided, single track AMSTRAD PCW range format disks) may have a maximum of 64 directory entries.
Register | Content |
---|---|
B | n+1 size of buffer in entries, must be >= 2 |
C |
Filter: Bit 0 = include system files if set Bits 1…7 reserved |
DE | Address of buffer, first entry initialised |
HL | Address of filename, wildcards permitted |
The buffer passed to this routine consists of 2 or more entries, with the first one initialised with the first filename required. It is valid for the first entry to be all zero's.
If the buffer is too small for the directory then it can be called again with entry 0 being a copy of entry n from the previous call.
Bytes | Length | Content | |
---|---|---|---|
0 | 7 | 8 | Filename in ASCII, left justified, space padding |
8 | 10 | 3 | Type in ASCII, left justified, space padding |
11 | 12 | 2 | File size in KB |
The file size is the disk space allocated, not the actual file size.
Function | Address | Description |
---|---|---|
DOS_FREE_SPACE | 0121 | Get free space on drive |
Return the amount of free space on a drive.
Register | Content |
---|---|
A | Drive letter A…P |
Function | Address | Description |
---|---|---|
DOS_DELETE | 0124 | Delete a file |
Delete an existing file.
The file must not be open on any file number.
Register | Content |
---|---|
HL | Address of filename, wildcards are permitted. |
Function | Address | Description |
---|---|---|
DOS_RENAME | 0127 | Get free space on drive |
Return the amount of free space on a drive.
Register | Content |
---|---|
A | Drive letter A…P |
Function | Address | Description |
---|---|---|
DOS_BOOT | 012A | Boot from disk |
Boot from Disk
This routine loads a single bootstrap sector from the disk in drive A: into memory and enters it. This is for loading games or other operating systems.
None
When the bootstrap runs with the following memory configuration:
The bootstrap sector is on side 0, track 0, sector 1 of the disk. It is loaded into memory at 0xFE00 and entered at 0xFE10. Interrupts are disabled, and SP = 0xFE00.
The sum of all bytes in the sector must equal 3 MOD 256. Byte 15 in the sector can be used to adjust the sum to achive this. Bytes 0…15 of the sector hold the disk specification.
Memory Range | RAM Bank | |
---|---|---|
0x0000 | 0x3FFF | Bank 4 |
0x4000 | 0x7FFF | Bank 7 |
0x8000 | 0xBFFF | Bank 6 |
0xC000 | 0xFFFF | Bank 3 |
Function | Address | Description |
---|---|---|
DOS_SET_DRIVE | 012D | Set the default drive |
Set the default drive (i.e. the drive implied by all filenames that do not specify a drive).
The default drive is initially A:
Does not access the drive, but merely checks that there is a driver for it (which does not imply that the drive exists).
This only affects routines that take filename parameters.
Register | Content |
---|---|
A | Drive letter A…P, 0xFF to get the default drive |
Function | Address | Description |
---|---|---|
DOS_SET_USER | 0130 | Set the default user |
Set the default user area, i.e. the user area implied by all filenames that do not specify a user number.
The default user number is initially 0.
This only affects routines that take filename parameters.
Register | Content |
---|---|
A | User 0…15, 0xFF to get the default user |