ResiDOS Command Reference

The following is a complete list of commands currently provided by ResiDOS. "Hard disk" refers to hard disks, CompactFlash cards or SD/MMC cards (depending upon your interface).

Note that this reference does not include commands provided by optional packages, such as TapeIO and the ZX80/ZX81 emulators. Please see the package instructions for information on the commands that they provide.

For all commands, the % characters are optional. They're only required if the command would otherwise be accepted by BASIC (eg, in most BASICs, LOAD "name" would load a program from tape, so you need to use LOAD %"name" to load a program from disk or card). For BASICs which use keyword entry (eg standard Spectrum BASIC), it's usually convenient to start commands which don't have a keyword with %, simply to take the Spectrum out of K mode and into L mode. On single-character-entry BASICs like SE BASIC or Gosh Wonderful there's no need to bother with the leading %.

For commands which simply display some information (ie CAT, DIR, ROMS, PARTITIONS, MAP) you can redirect the display to any stream by specifying a stream number after the command name (but before any parameters). For example:


Disk management commands

%DRIVE unit, cyl, head, sec
Specifies the parameters (number of cylinders, heads and sectors) of your hard disk. "Unit" is 0 for the master drive, or 1 for the slave drive. Only needs to be done if the auto-detection fails to work.
%DRIVE unit, 0, 0, 0
Disables any detection of "unit" altogether. This might help improve boot speed slightly if, for example, you never have a slave drive attached.
%DRIVE unit
Changes "unit" to use auto-detection again, rather than manually set parameters.
%DRIVES
Unmaps all current drives and re-initialises IDEDOS (causing disks to be re-detected, and drives mapped back again), without losing any of the program or data currently in memory. This is useful to allow swapping of compactflash cards while the Spectrum is still on.
%REFORMAT unit, maxpartition
Completely erases the hard disk (unit=0 for master, 1 for slave) and initialises it with the IDEDOS structure. Following this, you will be able to use the partition management commands to add partitions for storing data on the disk. The maxpartition number is approximately the total number of partitions you will be able to create; don't make this too large (hundreds of partitions), or other disk management routines will be too slow. Don't make it too small, or you may not be able to create all the partitions you want (some partitions are used to keep track of free space, etc). Suggested values are between 15-63.
%REFORMAT unit,maxpartition,cyls
Same as the previous command, but limits IDEDOS to using the first cyls cylinders on the disk, allowing it to be shared with other filesystems (such as FAT, used by PCs and the optional FATfs package).

Partition management commands

Note that some commands in this section only work with an IDEDOS drive (formatted with the %REFORMAT command. For other filesystems (eg with the optional FATfs package) it may not be possible to create, delete or rename partitions; see the documentation for the filesystem package for details of what it supports.

%PARTITIONS
Displays a list of all the partitions on your disk.
%PARTITIONS+
Displays an expanded listing of all the partitions on your disk, including their physical positions on the disk.
%PARTITION "name",size
Creates a new data partition on your disk, for storing files. Partition names are not case-sensitive, and can be up to 16 characters long, and include a unit identifier ("0>" or "1>"). The maximum partition size is 16Mb. Sizes can be specified in kilobytes (numbers larger or equal to 256), or megabytes (numbers up to 255).
%PARTITION "name",size,2
Creates a swap partition on your disk for temporary use by the Spectrum. These are not currently used by ResiDOS itself, but may be used by applications in the future. The maximum partition size is 16Mb. Sizes can be specified in kilobytes (numbers larger or equal to 256), or megabytes (numbers up to 255). (NB: In fact, you can specify any partition type in this command, but only 2 (swap) and 3 (data) are useful types).
ERASE % "unit>name"
%ERASE "unit>name"
%ERA "unit>name"
%DEL "unit>name"
Deletes a partition, together with all the files it contains. This can only be done if no drive is currently "mapped" to it. The unit identifier must be present in this command.
%REN "unit>name","newname
Renames a partition. The unit identifier must be present in the original name in this command.

Drive mapping commands

%AUTOMAP+
Turns automatic drive mappings on.
%AUTOMAP-
Turns automatic drive mappings off.
%MAP
Displays a list of the current drive mappings.
%MAP "drive","name"
Maps a drive ("A:" to "P:") to the partition specified. A maximum of 6 drives can be mapped at any time.
%MAP+ "drive","name"
Maps a drive, and makes the assignment permanent, so it will automatically be restored each time you switch on.
%UNMAP "drive"
Unmaps the drive ("A:" to "P:") specified.
%UNMAP+ "drive"
Unmaps a drive. Additionally, removes any permanent assignment for the drive.

Drive, directory and path commands

%CD "location:path"
Makes the specified location and path the default. The location can be a user area (0-15) or a drive (A-P), or both. The path can be any list of directories (seperated with / or \ characters) from the current directory. If you don't specify all of these, the current default for the others will be retained. Any filenames that don't include a drive letter, user area or path will now refer to these defaults.
%CD+ "location:path"
Makes the specified location and path the default, and makes this permanent so that it will also be the default on startup. Each drive can have its own default path. If you don't set any defaults, then the root directory and user area 0 on drive A: will be used when you switch on.
%MD "directory"
%MKDIR "directory"
Creates a directory.
%RD "directory"
%RMDIR "directory"
Removes a directory (it must be empty).
%PWD
Prints the current working drive, user area and directory.

File management commands

CAT %
%CAT
%DIR
Shows a list of all files on the default drive in the default user area.
CAT+ %
%CAT+
%DIR+
Shows an expanded listing of all files on the default drive in the default user area.
CAT % "filespec"
%CAT "filespec"
%DIR "filespec"
Shows a list of files that match the file specification provided. This can include a user area, drive, filename, extension and wildcard characters (* and ?).
CAT+ % "filespec"
%CAT+ "filespec"
%DIR+ "filespec"
Shows an expanded listing of files that match the file specification provided.
LOAD %"filename"
Loads a BASIC program from hard disk.
LOAD %"filename" CODE
Loads a CODE file from hard disk. If the file came from another system (ie was not SAVEd by ResiDOS or a +3/+3e), then the default load address will be 32768.
LOAD %"filename" CODE a
Loads a CODE file from hard disk at a specific address.
LOAD %"filename" CODE a, l
Loads a CODE file from hard disk at a specific address, and with a specific length.
LOAD %"filename" SCREEN$
Loads a screen from hard disk.
SAVE %"filename"
Saves a BASIC program to hard disk.
SAVE %"filename" LINE n
Saves an auto-starting BASIC program to hard disk.
SAVE %"filename" CODE a, l
Saves a CODE file to hard disk.
SAVE %"filename" SCREEN$
Saves a screen to hard disk.
%SNAPLOAD "filename"
Loads a standard .SNA or .Z80 snapshot from hard disk.
%SNAPLOAD+ "filename"
Loads a standard .SNA or .Z80 snapshot from hard disk. Overwrites a small amount of screen (instead of stack memory), which aids compatibility with some snapshots.
%SNAPLOAD- "filename"
Loads a standard .SNA or .Z80 snapshot from hard disk. Starts the snapshot with the built-in ROM, which aids compatibility with some snapshots.
%SNAPLOAD+- "filename"
Loads a standard .SNA or .Z80 snapshot from hard disk. Uses the screen and the built-in ROM, which aids compatibility with some snapshots.
LINE %"filename", line
Changes the auto-run line number for a BASIC program. If the line provided is 0, auto-running is disabled for the program.
ERASE % "filespec"
%ERASE "filespec"
%ERA "filespec"
%DEL "filespec"
Erases a file from the hard disk. The filespec can include wildcards to erase multiple files at once.
%REN "filename","newname"
Renames a file (wildcards are not allowed). This command can be used to change the user area a file is located in (but not the drive).
%ATTRIB "filespec","+attrib"
Adds the attribute (P=protected, S=system or A=archive) to the file (or group of files) specified.
%ATTRIB "filespec","-attrib"
Removes the attribute (P=protected, S=system or A=archive) from the file (or group of files) specified.
%CP "filename","filename2"
Copies a single file to a new file, which may be in the same location, or a different one.
%CP "filespec","location:"
Copies one or more files (if using wildcards) to another location.

Customisation commands

INK % n
Sets ink colour to n and saves the current colour scheme as the default.
PAPER % n
Sets paper colour to n and saves the current colour scheme as the default.
BRIGHT % n
Sets bright to n and saves the current colour scheme as the default.
FLASH % n
Sets flash to n and saves the current colour scheme as the default.
ATTR % n
Sets attributes to n and saves them as the default colour scheme.
%AUTORUN "filename"
Sets the autorun file, which will only be executed with %AUTORUN.
%AUTORUN+ "filename"
Sets the autorun file, which will be executed automatically on boot, or with %AUTORUN.
%AUTORUN-
Removes any autorun file setting.
%AUTORUN
Loads and runs the autorun file.
%SPEED n
Sets the processor speed to n. Supported only on ZX-Badaloc, where n is 0 (3.54MHz), 1 (7MHz), 2 (14MHz) or 3 (21MHz). Add 4 to enable the clock/screen/interrupt doubler (gives speed up to 42MHz).
%SPEED+ n
Sets the processor speed to n and makes this the default speed when starting up.
%SPEED- n
Sets the processor speed to n and removes any default speed, so the standard system speed is used when starting up.

ROM management commands

%INSTALL "filename"
Installs a file from the hard disk to the interface memory as a package or an Interface II-type ROM. NB: you must first CLEAR 32767 or lower.
%INSTALL "filename",n
Installs a file image from the hard disk to the interface as a type "n" ROM. NB: you must first CLEAR 32767 or lower. Values for "n" are made as the sum of the following, and are ignored for packages:

%INSTALL "name"@addr

%INSTALL "name"@addr,n

As the previous commands, but indicates that the ROM image is already loaded into memory at the specified address and does not need to be loaded from a file. The name refers only to the name that will be given to the ROM when it is installed. NB: you should CLEAR to an address lower than addr before loading the image to memory and then executing the %INSTALL command.
%ROMS
Shows a list of all installed ROMs.
%ROMS+
Shows a list of all installed ROMs, including hidden system ones.
%UNINSTALL"name"
Uninstalls a ROM.
%ROM "name"
Restarts computer using selected BASIC or Interface 2 ROM.
%ZX
Restarts computer using internal ROM, effectively disabling the interface.

Spectrum mode commands

%SPECTRUM
Switch 128K Spectrum into 48K mode until the next time the computer is reset.
%SPECTRUM+
Always run in 48K mode, even after a reset.
%SPECTRUM-
Turns off permanent 48K mode (you'll need to reset to return to 128K mode).

ZXATASP: OUT 671,192:OUT 671,128

ZXCF: OUT 4287,128

ZXMMC+: OUT 127,0

ZX-Badaloc: OUT 21727,0

divIDE Plus: OUT 23,0

Disables ResiDOS, whilst keeping the current program in memory.

ZXATASP: OUT 671,64:OUT 671,0

ZXCF: OUT 4287,64

ZXMMC+: OUT 127,192

ZX-Badaloc: OUT 21727,200

divIDE Plus: OUT 23,104

Re-enables ResiDOS, whilst keeping the current program in memory.

Error-trapping commands

%ONBREAK THEN CONTINUE
Turns on BREAK-trapping. The THEN is optional.
%ONBREAK OFF
Turns off BREAK-trapping.
%ONERR THEN GOTO line
Turns on error-trapping. If an error occurs, control is transferred to the line indicated. The THEN is optional.
%ONERR THEN GOSUB line
Turns on error-trapping. If an error occurs, control is transferred to the line indicated. When a RETURN is encountered, execution continues at the statement after the error occurred. The THEN is optional.
%ONERR OFF
Turns off error-trapping.
%REPORT
Reports the last error that was trapped.

Error-trapping functions

FN %ERR()
Gives the error number of the last error that was trapped.
FN %ERL()
Gives the line number of the last error that was trapped.
FN %ERS()
Gives the statement number of the last error that was trapped.

Channel commands

OPEN # stream, c$
Opens a stream (0..15) to the channel specified by c$. This may be a standard channel ("K", "S" or "P") or a new channel provided by a package.
CLOSE # stream
Closes a stream (0..15). If the stream is in the range 0..3, the original default channel assignment is restored.
POINT # stream, pos
Sets the current pointer position of the stream to pos.

Channel functions

FN %PTR#(stream)
Returns the current pointer position of the stream specified.
FN %EXT#(stream)
Returns the extent (size) of the stream specified.

Back to the ResiDOS home page