This the multi-page printable view of this section.Click here to print.

Return to the regular view of this page.

Additional API

+3DOS Additional API

Table of Contents

1 - DOS_GET_POSITION

Get the file pointer
Function AddressDescription
DOS_GET_POSITION 0133Get the file pointer

Synopsys

Returns the current position in the file

Entry Parameters

Register Content
B File number 0…15

Exit Parameters

If OK
Carry true
A corrupt
E HL = File pointer 0x000000…0xFFFFFF (16Mb)
E is most significant byte, L least
Otherwise:
Carry false
A = Error code
E HL = Corrupt
Always:
BC D IX corrupt, all other registers preserved.

2 - DOS_SET_POSITION

Set the file pointer
Function AddressDescription
DOS_SET_POSITION 0136Set the file pointer

Synopsys

Sets the file pointer. This does not access the disk, nor does it check if the file pointer is >= 8 megabytes.

Entry Parameters

Register Content
B File number 0…15
E HL File pointer 0x000000…0xFFFFFF (16Mb)
E is most significant byte, L least

Exit Parameters

If OK
Carry true
A corrupt
Otherwise:
Carry false
A = Error code
Always:
BC DE HL IX corrupt, all other registers preserved.

3 - DOS_GET_EOF

Get the end of file (EOF) position
Function AddressDescription
DOS_GET_EOF 0139Get the end of file (EOF) position

Synopsys

Get the end of file (EOF) file position greater than all written byte positions. Does not affect the file pointer. Does not consider soft-EOF.

Entry Parameters

Register Content
B File number 0…15

Exit Parameters

If OK
Carry true
A corrupt
E HL = File pointer 0x000000…0xFFFFFF (16Mb)
E is most significant byte, L least
Otherwise:
Carry false
A = Error code
E HL = Corrupt
Always:
BC D IX corrupt, all other registers preserved.

4 - DOS_GET_1346

Get current cache/ramdisk location
Function AddressDescription
DOS_GET_1346 013CSet current cache/ramdisk location

Synopsys

Get the current location of the cache and RAMdisk.

Pages 1, 3, 4, 6 are considered as an array of 128 sector buffers (numbered 0...127), each of 512 bytes. The cache and RAMdisk occupy two separate (contiguous) areas of this array.

Any unused sector buffers may be used by the caller.

Note that the sizes may be smaller than those specified in DOS_SET_1346, as there is an (unpublished) maximum size of cache and a minimum size of RAMdisk (4 sectors).

Entry Parameters

None

Exit Parameters

D = First buffer of cache
E = Number of cache sector buffers
H = First buffer of RAM disk
L = Number of RAM disk sector buffers
Always:
AF BC IX corrupt, all other registers preserved.

5 - DOS_SET_1346

Rebuild the sector cache and RAM disk
Function AddressDescription
DOS_SET_1346 013FRebuild the sector cache and RAM disk

Synopsys

Rebuild the sector cache and RAM disk.

This routine is used to make some store available to the user, or to return store to DOS. Note that if the RAM disk is moved, or its size is changed, then all files thereon are erased.

Pages 1, 3, 4, 6 are considered as an array of 128 sector buffers (numbered 0...127), each of 512 bytes. The cache and RAMdisk occupy two separate (contiguous) areas of this array.

The location and size of the cache and RAMdisk can be specified separately; any remaining buffers are unused by DOS and are available to the caller.

Note that the sizes actually used may be smaller than those specified as in practice, there is a maximum cache size and a minimum size of RAMdisk (4 sectors).

A cache size of 0 will still work but will seriously impair the floppy disk performance.

This routine will fail if there are any files open on drive M:

Entry Parameters

Register Content
D First buffer for cache
E Number of cache sector buffers
H First buffer for RAM disk
L Number of RAM disk sector buffers
Note: E + L <= 128

Exit Parameters

If OK
Carry true
A corrupt
Otherwise:
Carry false
A = Error code
Always:
BC DE HL IX corrupt, all other registers preserved.

6 - DOS_FLUSH

Write any pending data to this drive
Function AddressDescription
DOS_FLUSH 0142Write any pending data to this drive

Synopsys

Write any pending headers, data, directory entries for this drive.

This routine ensures that the disk is up-to-date. It can be called at any time, even when files are open.

Entry Parameters

Register Content
A Drive A…P

Exit Parameters

If OK
Carry true
A corrupt
Otherwise:
Carry false
A = Error code
Always:
BC DE HL IX corrupt, all other registers preserved.

7 - DOS_SET_ACCESS

Change access mode of an open file
Function AddressDescription
DOS_SET_ACCESS 0145Change access mode of an open file

Synopsys

Try to change the access mode of an open file.

This routine will fail if the file is already open, in an incompatible access mode, or if write access is required for a read-only file or disk.

Entry Parameters

Register Content
B File number 0…15
C Access mode required:
Bits 0…2:
1 = exclusive read
2 = exclusive write
3 = exclusive read/write
5 = shared read
Bits 3…7 =0 as reserved

Exit Parameters

If OK
Carry true
A corrupt
Otherwise:
Carry false
A = Error code
Always:
BC DE HL IX corrupt, all other registers preserved.

8 - DOS_SET_ATTRIBUTES

Set a files attributes
Function AddressDescription
DOS_SET_ATTRIBUTES 0148Set a files attributes

Synopsys

Set a file's attributes.

Only the file attributes f1'...f4', t1'...t3' can be set or cleared. The interface attributes f5'...f8' are always 0.

This routine first sets the attributes specified in D, then clears those attributes specified in E, i.e. E has priority.

Entry Parameters

Register Content
D Attributes to set
E Attributes to clear
HL Address of filename, wildcards permitted

Exit Parameters

If OK
Carry true
A corrupt
Otherwise:
Carry false
A = Error code
Always:
BC DE HL IX corrupt, all other registers preserved.
Bit definitions for Attributes
Bit Attribute Bit Attribute
0t3Archive 3f4
1t2System 4f3
2t1Read Only 5f2
6f1

9 - DOS_OPEN_DRIVE

Open drive as a single file
Function AddressDescription
DOS_OPEN_DRIVE 014BOpen drive as a single file

Synopsys

Open the disk in this drive as a single file.

The whole disk is presented as a single file regardless of any real files on the disk. This routine can be used to examine/poke directories, files, etc. It should not be used by the uninitiated, the faint-hearted, or by anyone who values their files!

Sets file pointer to 0x000000 (0).

If there are any files open on this drive from other file numbers with shared-read access, then the disk can only be opened with shared-read access from this file number.

If there are any file open on this drive from other file numbers with exclusive access, then the disk cannot be opened from this file number.

Entry Parameters

Register Content
A Drive A…P
B File number 0…15
C Access mode required: Bits 0…2:
1 = exclusive read
2 = exclusive write
3 = exclusive read/write
5 = shared read
All other bits are reserved

Exit Parameters

If OK
Carry true
A corrupt
Otherwise:
Carry false
A = Error code
Always:
BC DE HL corrupt, all other registers preserved.

10 - DOS_SET_MESSAGE

Enable/disable disk error messages
Function AddressDescription
DOS_SET_MESSAGE 014EEnable/disable disk error messages

Synopsys

Enable/disable disk error messages.

This should be used to make +3DOS aware of your own ALERT subroutine. When +3DOS detects an error, it will call your ALERT subroutine, passing to it the values documented below. The ALERT subroutine should print the text of the message that +3DOS passes it, then should wait for the user to press a key. If the key is in the reply string (that +3DOS also passes - version V1.0 only), then a 'ret' should be made with A = 0, 1 or 2, or containing the character (depending on the version of +3DOS).

Entry Parameters

Register Content
A Enable 0xff or disable 0x00
HL Address of ALERT routine if enabled

Exit Parameters

HL = address of previous ALERT routine, 0 if none
Always:
AF BC DE IX corrupt, all other registers preserved.

ALERT implementations

Note that if you are substituting your own ALERT subroutine, the 'entry conditions' are the conditions passed to your subroutine and the 'exit conditions' are the values that your subroutine must produce and the registers you are allowed to corrupt.

There are two routine interfaces for ALERT, depending on which version of +3DOS is installed.

If you provide an ALERT function, you should have two subroutines, or one with switchable entry and exit conditions, and check the +3DOS version number before deciding which one to use.

+3DOS V1.0

Entry Parameters

Register Content
DE Address of reply string in page 7 terminated by 0xFF
HL Address of error message in page 7 terminated by 0xFF

Exit Parameters

A = Reply character
Always:
F BC DE HL IX corrupt, all other registers preserved.

+3DOS V1.1 and above

The second version allows the user to provide non-UK error messages and is generally more flexible, is present in +3DOS versions V1.1 and upwards.

Entry Parameters

Register Content
B Error number
C Drive A…P
D Logical track if required by message
E Logical sector if required by message
HL Address of UK error message in page 7 terminated by 0xFF

Exit Parameters

A = Reply
0 = cancel
1 = retry
2 = ignore
Always:
F BC DE HL IX corrupt, all other registers preserved.

11 - DOS_REF_XDPB

Point at XDPB for this drive
Function AddressDescription
DOS_REF_XDPB 0151Point at XDPB for this drive

Synopsys

Point at the XDPB for this drive. (The XDPB is required by the floppy disk driver routines.)

Entry Parameters

Register Content
A Drive letter A…P

Exit Parameters

If OK:
Carry true
A corrupt
IX = Address of XDPB
Otherwise:
Carry false
A=Error code
IX corrupt
Always:
BC DE HL corrupt, all other registers preserved.

12 - DOS_MAP_B

Map drive B to unit 0 or 1
Function AddressDescription
DOS_MAP_A 0154Map drive B to unit 0 or 1

Synopsys

Map drive B: to unit 0 or unit 1. This routine will fail if drive B: has files open.

If mapping B: to unit 0, then each time unit 0 is accessed, a check is made that the drive mapping is correct. If it isn't, then a reverse call to CHANGE DISK is made, to ask the user to change the disk in unit 0.

If mapping B: to unit 1, then if unit 1 does not exist, drive B: is disabled.

Entry Parameters

Register Content
C Unit 0 or 1
HL Address of change disk routine if unit = 0

Exit Parameters

If OK:
Carry true
A corrupt
HL = Address of previous change disk routine, 0 if none
Otherwise:
Carry false
A corrupt
HL corrupt
Always:
BC DE IX corrupt, all other registers preserved.

Change Disk routine

If you are substituting your own CHANGE DISK subroutine, the 'entry conditions' are the conditions passed to your subroutine, and the 'exit conditions' are registers you are allowed to corrupt.

Entry Parameters

Register Content
A Logical drive A…P
HL Address of message in page 7 terminated by 0xFF

Exit Parameters

Always:
AF BC DE IX corrupt, all other registers preserved.