NewsProductsSprinterSupportDownloadSprinter ForumAbout usLinksSite map Russian site
Sprinter
 Documentation | Software | F.A.Q. | Spectrum mode |

Estex Disk SubSystem function list v1.6

System calls

   Unless a program is just implementing some math algorithms in assembly, it will deal with such things as getting input, producing output, and exiting. For this, it will need to call on DSS services. In fact, programming in assembly language is quite the same in different OSes, unless OS services are touched.
   The DSS API function in Estex must be called from assembly language. And some parameters specify in various registers, register C used for specify system call number.

So, our Estex program will look like:

        ORG     #8100   ;entry point address

        LD      HL,MSG  ;message to write
        LD      C,5Ch   ;system call number (PCHARS)
        RST     10h     ;call kernel

        LD      C,41h   ;system call number (EXIT)
        RST     10h     ;call kernel

MSG     db      "Hello, world!",0Dh,0Ah     ;our string
        db      0                           ;end of string

The following is a list of the categories of Estex DSS functions

Version Information Functions
00h (00) VERSION (Version of DSS)
Input:
C - 00h
Output:
D - version number
E - modification
Disk Drive Functions
01h (01) CHDISK (Set the 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
02h (02) CURDISK (Get the current disk)
Input:
C - 02h
Output:
A - error code, if CF=1
A - current disk number (0-A,1-B...), if CF=0
03h (03) DSKINFO (Information about disk)
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
09h (09) BOOTDSK (Get number of boot disk)
Input:
C - 09h
B = 0
Output:
A - error code, if CF=1
A - number of boot disk (0-A,1-B...), if CF=0
File I/O Functions
0Ah (10) CREATE (Create file)
Input:
HL - path
A - file attribute
C - 0Ah
Output:
A - error code, if CF=1
A - file handle, if CF=0
0Bh (11) CREATE NEW FILE (Create new file)
Input:
HL - path
A - file attribute
C - 0Bh
Output:
A - error code, if CF=1
A - file handle, if CF=0
0Eh (14) DELETE (Delete file)
Input:
HL - path
C - 0Eh
Output:
A - error code, if CF=1
10h (16) RENAME (Rename file)
Input:
HL - old filename
DE - new filename
C - 10h
Output:
A - error code, if CF=1
11h (17) OPEN (Open file)
Input:
HL - path
A - access mode
A=0 read/write
A=1 read
A=2 write
C - 11h
Output:
A - error code, if CF=1
A - file handle, if CF=0
12h (18) CLOSE (Close file)
Input:
A - file handle
C - 12h
Output:
A - error code, if CF=1
13h (19) READ (Read data from a file)
Input:
A - file handle
HL - storage location for data
DE - bytes count
C - 13h
Output:
A - error code, if CF=1
DE - returns the number of bytes actually read
if CF=0:
A = 0 - all bytes was reading
A = 0FFh - less than count bytes was reading
14h (20) WRITE (Write data to a file)
Input:
A - file handle
HL - data to be written
DE - number of bytes
C - 14h
Output:
A - error code, if CF=1
DE - the number of bytes actually written
15h (21) MOVE_FP (Move the file pointer associated with handle to a new location that is offset bytes)
Input:
A - file handle
HL:IX - Number of bytes from origin
B - Initial position
B=0 - Beginning of file
B=1 - Current position of file pointer
B=2 - End of file
C - 15h
Output:
A - error code, if CF=1
HL:IX - new position of file pointer
16h (22) ATTRIB (Return / set a file's attributes)
Input:
HL - path
B - subfunction
B = 0 return attributes
B = 1 set attributes
A - attributes value
C - 16h
Output:
A - error code, if CF=1
A - file's attributes, if CF=0
17h (23) GET_D_T (Return the date and time that a file was created, last accessed, and last modified)
Input:
A - file handle
C - 17h
Output:
A - error code, if CF=1
D - day [1..31]
E - month [1..12]
IX - year [0000..1999.2000..9999]
H - hour [0..23]
L - minute [0..59]
B - second [0..59]
18h (24) PUT_D_T (Set the date and time that a file was created, last accessed, or last modified)
Input:
A - file handle
D - day [1..31]
E - month [1..12]
IX - year [0000..1999.2000..9999]
H - hour [0..23]
L - minute [0..59]
B - second [0..59]
C - 18h
Output:
A - error code, if CF=1
19h (25) F_FIRST (Function searches a directory for a file whose name matches the specified file name. F_First examines subdirectory names as well as file names)
Input:
HL - Pointer to a null-terminated string that specifies a valid directory or path and file name, which can contain wildcard characters (* and ?)
DE - Pointer to the structure(size 44 bytes, if specified B=0, else 256 bytes) that receives information about the found file or subdirectory.
A - attributes template used for searching
B = 0 - name of found file puts as 11-bytes format "FilenameExt"
B = 1 - name of found file puts as Human format "filename.ext",0
C - 19h
Output:
A - error code, if CF=1
1Ah (26) F_NEXT (Function continues a file search from a previous call to the F_FIRST function)
Input:
DE - Pointer to the working structure
C - 1Ah
Output:
A - error code, if CF=1
1Bh (27) MKDIR (Make directory)
Input:
HL - path
C - 1Bh
Output:
A - error code, if CF=1
1Ch (28) RMDIR (Remove directory)
Input:
HL - path
C - 1Ch
Output:
A - error code, if CF=1
1Dh (29) CHDIR (Change the current directory)
Input:
HL - path
C - 1Dh
Output:
A - error code, if CF=1
1Eh (30) CURDIR (Get the current directory)
Input:
HL - buffer 256 bytes
C - 1Eh
Output:
A - error code, if CF=1
Date and Time Functions
21h (33) SYSTIME (Return the current system time and date)
Input:
C - 21h
Output:
D - day [1..31]
E - month [1..12]
IX - year [0000..1999.2000..9999]
H - hour [0..23]
L - minute [0..59]
B - second [0..59]
C - day of week [1..7]
22h (34) SETTIME (Set the current system time and date)
Input:
D - day [1..31]
E - month [1..12]
IX - year [0000..1999.2000..9999]
H - hour [0..23]
L - minute [0..59]
B - second [0..59]
C - 22h
Output:
A - error code, if CF=1
Memory Management Functions
38h (56) SETWIN (Set memory page)
Input:
A - memory block handle
B - number of page in block (0,1,2...)
H - bits 7 and 6 specify frame where page will be placed
C - 38h
Output:
A - error code, if CF=1
A - phisical number of page which was replaced, if CF=0
39h (57) SETWIN1 (Set memory page into first frame)
Input:
A - memory block handle
B - number of page in block (0,1,2...)
C - 39h
Output:
A - error code, if CF=1
A - phisical number of page which was replaced, if CF=0
3Ah (58) SETWIN2 (Set memory page into second frame)
Input:
A - memory block handle
B - number of page in block (0,1,2...)
C - 39h
Output:
A - error code, if CF=1
A - phisical number of page which was replaced, if CF=0
3Bh (59) SETWIN3 (Set memory page into third frame)
Input:
A - memory block handle
B - number of page in block (0,1,2...)
C - 3Bh
Output:
A - error code, if CF=1
A - phisical number of page which was replaced, if CF=0
3Ch (60) INFOMEM (Information about memory allocation)
Input:
C - 3Ch
Output:
HL - total memory pages
BC - free memory pages
3Dh (61) GETMEM (Allocate a memory block)
Input:
B - size of requred memory block in 16K pages
C - 3Dh
Output:
A - error code, if CF=1
A - memory block handle, if CF=0
3Eh (62) FREEMEM (Deallocate a memory block that was previously allocated by GETMEM)
Input:
A - memory block handle
C - 3Eh
Output:
A - error code, if CF=1
3Fh (63) SETMEM (Resize a memory block)
Input:
A - memory block handle
B - new size of block (in pages)
C - 3Fh
Output:
A - error code, if CF=1
Keyboard Input Functions
30h (48) WAITKEY (Wait the console for a recent keystroke)
Input:
C - 30h
Output:
A - symbol code
D - key code
Е - ASCII code
C - keyboard mode:
bit7 - RUS/LAT
bit3 - Num Lock
bit2 - Scroll Lock
bit1 - Insert
bit0 - Caps Lock
B - shifts state:
bit7 - Left Shift
bit6 - Right Shift
bit5 - Ctrl
bit4 - Alt
bit3 - Left Ctrl
bit2 - Left Alt
bit1 - Right Ctrl
bit0 - Right Alt
31h (49) SCANKEY (Check the console for a recent keystroke)
Input:
C - 31h
Output:
ZF = 1 - no inputs ZF = 0 - if a key has been pressed
A - symbol code
D - key code
Е - ASCII code
C - keyboard mode:
bit7 - RUS/LAT
bit3 - Num Lock
bit2 - Scroll Lock
bit1 - Insert
bit0 - Caps Lock
B - shifts state:
bit7 - Left Shift
bit6 - Right Shift
bit5 - Ctrl
bit4 - Alt
bit3 - Left Ctrl
bit2 - Left Alt
bit1 - Right Ctrl
bit0 - Right Alt
32h (50) ECHOKEY (Wait the console for a recent keystroke and show it)
Input:
C - 32h
Output:
A - symbol code
D - key code
Е - ASCII code
C - keyboard mode:
bit7 - RUS/LAT
bit3 - Num Lock
bit2 - Scroll Lock
bit1 - Insert
bit0 - Caps Lock
B - shifts state:
bit7 - Left Shift
bit6 - Right Shift
bit5 - Ctrl
bit4 - Alt
bit3 - Left Ctrl
bit2 - Left Alt
bit1 - Right Ctrl
bit0 - Right Alt
33h (51) CTRLKEY (Get the key's state. The function returns the state of the key at the time of the call.)
Input:
C - 33h
Output:
A = 0 - keyboard buffer is empty
C - keyboard mode:
bit7 - RUS/LAT
bit3 - Num Lock
bit2 - Scroll Lock
bit1 - Insert
bit0 - Caps Lock
B - shifts state:
bit7 - Left Shift
bit6 - Right Shift
bit5 - Ctrl
bit4 - Alt
bit3 - Left Ctrl
bit2 - Left Alt
bit1 - Right Ctrl
bit0 - Right Alt
35h (53) K_CLEAR (Flush the console input buffer and execute other function)
Input:
B - number of function 30h, 31h, 32h, 33h или 34h
C - 35h
Output:
See requred function description.
36h (54) K_SETUP (Control of keyboard setting)
Input:
B - subfunction
C - 36h

B = 0, set keyboard layout
A - nember of layout
0 - normal
1 - shift
2 - caps lock
3 - caps lock + shift
4 - normal (alternative layout)
5 - shift (alternative layout)
6 - caps lock (alternative layout)
7 - caps lock + shift (alternative layout)
B = 1, get key-sounds control
B = 2, set key-sounds control
A - key-sound value
bit0 - enabled/disabled signal of keyboard buffer is filled
bit1 - enabled/disabled signal of change keyboard layout (normal/alternative)
Output:
See subfunction description.
37h (55) TESTKEY (Check keyboard buffer)
Input:
C - 37h
Output:
ZF = 1 - buffer is empty
A - symbol code
D - key code
Е - ASCII code
C - keyboard mode:
bit7 - RUS/LAT
bit3 - Num Lock
bit2 - Scroll Lock
bit1 - Insert
bit0 - Caps Lock
B - shifts state:
bit7 - Left Shift
bit6 - Right Shift
bit5 - Ctrl
bit4 - Alt
bit3 - Left Ctrl
bit2 - Left Alt
bit1 - Right Ctrl
bit0 - Right Alt
Programs Executing Functions
40h (64) EXEC (Execute a program)
Input:
HL - path
B = 0 - load and execute
C - 40h
Output:
A - error code, if CF=1
A - exit code, если CF=0
41h (65) EXIT (Terminate a program)
Input:
B - exit code
C - 41h
Output:
A - error code, if CF=1
42h (66) WAIT (Get the termination status (exit code))
Input:
C - 42h
Output:
A - exit code
Strings and Command-line Functions
43h (67) GSWITCH (Get command line switch)
Input:
HL - pointer to command line
DE - switch buffer
C - 43h
Output:
HL - pointer to the next char
CF = 0 - the switchs still present in command line
CF = 1 - end of line (It's last switch or zero value)
44h (68) DOSNAME (Convert a name of file)
Input:
C - 44h
B = 0, convert from 11-format to human
HL - 11 chars of filename
DE - buffer for name in human format
B = 1, convert from human format to 11-format
HL - filename "myfile.ext",0
DE - 11 chars of filename "myfile ext"
Output:
A - error code, if CF=1
45h (69) EXCMDLN (Parse the command line)
Input:
HL - pointer to the command line
DE - pointer to the parameter buffer
C - 45h
B - subfunction:
0 - Parse the line;
1 - Strip drive name;
2 - Strip path;
3 - Strip filename;
4 - Strip filetype;
5 - Strip drive name, path, filename and filetype;
6 - Reserved;
7 - Get command line switch;
8 - Convert from 11-format to human format;
9 - Convert from from human format to 11-format;
Subfunction 0 - Parse the line:
Input:
HL - pointer to the command line
C - 45h
B = 0 - Parse the line
Output:
A - error code, if CF=1
A - status, if CF=0
bit7 - symbols ? or * specified
bit3 - drive name specified;
bit2 - path specified;
bit1 - filetype specified;
bit0 - filename specified;
Subfunction 1 - Strip drive name:
Input:
HL - pointer to the command line
DE - buffer (13 bytes)
C - 45h
B = 1 - Strip drive name
Output:
A - error code, if CF=1
A - number of disk (0 - A, 1 - B, 2 - C, etc.), if CF=0
buffer - disk name "A:",0
Subfunction 2 - Strip path:
Input:
HL - pointer to the command line
DE - buffer (256 bytes)
C - 45h
B = 2 - Strip path
Output:
A - error code, if CF=1
A - status, if CF=0
bit7 - symbols ? or * specified
bit3 - drive name specified;
bit2 - path specified;
bit1 - filetype specified;
bit0 - filename specified;
buffer - path "DIR1\DIR2\DIR3\",0
Subfunction 3 - Strip filename:
Input:
HL - pointer to the command line
DE - buffer (13 bytes)
C - 45h
B = 3 - Strip filename
Output:
A - error code, if CF=1
A - status, if CF=0
bit7 - symbols ? or * specified
bit3 - drive name specified;
bit2 - path specified;
bit1 - filetype specified;
bit0 - filename specified;
buffer - filename "FILE.EXT",0
Subfunction 4 - Strip filetype:
Input:
HL - pointer to the command line
DE - buffer (4 bytes)
C - 45h
B = 4 - Strip filetype
Output:
A - error code, if CF=1
A - status, if CF=0
bit7 - symbols ? or * specified
bit3 - drive name specified;
bit2 - path specified;
bit1 - filetype specified;
bit0 - filename specified;
buffer - filetype "TXT",0 or "C ",0
Subfunction 5 - Strip drive name, path, filename and filetype:
Input:
HL - pointer to the command line
DE - buffer (8 bytes)
(DE+0) pointer to the buffer for drive name (13 bytes)
(DE+2) pointer to the buffer for path (256 bytes)
(DE+3) pointer to the buffer for filename (13 bytes)
(DE+4) pointer to the buffer for filetype (4 bytes)
C - 45h
B = 5 - Strip drive name, path, filename and filetype
Output:
A - error code, if CF=1
A - status, if CF=0
bit7 - symbols ? or * specified
bit3 - drive name specified;
bit2 - path specified;
bit1 - filetype specified;
bit0 - filename specified;
Subfunction 7 - Get command line switch
Input:
HL - pointer to the command line
DE - switch buffer
C - 43h
Output:
HL - pointer to the next char
CF = 0 - the switchs still present in command line
CF = 1 - end of line (It's last switch or zero value)
Subfunction 8 - Convert from 11-format to human format
Input:
C - 45h
B = 8, convert from 11-format to human
HL - 11 chars of filename
DE - buffer for name in human format
Output:
A - error code, if CF=1
Subfunction 9 - Convert from from human format to 11-format
Input:
C - 45h
B = 9, convert from human format to 11-format
HL - filename "myfile.ext",0
DE - 11 chars of filename "myfile  ext"
Output:
A - error code, if CF=1
Variables Functions
46h (70) ENVIRON (System Environment)
Input:
B - subfunction
C - 46h
B=0 Getting system environment
HL - buffer
B=1 Get environment variable
HL - variable name
DE - buffer for variable value
B=2 Set/Remove environment variable
HL - variable name and value separated by char '=', (VARIABLE=VALUE)
Output:
A - status, if CF=0
A=0 - variable was not found
A=0FFh - variable was found
DE - points to the end of buffer
A - error code, if CF=1
47h (71) APPINFO (Get application information)
Input:
B - subfunction
C - 47h
HL - data buffer
B=0 - getting command line parameters
B=1 - getting full path of the program's directory
B=2 - getting full path and filename of program
Output:
A - error code, if CF=1
Display and Text Functions
50h (80) SETVMOD (Set video mode)
Input:
A - video mode
   02h - text mode 40x32x16 colors
   03h - text mode 80x32x16 colors
   81h - graphic mode 320x256x256 colors
   82h - graphic mode 640x256x16 colors
B - number of active screen 0/1
C - 50h
Output:
A - error code, if CF=1
51h (81) GETVMOD (Get a current video mode)
Input:
C - 51h
Output:
A - error code, if CF=1
A - current video mode, если CF=0 (see SETVMOD.)
B - number of active screen 0/1
52h (82) LOCATE (Set the coordinates for the cursor's current position)
Input:
D - line (Y-position)
E - column (X-position)
C - 52h
Output:
none
53h (83) CURSOR (Get the coordinates for the cursor's current position)
Input:
C - 53h
Output:
D - line (Y-position)
E - column (X-position)
54h (84) SELPAGE (Select active screen)
Input:
B - number of active screen 0/1
C - 54h
Output:
A - error code, if CF=1
55h (85) SCROLL (Scroll window)
Input:
D - specifies the y-coordinate of the upper-left corner of the window
E - specifies the x-coordinate of the upper-left corner of the window
H - window height
L - window width
B = 1 - scroll up
B = 2 - scroll down
A = 0 - clear line
C - 55h
Output:
none
56h (86) CLEAR (Clear window)
Input:
D - specifies the y-coordinate of the upper-left corner of the window
E - specifies the x-coordinate of the upper-left corner of the window
H - window height
L - window width
B - fill color
A - fill symbol
C - 56h
Output:
none
57h (87) RDCHAR (Read symbol from the screen)
Input:
D - line
E - column
C - 57h
Output:
A - symbol
B - attribute
58h (88) WRCHAR (Write symbol to the screen)
Input:
D - line
E - column
A - symbol
B - attribute
C - 58h
Output:
none
59h (89) WINCOPY (Store window)
Input:
D - specifies the y-coordinate of the upper-left corner of the window
E - specifies the x-coordinate of the upper-left corner of the window
H - window height
L - window width
B - buffer page
IX - buffer address
C - 59h
Output:
none
5Ah (90) WINREST (Restore window)
Input:
D - specifies the y-coordinate of the upper-left corner of the window
E - specifies the x-coordinate of the upper-left corner of the window
H - window height
L - window width
B - buffer page
IX - buffer address
C - 5Ah
Output:
none
5Bh (91) PUTCHAR (Write a character to the console)
Input:
A - symbol
C - 5Bh
Output:
none
5Ch (92) PCHARS (Write the null-terminated string pointed to by string directly to the console)
Input:
HL - pointer to the output string
C - 5Ch
Output:
none
Printing Functions
5Fh (95) PRINT (Send a character to the printer without waits)
Input:
A - symbol
C - 5Fh
Output:
CF = 0 - printed successfully
CF = 1 - printer busy
B - symbol