+3e Commands

All of the features provided with the +3e can be accessed using new commands added into +3 BASIC. The current commands are listed below:

Low-level commands
Partition management
Drive mapping
Streams and channels
Miscellaneous commands

Note that all "permanent" settings stored on your hard disk can be bypassed by holding down the CAPS SHIFT key when switching on the +3e.

__________________________________________________________________

FORMAT TO unit,maxpart#[,cyls]

Use this command to format your hard disk so that it can be used by the +3e. Once you have done this, you can use the NEW commands to create some partitions. The command requires the following parameters:

unit
The hard disk unit to format; this is 0 for the master drive, and 1 for the slave drive.
maxpart#
The maximum partition number (0-65535). This limits the number of partitions you will be able to create. Choose carefully, since too few partitions and you won't be able to easily manage your hard disk; too many will slow down certain commands. It's probably sensible to work out how many partitions you can fit on your disk (16Mb is the maximum partition size) and double this number.
cyls
An optional parameter limiting the number of cylinders to use. If this option is specified, then the first sector will not be overwritten, allowing the disk to be shared between IDEDOS and PC partitions (or with FATware if you are using a divIDE interface). See the disk sharing section for details.

Examples

FORMAT TO 0,15

Formats the master drive with a maximum partition number of 15, for exclusive use by the +3e.

FORMAT TO 1,31,300

Formats the slave drive with a maximum partition number of 31, using only cylinders 0-299. This disk can be shared with PC/Mac/Linux machines, or with FATware on the divIDE interface.

__________________________________________________________________

CAT [#stream] TAB [EXP]

This command displays a listing of the drives attached to your +3e (together with the number of cylinders, heads and sectors). If the hard disk(s) have been formatted by the +3e, this will also show a list of all the partitions on the drive. As with the +3's standard CAT command, you can send the catalog to any stream (eg #3 for the printer). If a drive letter is shown next to a partition, this indicates that it has a permanent assignment, and the partition will be assigned to this letter automatically on boot.

By specifying the optional EXP keyword, you can get an expanded catalog, showing the starting and ending positions of each partitions (this is not usually useful, however!).

Examples

CAT TAB

Displays a listing of the partitions on your hard disks.

CAT #3 TAB EXP

Sends an expanded listing of the partitions on your hard disks to stream 3.

__________________________________________________________________

NEW DATA part$,size

Creates a new partition ready for +3DOS to use. It requires the following parameters:

part$
The name of the partition you want to create. Names are not case-sensitive, and can be up to 16 characters in length. You can include "0>" or "1>" immediately before the name to specify whether the partition should be created on the master (0) or slave (1) drive; if this is missing, the master drive is assumed.
size
The required size of the partition in megabytes, or Mb (1-16).

Examples

NEW DATA "0>Games",16

NEW DATA "My Documents",16

Creates two 16Mb partitions on the master drive, called Games and My Documents.

__________________________________________________________________

NEW EXP part$,size

Creates a new swap partition. Swap partitions are available for the +3e system and application programs to use as an extension to normal memory; they cannot be used for storing files or data. It is recommended that you create two swap partitions on your master drive, both of around 1-4Mb in size.

Parameters are identical to those used in the NEW DATA command.

Example

NEW EXP "swap1",4

Creates a 4Mb swap partition on the master drive.

__________________________________________________________________

MOVE part$ BIN

Deletes the partition specified by part$. Doing this will destroy all files that were stored on the partition!

Example

MOVE "Utilities" BIN

Deletes the partition named "Utilities" from the master drive.

__________________________________________________________________

MOVE part$ FOR name$

Renames the partition specified by part$ as name$. Note that the new name should not include a drive unit number, otherwise this will be included as part of the name.

Example

MOVE "1>Utilities" FOR "Utils"

Renames the partition named "Utilities" on the slave drive to "Utils".

__________________________________________________________________

CAT [#stream] ASN

This command displays a listing of your current drive mappings. The display shows the drive letter followed by the partition currently mapped (using 0> to denote the master drive, and 1> to denote the slave drive). Floppy drives and the RAMdisk are also shown; these are devices numbered 2> (internal floppy), 3> (external floppy) and 4> (RAMdisk).

As with the +3's standard CAT command, you can send the catalog to any stream (eg #3 for the printer).

Examples

CAT ASN

Displays a listing of your current drive mappings.

CAT #3 ASN

Sends a listing of your current drive mappings to stream 3.

__________________________________________________________________

MOVE drive$ IN part$ [ASN]

With this command, you map a drive letter to any (data) partition on your hard disk. You can then access the new "drive" in the same way you would with any other drive.

You can use any drive letter, A-P, provided it is not already in use, and each partition can only be mapped to one drive letter at a time. One final limitation in the current release of the ROMs, is that only two partitions can be mapped at any one time.

It is also possible to map the internal and external floppy drives, and the RAMdisk to any drive letter (provided you have unmapped them from A:/B:/M: with the MOVE...OUT command first). To do this, just use the physical device code instead of a partition name. These codes are as follows:

2>
Internal floppy drive
3>
External floppy drive (if you have only an internal drive, you can still use this device number, and will be asked to change disks as necessary)
4>
RAMdisk (note that some applications expect to find a drive M:, so if moving the RAMdisk to a different drive it is advisable to map a hard disk partition to drive M:)

Finally, by using the ASN option, you can make this assignment permanent (ie, it will automatically be set up every time you turn the +3e on). This is only effective if you have a hard disk.

Examples

MOVE "C:" IN "Games"

Maps drive C: to the partition named "Games" on the master drive. It is now possible to use drive C: in +3 BASIC commands, such as COPY "A:*.*" TO "C:" and CAT "C:"

MOVE "D:" IN "4>" ASN

Maps drive D: to the RAMdisk, and makes this assignment permanent.

__________________________________________________________________

MOVE drive$ OUT [ASN]

Removes the current mapping from the drive specified, leaving the drive letter free to be assigned to any other partition. It is also possible to unmap drives A:, B: and M: in this way, so that you can map them to a hard disk partition with the MOVE...IN command. The physical floppy drives and RAMdisk can be reassigned to other drive letters if you wish.

By specifying the ASN option, you can remove any permanent assignment for this drive letter, so that it is no longer automatically set up when you turn the +3e on.

Examples

MOVE "C:" OUT

Removes the previous mapping from drive C:, which can now be mapped to a different partition if required.

MOVE "B:" OUT ASN

Unmaps drive B:, and ensures that nothing will be mapped to this letter next time you switch the +3e on.

__________________________________________________________________

LOAD drive$ [ASN]

SAVE drive$ [ASN]

VERIFY drive$ [ASN]

MERGE drive$ [ASN]

These commands can now be used with the ASN option, which specifies that the new default drive assignment should be made permanent (ie, it will be set every time the +3e is switched on). This is only effective if you have a hard disk.

Additionally, VERIFY and MERGE now work in the same way as the LOAD drive$ command, so that they set the current default (load) drive for +3 BASIC.

Examples

VERIFY "C:"

Sets the current default drive to C.

LOAD "E:" ASN

Sets the current default drive to E, and makes this assignment permanent.

__________________________________________________________________

OPEN #n, f$

The streams and channels system of the +3e has been extended, and it is now possible to open streams to channels other than the three standard ones. The stream number n should be between 0 and 15; altering streams 0-3 will change the behaviour of the system and should be used with care. For further details, please see the extended channels documentation, which also contains a demo of the window channels.

The channel name f$ can be any of the following (capitals or lower-case letters may be used):

"K"
The standard input channel (keyboard and lower screen). Streams 0 & 1 are normally set to this channel.
"S"
The standard output channel (main screen). Stream 2 is normally set to this channel.
"P"
The standard printer channel (serial or parallel). Stream 3 is normally set to this channel.
"I>filename"
This opens an input-only stream to an existing +3e file. If the filename is at least two characters long, you can omit the "I>" as this will be assumed (single-character names require the "I>" as otherwise they will be assumed to be standard channel names).
"O>filename"
This creates a new +3e file and opens an output-only stream to it.
"U>filename"
This opens an existing +3e file and opens an input/output-stream to it.
"M>address, len"
This opens an input/output channel to the memory area at address, length len.
"V>x$"
This opens an input/output channel to the variable x$ which must be a character array with a single dimension, large enough to hold everything that will be output to it/input from it.
"W>line, col, ht, wid [, csize [, cset] ]"
This opens an output-only channel to a text window on the screen, starting at character position (line,col), with a height of ht character rows and a width of wid characters. Optionally, a character size (csize) may be specified (3-8); this does not affect the definition details of the window, which are always specified in 8-bit wide characters. A user-supplied character set may also be specified, loaded at address cset.

Once a stream is opened, it can be used with the standard INPUT # and PRINT # commands, as well as the additional stream commands below.

NB: The INPUT # command currently does not work properly with file channels. However, you can simulate this command using the new NEXT # command below.

Examples

OPEN #4,"o>a:test.txt"

Creates a file named test.txt on drive A: and opens an output-only channel to it, connected to stream 4.

OPEN #5,"stuff"

Opens an existing file named stuff on the default drive and opens an input-only channel to it, connected to stream 5.

__________________________________________________________________

CLOSE #n

Closes the channel attached to stream n. If n is 0-3, then the default channel for that stream is re-attached to it. Note that the bug in the standard Spectrum has been corrected, and it is now safe to "close" streams that are already closed.

Examples

CLOSE #4

Closes the channel attached to stream 4.

__________________________________________________________________

RETURN #n, var

This command returns the current position of stream n and stores it in variable var. This is not supported on standard channels, which will fail with an invalid I/O device error.

Examples

RETURN #4,fpos

Stores the current fileposition for stream 4 into the variable fpos .

__________________________________________________________________

DIM #n, var

This command returns the extent (or size) of stream n and stores it in variable var. This is not supported on standard channels, which will fail with an invalid I/O device error.

Note that on the +3e, filesizes are always a multiple of 128 bytes.

Examples

DIM #4,fsize

Stores the size of the file attached to stream 4 into the variable fsize.

__________________________________________________________________

GOTO #n, m

This command sets the current position of stream n to m. This is not supported on standard channels, which will fail with an invalid I/O device error.

Examples

GOTO #4,fpos

Sets the current fileposition for stream 4 to fpos.

__________________________________________________________________

NEXT #n, var

This command gets the next character of input from stream n and stores it in the variable var. If used on the standard "K" channel, this is similar to the INKEY$ function, except that it always waits for the next character to become available (ie on the "K" channel, it waits for a keypress).

You can use this command to simulate the INPUT # command for file channels.

Examples

NEXT #0, x

Waits for the next character of input from stream 0 and stores it in variable x.


  9000 LET a$=""
  9010 NEXT #5,c
  9020 IF c=13 THEN RETURN
  9030 LET a$=a$+CHR$ c
  9040 GO TO 9010

The above subroutine inputs a string from stream 5 and returns it in a$ .

__________________________________________________________________

SPECTRUM f$

This command loads a snapshot file in the popular .Z80 or .SNA format and runs it. Both 48K and 128K snapshots are supported. A small amount of the screen will be corrupted by the snapshot loading process - this is normal, and should not cause a problem unless the snapshot has code in the screen area.

Note that snapshot loading is only supported from hard disks/compactflash cards, not floppy disks. If you are using the +3e ROMs on a floppy-only system, you should instead use the snapshot loading programs on the software page.

Examples

SPECTRUM "trapdoor.z80"

Loads the "trapdoor.z80" snapshot from the default drive.

SPECTRUM "c:bounder.sna"

Loads the "bounder.sna" snapshot from drive C:.

__________________________________________________________________

SPECTRUM INK i [ASN]

SPECTRUM PAPER p [ASN]

SPECTRUM BRIGHT b [ASN]

SPECTRUM FLASH f [ASN]

These four commands set the colours for the +3 Editor screen, allowing you to type programs in to the colour-scheme of your choice.

Using the ASN option, makes the new +3 Editor and +3 BASIC colour scheme permanent, so that these colours will be used whenever you switch the +3e on (this is only effective if you have a hard disk).

Examples

SPECTRUM INK 4:SPECTRUM PAPER 0

Sets the +3 Editor colours to green ink on black paper.

SPECTRUM PAPER 1:SPECTRUM INK 6 ASN

Sets the +3 Editor colours to yellow ink on blue paper, and then makes these colours the default on booting the +3e, together with whatever the current +3 BASIC colours are.

__________________________________________________________________

SPECTRUM ATTR n [ASN]

Similarly to the previous colour commands, this sets the colours for the +3 Editor screen, but allows you to specify all attributes in one go. For ink i, paper p, bright b and flash f, the value is calculated as: n=(128*f)+(64*b)+(8*p)+i

Again, the ASN option sets both the +3 Editor and +3 BASIC colours that will be used every time the +3e is switched on.

Examples

SPECTRUM ATTR 4

Sets the +3 Editor colours to green ink on black paper.

SPECTRUM ATTR 14 ASN

Sets the +3 Editor colours to yellow ink on blue paper, making these colours (and the current +3 BASIC colours) permanent on boot.

__________________________________________________________________

Back to ZX Spectrum +3e homepage