/sinclair/zxspectrum/originaldocs.php">ZX
Spectrum Original Documents <a href="/glossary.php?lookup=DISCiple" onMouseover="ddrivetip('<?
// Connect to the database
$mysql = mysql_connect("localhost","retroisl_admin", "network", "retroisl_retroisle");
mysql_select_db("retroisl_retroisle",$mysql);
$query ="SELECT description from glossary where id = 30";
$result = mysqli_query($mysql, $query);
if ($row=@mysqli_fetch_array($result,MYSQLI_ASSOC))
{
echo $row['description'];
}
mysqli_close();
?>
')";
onMouseout="hideddrivetip()">
DISCiple</a>/+D Technical Info Guide
RAMSOFT proudly presents:
THE COMPLETE
-------------------------------------------------------
D I S C i P L E / + D T E C H N I C A L I N F O
-------------------------------------------------------
Revision 0.8 (11 Dec 1997)
SUMMARY:
========
1 ..... <a href="/glossary.php?lookup=DISCiple" onMouseover="ddrivetip('<?
// Connect to the database
$mysql = mysql_connect("localhost","retroisl_admin", "network", "retroisl_retroisle");
mysql_select_db("retroisl_retroisle",$mysql);
$query ="SELECT description from glossary where id = 30";
$result = mysqli_query($mysql, $query);
if ($row=@mysqli_fetch_array($result,MYSQLI_ASSOC))
{
echo $row['description'];
}
mysqli_close();
?>
')";
onMouseout="hideddrivetip()">
DISCiple</a>/+D general features
2 ..... Memory layout
3 ..... I/O ports
3.1 ... <a href="/glossary.php?lookup=DISCiple" onMouseover="ddrivetip('<?
// Connect to the database
$mysql = mysql_connect("localhost","retroisl_admin", "network", "retroisl_retroisle");
mysql_select_db("retroisl_retroisle",$mysql);
$query ="SELECT description from glossary where id = 30";
$result = mysqli_query($mysql, $query);
if ($row=@mysqli_fetch_array($result,MYSQLI_ASSOC))
{
echo $row['description'];
}
mysqli_close();
?>
')";
onMouseout="hideddrivetip()">
DISCiple</a> port 7Bh (123 dec.)
4 ..... UFIA layout
5 ..... System calls (hook codes)
5.1 ... Internal system calls
6 ..... Disk layout
7 ..... Filesystem details
8 ..... File types table
9 ..... GDOS extended Basic commands
9.1 ... The snapshot button
9.2 ... GDOS/G+DOS and UNIDOS error messages
10 ..... GDOS/G+DOS and UNIDOS system variables
11 ..... Connectors pinouts
12 ..... VL1772 FDC programming info
DISCLAIMER
==========
This document may contain some errors. The authors do not assume any
responsability for losses and damages caused to your system by use of any
information reported here.
COMMON TERMS
============
DRAM - The sector buffer.
RPT - A system variable which points to a byte in the
DRAM.
UFIA - User File Information Area, a 24 byte structure which describes
a file for system calls.
DFCA - Disk File Channel Area.
1. <a href="/glossary.php?lookup=DISCiple" onMouseover="ddrivetip('<?
// Connect to the database
$mysql = mysql_connect("localhost","retroisl_admin", "network", "retroisl_retroisle");
mysql_select_db("retroisl_retroisle",$mysql);
$query ="SELECT description from glossary where id = 30";
$result = mysqli_query($mysql, $query);
if ($row=@mysqli_fetch_array($result,MYSQLI_ASSOC))
{
echo $row['description'];
}
mysqli_close();
?>
')";
onMouseout="hideddrivetip()">
DISCiple</a> / +D features
=========================
8 KB
EPROM (for disk BIOS)
8 KB RAM
NMI button (snapshot)
Parallel port (not bi-directional)
Floppy disk port (controlled by VL1772 FDC)
<a href="/glossary.php?lookup=DISCiple" onMouseover="ddrivetip('<?
// Connect to the database
$mysql = mysql_connect("localhost","retroisl_admin", "network", "retroisl_retroisle");
mysql_select_db("retroisl_retroisle",$mysql);
$query ="SELECT description from glossary where id = 30";
$result = mysqli_query($mysql, $query);
if ($row=@mysqli_fetch_array($result,MYSQLI_ASSOC))
{
echo $row['description'];
}
mysqli_close();
?>
')";
onMouseout="hideddrivetip()">
DISCiple</a> only features:
Two ATARI joystick ports (Sinclair 1, Sinclair 2 / Kempston)
Two network connectors (Interface 1 compatible, 3.5mm jack)
Inhibit button (to lock out the interface)
Throughout bus connector (to plug in other devices)
2. MEMORY LAYOUT
================
When the interface memory is paged in (see below), the first 16K of the
Z80 address space have this mapping:
Address <a href="/glossary.php?lookup=DISCiple" onMouseover="ddrivetip('<?
// Connect to the database
$mysql = mysql_connect("localhost","retroisl_admin", "network", "retroisl_retroisle");
mysql_select_db("retroisl_retroisle",$mysql);
$query ="SELECT description from glossary where id = 30";
$result = mysqli_query($mysql, $query);
if ($row=@mysqli_fetch_array($result,MYSQLI_ASSOC))
{
echo $row['description'];
}
mysqli_close();
?>
')";
onMouseout="hideddrivetip()">
DISCiple</a> +D
------------------------------
0x0000 8K RAM 8K ROM
0x2000 8K ROM 8K RAM
UNI-DOS memory mapping is the same as +D, even on <a href="/glossary.php?lookup=DISCiple" onMouseover="ddrivetip('<?
// Connect to the database
$mysql = mysql_connect("localhost","retroisl_admin", "network", "retroisl_retroisle");
mysql_select_db("retroisl_retroisle",$mysql);
$query ="SELECT description from glossary where id = 30";
$result = mysqli_query($mysql, $query);
if ($row=@mysqli_fetch_array($result,MYSQLI_ASSOC))
{
echo $row['description'];
}
mysqli_close();
?>
')";
onMouseout="hideddrivetip()">
DISCiple</a>.
Read [3.1] to see how it is possible to swap ROM/RAM addresses on the
<a href="/glossary.php?lookup=DISCiple" onMouseover="ddrivetip('<?
// Connect to the database
$mysql = mysql_connect("localhost","retroisl_admin", "network", "retroisl_retroisle");
mysql_select_db("retroisl_retroisle",$mysql);
$query ="SELECT description from glossary where id = 30";
$result = mysqli_query($mysql, $query);
if ($row=@mysqli_fetch_array($result,MYSQLI_ASSOC))
{
echo $row['description'];
}
mysqli_close();
?>
')";
onMouseout="hideddrivetip()">
DISCiple</a>.
3. <a href="/glossary.php?lookup=DISCiple" onMouseover="ddrivetip('<?
// Connect to the database
$mysql = mysql_connect("localhost","retroisl_admin", "network", "retroisl_retroisle");
mysql_select_db("retroisl_retroisle",$mysql);
$query ="SELECT description from glossary where id = 30";
$result = mysqli_query($mysql, $query);
if ($row=@mysqli_fetch_array($result,MYSQLI_ASSOC))
{
echo $row['description'];
}
mysqli_close();
?>
')";
onMouseout="hideddrivetip()">
DISCiple</a> and PlusD I/O PORTS
===============================
NOTE: Joystick 1 is scanned both as Kempston and Sinclair 2 (keys 6,7,8,9,0)
Joystick 2 is Sinclair 1 (keys 1,2,3,4,5)
Network is a Interface 1 compatible net.
+D lacks of joystick ports and network.
Port (+D) In Out Notes
---------------------------------------------------------------------------
1Bh (E3h) FDC status FDC command See also section 12
5Bh (EBh) track register track
9Bh (F3h) sector regist. sector register
DBh (FBh) data register data register
1Fh (EFh) Joystick 1 control: Joy is <a href="/glossary.php?lookup=DISCiple" onMouseover="ddrivetip('<?
// Connect to the database
$mysql = mysql_connect("localhost","retroisl_admin", "network", "retroisl_retroisle");
mysql_select_db("retroisl_retroisle",$mysql);
$query ="SELECT description from glossary where id = 30";
$result = mysqli_query($mysql, $query);
if ($row=@mysqli_fetch_array($result,MYSQLI_ASSOC))
{
echo $row['description'];
}
mysqli_close();
?>
')";
onMouseout="hideddrivetip()">
DISCiple</a> only
b0 right drive select
b1 left side select
b2 down single/double density
b3 up ROM bank select
b4 fire Inhibit switch control Inhibit is <a href="/glossary.php?lookup=DISCiple" onMouseover="ddrivetip('<?
// Connect to the database
$mysql = mysql_connect("localhost","retroisl_admin", "network", "retroisl_retroisle");
mysql_select_db("retroisl_retroisle",$mysql);
$query ="SELECT description from glossary where id = 30";
$result = mysqli_query($mysql, $query);
if ($row=@mysqli_fetch_array($result,MYSQLI_ASSOC))
{
echo $row['description'];
}
mysqli_close();
?>
')";
onMouseout="hideddrivetip()">
DISCiple</a> only
b5 -- ext. select (?)
b6 PRN BUSY printer STROBE
b7 network network
59h (N/A) wait when net=1 -- <a href="/glossary.php?lookup=DISCiple" onMouseover="ddrivetip('<?
// Connect to the database
$mysql = mysql_connect("localhost","retroisl_admin", "network", "retroisl_retroisle");
mysql_select_db("retroisl_retroisle",$mysql);
$query ="SELECT description from glossary where id = 30";
$result = mysqli_query($mysql, $query);
if ($row=@mysqli_fetch_array($result,MYSQLI_ASSOC))
{
echo $row['description'];
}
mysqli_close();
?>
')";
onMouseout="hideddrivetip()">
DISCiple</a> only
7Bh (N/A) set boot reset boot <a href="/glossary.php?lookup=DISCiple" onMouseover="ddrivetip('<?
// Connect to the database
$mysql = mysql_connect("localhost","retroisl_admin", "network", "retroisl_retroisle");
mysql_select_db("retroisl_retroisle",$mysql);
$query ="SELECT description from glossary where id = 30";
$result = mysqli_query($mysql, $query);
if ($row=@mysqli_fetch_array($result,MYSQLI_ASSOC))
{
echo $row['description'];
}
mysqli_close();
?>
')";
onMouseout="hideddrivetip()">
DISCiple</a> only, see [3.1]
BBh (E7h) mem. page in memory page out (*)
FBh (F7h) -- printer data
FEh (N/A) Joystick 2 <a href="/glossary.php?lookup=DISCiple" onMouseover="ddrivetip('<?
// Connect to the database
$mysql = mysql_connect("localhost","retroisl_admin", "network", "retroisl_retroisle");
mysql_select_db("retroisl_retroisle",$mysql);
$query ="SELECT description from glossary where id = 30";
$result = mysqli_query($mysql, $query);
if ($row=@mysqli_fetch_array($result,MYSQLI_ASSOC))
{
echo $row['description'];
}
mysqli_close();
?>
')";
onMouseout="hideddrivetip()">
DISCiple</a> only
(*) <a href="/glossary.php?lookup=DISCiple" onMouseover="ddrivetip('<?
// Connect to the database
$mysql = mysql_connect("localhost","retroisl_admin", "network", "retroisl_retroisle");
mysql_select_db("retroisl_retroisle",$mysql);
$query ="SELECT description from glossary where id = 30";
$result = mysqli_query($mysql, $query);
if ($row=@mysqli_fetch_array($result,MYSQLI_ASSOC))
{
echo $row['description'];
}
mysqli_close();
?>
')";
onMouseout="hideddrivetip()">
DISCiple</a> and +D memories are also paged in whenever the
Z80 fetches an
instruction from the following addresses:
0x0000, 0x0008, 0x0066, 0x028E.
3.1 <a href="/glossary.php?lookup=DISCiple" onMouseover="ddrivetip('<?
// Connect to the database
$mysql = mysql_connect("localhost","retroisl_admin", "network", "retroisl_retroisle");
mysql_select_db("retroisl_retroisle",$mysql);
$query ="SELECT description from glossary where id = 30";
$result = mysqli_query($mysql, $query);
if ($row=@mysqli_fetch_array($result,MYSQLI_ASSOC))
{
echo $row['description'];
}
mysqli_close();
?>
')";
onMouseout="hideddrivetip()">
DISCiple</a> PORT 7Bh (123 dec.) AND MEMORY ADDRESSES
======================================================
Port 7Bh is available only on the <a href="/glossary.php?lookup=DISCiple" onMouseover="ddrivetip('<?
// Connect to the database
$mysql = mysql_connect("localhost","retroisl_admin", "network", "retroisl_retroisle");
mysql_select_db("retroisl_retroisle",$mysql);
$query ="SELECT description from glossary where id = 30";
$result = mysqli_query($mysql, $query);
if ($row=@mysqli_fetch_array($result,MYSQLI_ASSOC))
{
echo $row['description'];
}
mysqli_close();
?>
')";
onMouseout="hideddrivetip()">
DISCiple</a> and has a flip flop attached to it.
It can be used to swap the RAM/ROM addresses in this way:
Access ROM RAM Purpose
----------------------------------
IN 0x0000 0x2000 reset ff
OUT 0x2000 0x0000 set ff
This feature is used by GDOS to know if it necessary to load the system
file from disk on boot or after two consecutive resets without any DOS
command between them; UNIDOS ignores this feature, so any swap attempt will
result in a system crash.
In GDOS there is a variable located in RAM at offset 0x1DE4 that is set to
0x44 ('D') after a BASIC syntax check (i.e. after a RST 08h with a code lower
than 1Bh) and after a bootstrap: this variable indicates that the DOS services
have been called almost once. Whenever the user resets the computer, the flip
flop attached to port 7Bh is reset, so the ROM will be placed at 0x0000. When
the first interrupt occurs, the keyboard scanning routine is called at 0x028E
and the <a href="/glossary.php?lookup=DISCiple" onMouseover="ddrivetip('<?
// Connect to the database
$mysql = mysql_connect("localhost","retroisl_admin", "network", "retroisl_retroisle");
mysql_select_db("retroisl_retroisle",$mysql);
$query ="SELECT description from glossary where id = 30";
$result = mysqli_query($mysql, $query);
if ($row=@mysqli_fetch_array($result,MYSQLI_ASSOC))
{
echo $row['description'];
}
mysqli_close();
?>
')";
onMouseout="hideddrivetip()">
DISCiple</a> memory is automatically paged in. At offset 0x028E in the
<a href="/glossary.php?lookup=DISCiple" onMouseover="ddrivetip('<?
// Connect to the database
$mysql = mysql_connect("localhost","retroisl_admin", "network", "retroisl_retroisle");
mysql_select_db("retroisl_retroisle",$mysql);
$query ="SELECT description from glossary where id = 30";
$result = mysqli_query($mysql, $query);
if ($row=@mysqli_fetch_array($result,MYSQLI_ASSOC))
{
echo $row['description'];
}
mysqli_close();
?>
')";
onMouseout="hideddrivetip()">
DISCiple</a>'s ROM there's a routine that checks if the variable we said above
holds 0x44: if it's the case, then the same routine puts 00h in there to say
that DOS services haven't been called since last reset; otherwise the routine
sets the variable to 0x53 ('S') and copies the first 2335 (0x091F) bytes of
ROM in the RAM: in this case the system file has to be loaded again.
When all is finished, the memories will be swapped again (i.e. the flip flop
will be set) by OUTing to port 7Bh, the <a href="/glossary.php?lookup=DISCiple" onMouseover="ddrivetip('<?
// Connect to the database
$mysql = mysql_connect("localhost","retroisl_admin", "network", "retroisl_retroisle");
mysql_select_db("retroisl_retroisle",$mysql);
$query ="SELECT description from glossary where id = 30";
$result = mysqli_query($mysql, $query);
if ($row=@mysqli_fetch_array($result,MYSQLI_ASSOC))
{
echo $row['description'];
}
mysqli_close();
?>
')";
onMouseout="hideddrivetip()">
DISCiple</a> paged out by OUTing to port
BBh and the keyscan routine is finally executed.
INning from port 7Bh has the same meaning of a system reset for the DOS, so
after reading 2 times from port 7Bh without typing a DOS command between them
the system file needs to be reloaded.
NOTE that since all this is based on the keyscan routine in the Spectrum's
ROM, nothing will happen by INning from port 7Bh if the call is not performed
(i.e. if interrupts are disabled in IM 1 or we're not in IM 1 or keyboard is
scanned in a custom way); however the last operation with port 7Bh must be an
OUT before the routine in the ROM is executed if you want to keep the system
safe by resetting once.
4. USER FILE INFORMATION AREA (UFIA)
====================================
Offset Len Meaning
---------------------------------------
0 1 Drive number (1, 2 or '*' for current)
1 1 Program number (in the directory)
2 1 Stream number
3 1 Device density type ('d'=DD, 'D'=SD)
4 1 Directory description (see below)
5 10 File name (padded with spaces)
15 1 File type (see below)
16 2 Length of file
18 2 Start address
20 2 Basic length
22 2 Autostart line
5. SYSTEM CALLS (both <a href="/glossary.php?lookup=DISCiple" onMouseover="ddrivetip('<?
// Connect to the database
$mysql = mysql_connect("localhost","retroisl_admin", "network", "retroisl_retroisle");
mysql_select_db("retroisl_retroisle",$mysql);
$query ="SELECT description from glossary where id = 30";
$result = mysqli_query($mysql, $query);
if ($row=@mysqli_fetch_array($result,MYSQLI_ASSOC))
{
echo $row['description'];
}
mysqli_close();
?>
')";
onMouseout="hideddrivetip()">
DISCiple</a> and +D)
======================================
To invoke system services you must use the IF1 protocol:
RST 8
DB #service
All the functions return an error code into register A.
IMPORTANT NOTES:
You cannot perform RST 8 calls from within a routine located into the
interface's RAM.
You must not call ROM address 0x028E (keyboard scanning routine) from
within an interrupt routine, since this would crash the Spectrum when a
<a href="/glossary.php?lookup=DISCiple" onMouseover="ddrivetip('<?
// Connect to the database
$mysql = mysql_connect("localhost","retroisl_admin", "network", "retroisl_retroisle");
mysql_select_db("retroisl_retroisle",$mysql);
$query ="SELECT description from glossary where id = 30";
$result = mysqli_query($mysql, $query);
if ($row=@mysqli_fetch_array($result,MYSQLI_ASSOC))
{
echo $row['description'];
}
mysqli_close();
?>
')";
onMouseout="hideddrivetip()">
DISCiple</a>/+D is connected; some programs crash due to this fact
(eg SoundTracker v1.1) - you may try to correct the problem replacing the
CALL 0x028E with a RST 0x38.
A few programs (like some games converted to disk) do not use the RST 8
mechanism but make absolute CALLs instead - a very bad practice!
This is the list of GDOS3 (G+DOS2) hook codes with input parameters:
HXFER (33h) - transfer file description and header to the DFCA.
IX = UFIA address
OFSM (34h) - open file sector map with the info in the DFCA.
The RTP is set to the beginning of the
DRAM.
HOFLE (35h) - open a file.
IX = UFIA
Combines the previous two functions.
Sets the last 9 bytes of UFIA with the file header.
SBYT (36h) - Save a byte to
DRAM location pointed by RTP.
A = byte to save.
If the sector buffer is full, it is automatically saved
to disk.
HSVBK (37h) - Save a block of data.
DE = start address of data.
BC = number of bytes to save.
CFSM (38h) - Close file sector map.
Flushes
DRAM, closes file and updates the directory.
PNTP (39h) - Output a byte to the parallel port.
A = byte to output.
COPS (3Ah) - Copy the screen to printer.
HGFLE (3Bh) - Get a file from disk.
IX = UFIA
The first sector is loaded to
DRAM and RPT is set to the
first byte.
LBYT (3Ch) - Load the byte pointed by RPT.
Returns A = byte read.
If needed, another sector is read from the disk.
RPT is updated consequently.
HLDBK (3Dh) - Load a block of data.
DE = start address (where the data will be put)
BC = number of bytes to read
WSAD (3Eh) - Write the
DRAM to a sector in the disk.
D = track
E = sector
RPT is restored to the beginning of
DRAM.
RSAD (3Fh) - Read a sector to
DRAM.
D = track
E = sector
Same as 3Eh.
REST (40h) - Reset drive and seek track 0.
Drive number is specified into the UFIA.
HERAZ (41h) - Erase the file on disk identified by UFIA.
IX = UFIA address.
For the next ones I haven't exact information:
(42h) - Large screen dump
(43h) - Disk catalogue
(44h) - Load sector
IX = start address
(45h) - Save sector
IX = start address
(46h) - Open and close streams (how?)
(47h) - Page in
Now UNIDOS-only hook codes:
(48h) - Load file (?)
(49h) - Verify file (?)
(4Ah) - Merge (?)
(4Bh) - Save file (?)
(4Ch) - Open file (?)
(4Dh) - POINT (see UNIDOS)
(4Eh) - Flush buffers to disk
(4Fh) - Close file
(50h) - Clear channels
(51h) - Rename file (?)
(52h) - Move stream
(53h) - Select disk and directory
5.1 INTERNAL SYSTEM CALLS (both <a href="/glossary.php?lookup=DISCiple" onMouseover="ddrivetip('<?
// Connect to the database
$mysql = mysql_connect("localhost","retroisl_admin", "network", "retroisl_retroisle");
mysql_select_db("retroisl_retroisle",$mysql);
$query ="SELECT description from glossary where id = 30";
$result = mysqli_query($mysql, $query);
if ($row=@mysqli_fetch_array($result,MYSQLI_ASSOC))
{
echo $row['description'];
}
mysqli_close();
?>
')";
onMouseout="hideddrivetip()">
DISCiple</a> and +D)
================================================
Here is the purpose of the RST commands when the <a href="/glossary.php?lookup=DISCiple" onMouseover="ddrivetip('<?
// Connect to the database
$mysql = mysql_connect("localhost","retroisl_admin", "network", "retroisl_retroisle");
mysql_select_db("retroisl_retroisle",$mysql);
$query ="SELECT description from glossary where id = 30";
$result = mysqli_query($mysql, $query);
if ($row=@mysqli_fetch_array($result,MYSQLI_ASSOC))
{
echo $row['description'];
}
mysqli_close();
?>
')";
onMouseout="hideddrivetip()">
DISCiple</a> or the +D memories
are paged in.
RST 00h - Reset
RST 08h - Call system services; the required service code must follow (1)(2)
RST 10h - Call in Spectrum ROM; the routine address must follow (3)
RST 18h - GDOS, G+DOS : reserved (for syntax check)
Uni-DOS : low-level system services; the required service code must
follow
RST 20h - Print DOS error report : the error code must follow
RST 28h - Performs a RST 20h in the Spectrum ROM
RST 30h - Gets interpreter status : Z=0 if checking syntax, Z=1 if executing
RST 38h - Enables interrupts
(1) = ROM 1 must be paged in Spectrum 128K
(2) = The interface is automatically paged in by the hardware
(3) = Be sure that the right Spectrum ROM is paged in
6. DISK LAYOUT
==============
The disk has 80 tracks of 10 sectors (512 bytes high density, 256 bytes low
density) each.
The first four tracks of the disk (tracks 0-3 side 0) are reserved for the
system and contain the disk directory.
The directory consists of 80 consecutive file descriptors, each one taking
256 bytes; thus, the descriptor of file #48 resides in the first 256 bytes
of sector 4 track 2.
The directory has a fixed dimension and can only contain up to 80 files.
UNIDOS introduces subdirectories and allows to specify the maximum number
of file entries for each directory.
7. FILE DESCRIPTOR FORMAT
=========================
Now we will see the details about a single directory entry.
NOTE: All numbers are in decimal.
General structure:
BYTE MEANING
0 File type (see FILE-TYPES table); 0= Erased or free entry
1-10 Filename (padded with spaces)
11-12 Number of sectors occupated by the file (0-65535)
13 Track number of the first sector of the file
14 Sector number of the first sector of the file
15-209 Sector allocation bitmap. Each bit correspond to a disk sector.
A bit is set if the corresponding sector belong to the file.
Examples: byte 15, bit 0 corresponds to track 4, sector 1;
byte 16, bit 3 means track 5, sector 2...
IMPORTANT NOTE:
The s.a.b. is used only during saving operations: the s.a.b. of
all the 80 files are merged together (OR) so that the system
knows which sectors are free (not allocated to any file).
During loading a faster method is used: each sector contains
only 510 bytes of data; the last two bytes contain the
track number and the sector number of the next sector of the file,
respectively. The last sector of the chain contains (0,0) as the
last two bytes.
210-255 Depends on the file type.
BASIC (type 1)
---------------
210 Always 0
211-212 Length
213-214 Memory start address ( PROG when loading - usually 23755)
215-216 Length without variables
217-218 Autostart line
NOTE: These 9 bytes are also the first 9 bytes of the file.
NUMBER ARRAY (type 2)
---------------------
210 Always 1
211-212 Length
213-314 Memory start address.
215-216 Array name, probably ignored.
217-218 Not used
NOTE: These 9 bytes are also the first 9 bytes of the file.
STRING ARRAY (type 3)
---------------------
210 Always 2
211-218 Same as for type 2
NOTE: These 9 bytes are also the first 9 bytes of the file.
CODE FILE (type 4)
------------------
210 Always 3
211-212 Length
213-314 Start address
215-216 Not used
217-218 Autorun address
48K SNAPSHOT (type 5)
---------------------
210-218 Not used
219-255
Z80 registers
MDRV (type 6)
-------------
This is a
Microdrive cartridge image. Details omitted.
SCREEN$ (type 7)
----------------
Same as type 4 with Start=16384 and Length=6912
SPECIAL (type 8)
----------------
210-255 Any meaning assigned by the programmer.
128K SNAPSHOT (type 9)
----------------------
Same as 48K Snapshot. The first byte of the file is a copy of the page
register (port 0x7FFD), usually held in the system variable BANKM (23388).
OPENTYPE (type 10)
------------------
210 Number of 64K blocks in the file
211-212 Length of the last block
213-255 Not used
EXECUTE (type 11)
-----------------
210-255 Same as CODE file (type 4), but Length=510 and Start=0x1BD6 implicitly
(0x3DB6 for +D). The sector is loaded into the interface RAM
and executed (it should contain relocatable code!).
SUBDIRECTORY (type 12) - UNIDOS
-------------------------------
210-212 Same as Opentype (type 10). This file is always held on contiguous
sectors. The last two bytes of a sector do not contain the address
of the next sector. The structure is the same as the root directory,
but the first entry contains the file header number of the parent
directory. The last two bytes of the last sector contain 0xFFFF.
CREATE (type 13) - UNIDOS
-------------------------
210-255 Same as CODE file but the start address is ignored.
8. FILE-TYPES TABLE
===================
Code Type
--------------------------
0 (ERASED)
1 BASIC
2 NUMBER ARRAY
3 STRING ARRAY
4 CODE
5 48K SNAPSHOT
6
Microdrive
7 SCREEN$
8 SPECIAL
9 128K SNAPSHOT
10 OPENTYPE
11 EXECUTE
12 SUBDIRECTORY (UNIDOS)
13 CREATE (UNIDOS)
UNIDOS: Add 128 for hidden files and 64 for protected files.
9. GDOS EXTENDED BASIC SYNTAX
=============================
GDOS extends the BASIC to provide support for disk operations.
When you switch the Spectrum on, you must initialize the system; to do so,
insert a disk containing the operating system file ("SYS*" on <a href="/glossary.php?lookup=DISCiple" onMouseover="ddrivetip('<?
// Connect to the database
$mysql = mysql_connect("localhost","retroisl_admin", "network", "retroisl_retroisle");
mysql_select_db("retroisl_retroisle",$mysql);
$query ="SELECT description from glossary where id = 30";
$result = mysqli_query($mysql, $query);
if ($row=@mysqli_fetch_array($result,MYSQLI_ASSOC))
{
echo $row['description'];
}
mysqli_close();
?>
')";
onMouseout="hideddrivetip()">
DISCiple</a> and
"+SYS*" for +D) into the first drive and then enter "RUN".
The DOS also looks for the first file called "auto*" and runs it if found.
NOTE: File names are case insensitive.
To show the disk contents, enter:
CAT 1 (for drive 1) or
CAT * (current drive)
To LOAD/SAVE a file:
LOAD d;"filename" [CODE|SCREEN$|DATA|etc]
LOAD p
SAVE d;"program" [CODE|LINE|SCREEN$|etc]
where is a drive number (1-2)
is a file number (1-80)
The file names are not case sensitive and you can use wildcards ('*' and
'?' characters work exactly like you'd expect).
You must specify 'S' to load a 48K snapshot and 'K' for a 128K snapshot.
Case of letters 'S' and 'K' is important.
Examples:
LOAD d1;"screen" SCREEN$
LOAD d*;"pippo" loads program pippo from the current drive
LOAD d1;"snap128"K loads the 128K snapshot 'snap128'
SAVE d2;"rom" CODE 0,16384
Note: "d1" with lowcase 'd' refers to DS DD disks (80 tracks double sided);
in ROM version 3 the only difference seems to be that if you use 'D' a CAT
command is also performed after the operation.
Early versions of the OS used "D1" (capital 'D') for single sided disks.
This applies always when you have to specify the 'd' field.
Please use only DS/DD disks.
Each file can be referred both though its name and its directory number, so
if file "screen" is listed as number 7 you may also enter:
LOAD p7
Note that if you use the abbreviated notation, each file will be loaded
accordingly to its type (i.e. you can a CODE file will be loaded into memory
at its start address).
Of course MERGE and VERIFY are also available with a similar syntax.
To erase a file from the disk, enter:
ERASE d1;"file2del"
ERASE d1;"*" dangerous!
To format a disk, use:
FORMAT d1
GDOS also extends streams, so that you can redirect a stream to a file and
vice versa. We will not analyze the extended syntax of OPEN, CLOSE and
MOVE here.
<a href="/glossary.php?lookup=DISCiple" onMouseover="ddrivetip('<?
// Connect to the database
$mysql = mysql_connect("localhost","retroisl_admin", "network", "retroisl_retroisle");
mysql_select_db("retroisl_retroisle",$mysql);
$query ="SELECT description from glossary where id = 30";
$result = mysqli_query($mysql, $query);
if ($row=@mysqli_fetch_array($result,MYSQLI_ASSOC))
{
echo $row['description'];
}
mysqli_close();
?>
')";
onMouseout="hideddrivetip()">
DISCiple</a> recognizes the
Microdrive syntax, so you can enter commands like:
LOAD *"m";1;"pippo"
which will load the BASIC program pippo from drive 1. All your
Microdrive
programs should run over GDOS without modifications. Remember that PlusD
does not support the IF1 syntax.
Besides, <a href="/glossary.php?lookup=DISCiple" onMouseover="ddrivetip('<?
// Connect to the database
$mysql = mysql_connect("localhost","retroisl_admin", "network", "retroisl_retroisle");
mysql_select_db("retroisl_retroisle",$mysql);
$query ="SELECT description from glossary where id = 30";
$result = mysqli_query($mysql, $query);
if ($row=@mysqli_fetch_array($result,MYSQLI_ASSOC))
{
echo $row['description'];
}
mysqli_close();
?>
')";
onMouseout="hideddrivetip()">
DISCiple</a> implements the IF1 command set for network operations
(with some enhancements).
UNI-DOS specific syntax coming soon.
9.1 THE SNAPSHOT BUTTON
=======================
When you press the magic button, an NMI is generated and control passes to
address 0x0066 (102 dec.) of the <a href="/glossary.php?lookup=DISCiple" onMouseover="ddrivetip('<?
// Connect to the database
$mysql = mysql_connect("localhost","retroisl_admin", "network", "retroisl_retroisle");
mysql_select_db("retroisl_retroisle",$mysql);
$query ="SELECT description from glossary where id = 30";
$result = mysqli_query($mysql, $query);
if ($row=@mysqli_fetch_array($result,MYSQLI_ASSOC))
{
echo $row['description'];
}
mysqli_close();
?>
')";
onMouseout="hideddrivetip()">
DISCiple</a>/+D memory. The consequent behaviour
of the system depends on the particular System version loaded. Under the
standard systems (eg. systems 3a/3b/3d), you have to hold down CAPS SHIFT
while pressing the button and then colored stripes appear in the border and
five keys are active:
1 = Dump screen to printer
2 = Big screen dump (A4)
3 = Save current screen to disk
4 = Save a 48K snapshot
5 = Save a 128K snapshot.
Snapshots are saved to disk with names like "Snap1A" and subsequent indexes
depending on their position in the directory. When saving a 128K snap, the
system stops after creating the file and waits for the user to specify if the
screen has changed since the beginning of the operation; the user must respond
pressing either 'y' or 'n'. This happens because unlike Multiface the <a href="/glossary.php?lookup=DISCiple" onMouseover="ddrivetip('<?
// Connect to the database
$mysql = mysql_connect("localhost","retroisl_admin", "network", "retroisl_retroisle");
mysql_select_db("retroisl_retroisle",$mysql);
$query ="SELECT description from glossary where id = 30";
$result = mysqli_query($mysql, $query);
if ($row=@mysqli_fetch_array($result,MYSQLI_ASSOC))
{
echo $row['description'];
}
mysqli_close();
?>
')";
onMouseout="hideddrivetip()">
DISCiple</a>
and the +D haven't got any flip flop to store the status of port 0x7FFD bit 3
which tells which videoram is displayed. Before waiting for the user
intervention, the system pages the first videoram (0x4000 page 5), so if the
image displayed changes then it means that the second videoram was previously
paged. Well, that's it!
After that, control is passed back to the interrupted program.
NOTE: The snapshot routine corrupts the stack with six bytes (PC,AF and R+F).
This may cause some programs which use the stack in a particular way to
crash if the magic button is pressed at certain times (eg. Batman the Movie).
9.2 GDOS and UNIDOS ERROR MESSAGES
==================================
Here's a list of the error codes for both systems available for the RST 20h
service.
-------------------------------------------------------------
Code | GDOS | G+DOS
-------------------------------------------------------------
00 | Nonsense in GDOS | Nonsense in G+DOS
01 | Nonsense in GNOS | Nonsense in GNOS
02 | Statement end error | Statement END error
03 | BREAK requested | BREAK requested
04 | SECTOR error | SECTOR error
05 | FORMAT data lost | FORMAT data lost
06 | NO DISC in drive | CHECK DISC in drive
07 | No "SYSTEM" file | NO "+SYS " file
08 | Invalid FILE NAME | Invalid FILE NAME
09 | Invalid STATION | Invalid STATION
10 | Invalid DEVICE | Invalid DEVICE
11 | VARIABLE not found | VARIABLE not found
12 | VERIFY failed | VERIFY failed
13 | Wrong FILE type | Wrong FILE type
14 | MERGE error | MERGE error
15 | CODE error | CODE error
16 | PUPIL set | PUPIL set
17 | Invalid CODE | Invalid CODE
18 | Reading a WRITE file | Reading a WRITE file
19 | Writing a READ file | Writing a READ file
20 | O.K. GDOS 3 | O.K. G+DOS
21 | Network OFF | Network OFF
22 | Wrong DRIVE | Wrong DRIVE
23 | Disc write PROTECTED | Disc write PROTECTED
24 | Not enough SPACE on disc | Not enough SPACE on disc
25 | Directory FULL | Directory FULL
26 | File NOT FOUND | File NOT FOUND
27 | END of file | END of file
28 | File NAME used | File NAME used
29 | Not a MASTER station | NO G+DOS loaded
30 | STREAM used | STREAM used
31 | CHANNEL used | CHANNEL used
-------------------------------------------------------------
----------------------------------
Code | UNIDOS
----------------------------------
128 | Nonsense in Uni-Dos
129 | O.K Uni-Dos
130 | Break requested
131 | Corrupt sector
132 | Sector missing
133 | Check disc in drive
134 | DOS file not found
135 | Invalid filename
136 | Invalid sector number
137 | Invalid device/channel
138 | Wrong stream type
139 | Verification failed
140 | Wrong file type
141 | CODE parameter error
142 | Directory not found
143 | File has zero length
144 | Reading a write file
145 | Writing a read file
146 | POINT outside file
147 | Channel out of order
148 | Illegal drive number
149 | Disc write protected
150 | Not enough disc space
151 | Directory full
152 | File not found
153 | End of file
154 | Filename already used
155 | File still open
156 | File in use
157 | Channel already open
158 | Protected file
159 | Unavailable RST 8
10. GDOS and UNIDOS SYSTEM VARIABLES
====================================
System variables are modified with the POKE command in the following form:
POKE @var, value
where var is a variable number and
value is the new variable value.
Actually, the '@' operator is interpreted as an offset into the interface's
RAM. The base addresses are the following:
0x2000 UNIDOS and G+DOS (+D)
0x0298 GDOS (<a href="/glossary.php?lookup=DISCiple" onMouseover="ddrivetip('<?
// Connect to the database
$mysql = mysql_connect("localhost","retroisl_admin", "network", "retroisl_retroisle");
mysql_select_db("retroisl_retroisle",$mysql);
$query ="SELECT description from glossary where id = 30";
$result = mysqli_query($mysql, $query);
if ($row=@mysqli_fetch_array($result,MYSQLI_ASSOC))
{
echo $row['description'];
}
mysqli_close();
?>
')";
onMouseout="hideddrivetip()">
DISCiple</a>)
List of the system variables:
0 Flash border during disk operations. Set to 0 to leave the border
unaltered. This byte is ANDed with the sector number currently accessed
and then sent to port 0xFE.
1 Drive 1 capacity = number of tracks + 128 if double sided.
2 Drive 2 capacity, same as above.
3 Drive stepping rate. Set to 1 for the minimum (1ms).
WARNING: Poking 0 here may lock your disk drive. It can be unlocked
reinstalling the OS from tape.
4 GDOS: disable
Centronics printer port (0=enabled)
UNIDOS: Enable BREAK key if set.
5 Printer line length in number of characters (default 80)
6 Printer control flag. If set the codes sent to the printer are not
filtered (binary output). Necesssary to send control codes to the
printer.
7 Printer line spacing expressed in n/72 of an inch. It is sent to the
printer before avery CR (default GDOS=12, UNIDOS=8).
8 Number of line feeds after CR (default: GDOS=1 UNIDOS=0).
9 Left margin for printing. This is the number of spaces inserted before
the first character of a line (default=0).
10 Printer flag.
GDOS: if set then the printer driver generates the graphic representation
of 'œ' and ',' (default=1).
UNIDOS: printer flag (default=0x80).
11 GDOS: network station number (default=1).
UNIDOS:
Centronics enable, same as GDOS variable #4 (default=1).
12 UNIDOS: printer column number (default=1).
13 UNIDOS: CLS# screen color.
14 Extended syntax address (2 bytes). This address is called on error which
are not related to hook codes and DOS syntax. Can be used to add extra
commands. Ignored if 0.
16 UNIDOS: Interrupt address (2 bytes).
18 UNIDOS: Printer initialization codes (8 bytes). They are sent to the
printer after a NEW or before pressing the 'P' key during a snapshot.
26 UNIDOS: Set character pitch (8 bytes).
34 UNIDOS: Set n/72 line space (8 bytes).
42 UNIDOS: Set UDG bit graphics density (8 bytes).
50 UNIDOS: Second initialise codes (8 bytes).
58 UNIDOS: Codes for 'œ' (8 bytes).
66 UNIDOS: Codes for '#' (8 bytes).
74 UNIDOS: Codes for (C) (8 bytes).
82 UNIDOS: Save SCREEN$ 2 parameters (7 bytes).
89 UNIDOS: set dump graphics (8 bytes).
97 UNIDOS: address of extra error messages (default=0x1C68).
99 UNIDOS: error code
100 UNIDOS: address of LPRINT routine (default=0x34AA).
102 UNIDOS: DOS error return address (default=0x0000).
104 UNIDOS: snapshot workspace (20 bytes).
124 UNIDOS: called on reset (default=0x0000).
126 UNIDOS: called on boot (default=0x21A4).
7667 UNIDOS: set this to 0 to reset DOS.
11. CONNECTORS PINOUTS
======================
The following pinouts are viewed from the back of the interface.
DISC CONNECTOR
------------------------------------ 1-33 Ground (0V) 22 Write data
| 33 3 1 | 8 Index 24 Write gate
| o o o o o o o o o o o o o o o o o | 10 Disk1 select 26 Track00
| | 12 Disk2 select 28 Write protect
| o o o o o o o o o o o o o o o o o | 16 Motor on 30 Read data
| 34 4 2 | 18 Step dir. 32 Side select
------------------------------------ 20 Step pulse
PRINTER CONNECTOR
---------------------------- 1 Strobe 13 D5
| 25 3 1 | 3 D0 15 D6
| o o o o o o o o o o o o o | 5 D1 17 D7
| | 7 D2 21 Input busy
| o o o o o o o o o o o o o | 9 D3 2-22 Ground (0V)
| 26 4 2 | 11 D4
----------------------------
The parallel pinout allows direct connection to a
Centronics connector
simply with a flat cable.
12. VL1772 PROGRAMMING INFO
===========================
Here is the low-level technical information about the VL1772 floppy
disk controller. Some devices equipped with this component are MGT <a href="/glossary.php?lookup=DISCiple" onMouseover="ddrivetip('<?
// Connect to the database
$mysql = mysql_connect("localhost","retroisl_admin", "network", "retroisl_retroisle");
mysql_select_db("retroisl_retroisle",$mysql);
$query ="SELECT description from glossary where id = 30";
$result = mysqli_query($mysql, $query);
if ($row=@mysqli_fetch_array($result,MYSQLI_ASSOC))
{
echo $row['description'];
}
mysqli_close();
?>
')";
onMouseout="hideddrivetip()">
DISCiple</a>,
MGT PLUS D, MGT SAM COUPE and ATARI ST.
See section 3 for the port addresses of the FDC registers in the <a href="/glossary.php?lookup=DISCiple" onMouseover="ddrivetip('<?
// Connect to the database
$mysql = mysql_connect("localhost","retroisl_admin", "network", "retroisl_retroisle");
mysql_select_db("retroisl_retroisle",$mysql);
$query ="SELECT description from glossary where id = 30";
$result = mysqli_query($mysql, $query);
if ($row=@mysqli_fetch_array($result,MYSQLI_ASSOC))
{
echo $row['description'];
}
mysqli_close();
?>
')";
onMouseout="hideddrivetip()">
DISCiple</a>
and the +D.
----------------------
-COMMAND REGISTER (W)-
----------------------
Commands are divided into four classes. The lower 4 bits of the command byte
have a different meaning depending on the command class; remember to OR them
with the command codes given below.
Type 1 commands:
----------------
b0-b1 = Stepping rate
00 = 6 ms
01 = 12 ms
10 = 20 ms
11 = 30 ms
b2 = Verify track
b3 = Load/unload head at beginning
Command name Code Comments
----------------------------------------------------------------------------
RESTORE 0x00 Restore disk head to track 0
SEEK 0x10 Seek a track (send the track number to the DATA reg.)
STEP_NUPD 0x20 Step using current dir without updating track register
STEP_UPD 0x30 Step drive using current direction
STEP_IN_NUPD 0x40 Increase track without updating track register
STEP_IN_UPD 0x50 Increase track
STEP_OUT_NUPD 0x60 Decrease track without updating track register
STEP_OUT_UPD 0x70 Decrease track
Type 2 commands:
----------------
b0 = f8 (deleted dam) / fb (dam) if set in READ commands
b1 = Enable side compare
b2 = 15 ms delay
b3 = Compare for side 1/0
Command name Code Comments
----------------------------------------------------------------------------
READ_1SECTOR 0x80 Read one sector
READ_MSECTOR 0x90 Read multiple sectors
WRITE_1SECTOR 0xA0 Write one sector
WRITE_MSECTOR 0xB0 Write multiple sectors
Type 3 commands:
----------------
b0-b1 = 0
b2 = 15 ms delay
b3 = 0
Command name Code Notes
----------------------------------------------------------------------------
READ_ADDRESS 0xC0 Read address
READ_TRACK 0xE0 Read a whole track
WRITE_TRACK 0xF0 Write a whole track
Type 4 commands:
----------------
b0 = Not ready to read transition
b1 = Ready to not read transition
b2 = Index pulse
b3 = Immediate interrupt, requires reset
b0-b3 = 0000 -> Terminate with no interrupt
Command name Code Notes
----------------------------------------------------------------------------
FORCE_INTERPT 0xD0 Force interrupt
---------------------
-STATUS REGISTER (R)-
---------------------
Some bits assume a different meaning depending on the last command issued.
After a Type 1 command:
Bit Meaning Comments
----------------------------------------------------------------------------
0 BUSY Wait BUSY=0 for a new command
1 INDEX PULSE Index pulse
2 TRACK00 Signals head on track 00
3 CRC ERROR Sector corrupted
4 SEEK ERROR Seek error
5 HEAD LOADED Head loaded
6 WRITE PROTECT Disk is write protected
7 MOTOR ON Motor is on or drive not ready
After a Type 2/3 command:
Bit Meaning Comments
----------------------------------------------------------------------------
0 BUSY Wait BUSY=0 for a new command
1 DRQ Need to send or read data from DATA register
2 LOST DATA Error (eg you did not respect I/O timings)
3 CRC ERROR Sector corrupted
4 RECORD NOT FOUND Non-existent track/sector or no more data to read
5 REC.TYP/WR.FAULT Read: record type; Write: write fault
6 WRITE PROTECT Disk is write protected
7 MOTOR ON Motor is on or drive not ready
---------------------
-TRACK REGISTER (RW)-
---------------------
Contains the current track number.
----------------------
-SECTOR REGISTER (RW)-
----------------------
Current sector number for read/write operations.
--------------------
-DATA REGISTER (RW)-
--------------------
Here you may read and write the data to the controller.