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 DISCiPLE 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.
The "auto*" file is not searched for if the command "RUN boot" is entered.
NOTE: File names are case insensitive and may contain wildcards ('*' and '?').
To show the disk contents, enter:
CAT 1 (for drive 1) or
CAT * (current drive)
You may also enter commands like these:
so you can redirect the CAT output to any channel and you may specify a file
name which may contain wildcards to show only matching files.
If the command ends with a '!' then an abbreviated catalogue is shown,
containing just a list of (matching) file names.
To LOAD/SAVE a file:
LOAD d<dn>;"filename" [CODE|SCREEN$|DATA|etc]
SAVE d<dn>;"program" [CODE|LINE|SCREEN$|etc]
where <dn> is a drive number (1-2)
<fn> is a file number (1-80)
You must specify 'S' to load a 48K snapshot and 'K' for a 128K snapshot.
Case of letters 'S' and 'K' is important.
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 this saves the DISCiPLE memory!
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<dn>' field.
Please use only DS/DD disks.
When saving CODE files, an autostart address can be specified as a third
SAVE d*;"runme" CODE 32768, 8192, 33000
so when you load it back with LOAD CODE, it will be automatically launched
with an implicit RANDOMIZE USR 33000.
Each file can be referred both through its name and its directory number, so
if file "screen" is listed as number 7 you may also enter:
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;"*" dangerous!
The ERASE command can also be used to rename a file:
ERASE d1;"oldname" TO "newname"
To format a disk, use:
FORMAT d1 double density (250 Kbit/sec)
FORMAT sd1 single density
GDOS also extends streams, so that you can redirect a stream to a file and
vice versa. If you open a channel for writing to a disk file, then an OPENTYPE
file is created. Opentypes can be more than 64K in length.
Channels are accessed with the usual PRINT, INPUT, INKEY$, etc. commands.
OPEN #5;d1;"temp" OUT open for writing only
OPEN #5;d1;"temp" IN open for reading
MOVE #3 TO #4
MOVE #4 TO d1;"temp1"
MOVE d1;"temp2" TO #4
Note that disk-mapped channels are buffered, so data is read/written to
disk only when the 512 bytes buffer is empty/full.
When accessing BASIC, CODE, DATA and SCREEN$ files through streams, remember
that these files start with a 9 bytes header and the actual data starts at
To copy a file into another, use:
SAVE d1;"file1" TO d2;"file2"
Since the SAVE TO command uses all the RAM available, when it has finished a
system reset occurs.
You can LOAD/SAVE single disk sectors with this syntax:
where 'd' is a drive number (1 or 2)
't' is the track number (0..79 + 128 if side 1)
's' is the sector number (1..10)
'address' is the address of the 512 bytes buffer
For example, you may read the first sector of the disk (which holds file
descriptors number 0 and 1) with LOAD @1,0,1,40000.
DISCiPLE GDOS recognizes the Microdrive syntax, so you can enter commands
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.