Estex: Disk SubSystem (DSS) Programming Guide

Table of Contents
1. Introducing
2. Identification of system functions
3. Disk devices functions


1. Introducing

   This document contains the list of functions and concepts of 
interaction with a disk subsystem.
   DSS is a collection of very useful functions that reside in 
DSS itself, ready for use by any your programs. These functions 
are stored in library SYSTEM.DOS and allow management of files, 
memory allocation, loading and execution of the programs.

File specification

   The file specification is a string, containing a names of disk, 
directories separated by a symbol "\" and name of file. The names 
of disk drive and directories can be discard.

for example:
C:\TEXT\DOC\text.doc
A:file.txt
\TEXT\info.txt

   The DSS used chars with colon suffix as names of disk devices 
(A:, B:, C: etc.) The name of disk can be written down before 
filename for specified disk there it placed. 
For example: command 
DIR C:DATFILE 
searches for DATFILE in the current directory of disk C:.
   When disk name not specified DSS used current disk. At start 
DSS, the current disk is a disk whence was loaded DSS.
   The filenames consist of two parts. The first part contain 8 
chars of file name. The second part is not necessary and contain 
3 chars of file type (also known as extentsion). At the writing 
of filename, both parts are separated by char point.
For example: the names "NAME" and "NAME." is specified same file. 
In the name don't allows symbols with codes less 32 and chars 
. " / \ [ ] : | < > + = ; ,
   As the subdirectories files too, their names are formed by 
same way. The name of root directory always "\". And each 
subdirectories contain two items with names "." and "..". The 
name "." specified a current directory and name ".." specified 
name of parent(uplevel) directory.
   Some console commands and DSS functions allow to use global 
symbols ? and * which can be used for filename templates.
   The symbol ? means that any one char of filename. The 
symbol * means that it char can be replaced by any symbols.
For example:
*.txt - means, all files with type "txt"
a??.* - means, files which contain three or less symbols and 
    first symbol is "a"
dc*.exe - means, files with type "exe" and began "dc"

File attributes

   The each bit of byte attributes specified various attribute. 
And it can be changed by DSS function.

bit 0 - Read only
bit 1 - Hidden
bit 2 - System
bit 3 - Volume label
bit 4 - Directory
bit 5 - Archive
bit 6 - Reserved
bit 7 - Reserved

   Attribute "read only". When value is 1, file can be read, 
but can't be written or deleted.
   Attribute "hidden". When value is 1, DSS can't manipulate 
with this file.
   Attribute "system". Specified system file.
   Attribute "volume label". In old version of MSDOS used for 
specified volume laben, now it can be used for long filenames. 
And must be 0 for compatibles.
   Attribute "directory". When value is 1, means that this 
file is directory.
   Attribute "archive". This bite sets in 1 when DSS writing 
in this file. It can be used in backup utilities for detect 
changed files.

File handle
   When any file are opened, DSS build File Control Block in 
DSS working areas.
   The Handle (and assigned file) identified by number which 
returned DSS to program after file opening and used it in all 
further DSS calls. In other words, when file is opening, the 
program informs DSS his name and has taken back file handle. 
Which used in further file operations.
   All necessary information for working with file are placed 
in DSS working areas.


2. Identification of system functions

00h (00) VERSION (Version of DSS)
input:
C - 00h
output:
D - version number
E - modification
The function return version number of DSS.


3. Disk devices functions

01h (01) CHDISK (Change current disk)
input:
A - disk number (0-A,1-B...)
C - 01h
output:
A - error code, if CF=1
A - number of disks, if CF=0
The function changes current disk device.

02h (02) CURDISK (Current disk number)
input:
C - 02h
output:
A - current disk number (0-A,1-B...)
The function returns number of current disk device.

03h (03) DSKINFO (Disk information)
input:
A - disk number (0-A,1-B...0FFh-current)
C - 03h
output:
A - error code, if CF=1
A - sectors per cluster, if CF=0
HL - clusters per disk
DE - free clusters
BC - bytes per sector
The function returns information about disk device 
(capacity and free space).
for example: 
	LD	C,03h		;Function DSKINFO
	LD	A,0FFh		;Information about current disk
	RST	10h		;Execution of function
	LD	A,D		;There is a free
	OR	E		;space?
	JR	Z,NO_SPACE	;No, the disk is completely filled

09h (09) BOOTDSK (Number of boot disk)
input:
C - 09h
B = 0
output:
A - number of boot disk (0-A,1-B...)
The function returns number of boot disk device whence was loaded DSS.

