DEV_USE

Syntax

DEV_USE n,drive [,next_dev] n=1..8 or

DEV_USE [n](SMS v2.70+ only) or

DEV_USE [drivetype]

Location DEV device, GOLD CARD, ST/QL, SMS

The DEV device is a universal method of driving devices (MDV, FLP, WIN, MOS, ROM), and thus allows old software to recognise default devices/ sub-directories as well as simplifying the use of them. It also introduces fully programmable search paths to QDOS.

There are eight separate DEV drives available, DEV1_ to DEV8_, each of which can point to a real drive and directory defined with DEV_USE.

The first parameter of the command is the number of the DEV device to be defined.

The second specifies what DEVn_ represents.

There is no default and nothing is predefined, but DEV_USE permits only valid drives and directories. Any default devices (DATAD$, PROGD$ etc) are not recognised so the full directory name (including the drive name) must be stated.

There is one special second parameter, the empty string, which removes the definition of the given DEV device; there is no error reported if it was not defined.

The second syntax (SMS v2.70+) also allows you to remove a definition by simply passing the number of the DEV device to delete.

Example 1

DEV_USE 1,flp1_
DEV_USE 2,flp1_SUBDIR_
DEV_USE 3,flp1_SUBDIR
DEV_USE 4

Each time that DEV1_ is accessed, the actual drive which will be accessed is FLP1_, eg. DIR DEV1_ lists a directory of FLP1_.

However, LOAD DEV2_BOOT will load FLP1_SUBDIR_BOOT but especially note that LOAD DEV3_BOOT would try to load FLP1_SUBDIRBOOT (that’s not a typing error).

You can therefore see the importance of specifying the underscore! Whereas DATA_USE always adds an underscore to the supplied parameter if there one was not specified, DEV_USE does not. Please pay attention to this difference!

DEV_USE’s third parameter is optional and ranges from 0 to 8. This is used to specify another DEV device which should be tried if DEVn_ was accessed for a given file, but the file was not present on that DEV device.

In all other cases: if the drive in general is currently inaccessible (eg. open for direct sector read/write), the file is damaged or already in use, the DEV device will stop with the appropriate error message, and behave as normal in such situations.

Example 2

DEV_USE 1,flp1_,2
DEV_USE 2,flp1_TEST_

VIEW DEV1_Prog_bas will first try to show FLP1_Prog_bas and if it did not find that file, it will then try DEV2_Prog_bas which is actually FLP1_TEST_Prog_bas. If this also fails, VIEW stops with a ‘Not Found’ error. You might notice that this could lead to an endless search if DEV2_ was told to jump back to DEV1_ if flp1_TEST_Prog_bas also did not exist.

Example 3

DEV_USE 1,flp1_,2
DEV_USE 2,flp1_TEST_,1

Luckily, this is no problem - the DEV device never circles back to a DEV which has already been tried. So, using the definition given for example 3, VIEW DEV1_Prog_bas looks for FLP1_Prog_bas, then FLP1_TEST_Prog_bas and breaks with ‘Not Found’ because DEV1_ has already been tested.

That’s why a DEV device cannot point to another DEV device, DEV_USE 1,DEV2_ is illegal.

It is advisable to give seldom used drives and directories a lower search priority because it naturally takes a little time to scan through a directory for a file. Preferred directories and fast RAM disks (which take next to no time to check for a file) should be checked before the less often-used directories are looked at.

Example 4a

DEV_USE 1,flp2_SOURCES_,4
DEV_USE 2,flp1_COMPILER_,3
DEV_USE 3,flp1_COMPILER_UTILS_,4
DEV_USE 4,ram1_,5
DEV_USE 5,flp2_SOURCES_OTHER_,1

The search path for DEV1_ is:

  • FLP2_SOURCES_ go to DEV4_
  • RAM1_ go to DEV5_
  • FLP2_SOURCES_OTHER_ go to DEV1_, we already tried that, so stop

The search path for DEV2_ is:

  • FLP1_COMPILER_go to DEV3_
  • FLP1_COMPILER_UTILS_ go to DEV4_
  • RAM1_ go to DEV5_FLP2_SOURCES_OTHER_ go to DEV1_
  • FLP2_SOURCES_ go to DEV4_, already checked, so stop.

You see that the two search paths for DEV1_ and DEV2_ are connected in one way. This rather complicated example suggests that it would be useful to set the data and program device as follows:

Example 4b

DATA_USE DEV1_
PROG_USE DEV2_

Taking into account that Toolkit II tries the program device after failing to find a file on the data device, a VIEW TEXT will first search through the DEV1_ list and then DEV2_ (thus looking through all DEVs) while EX PROG_exe stops after checking DEV2_ and its connected DEVs.

All operations creating or deleting files will only check for the original DEV definition and ignore the optional paths. This prevents files from being unintentionally deleted or overwritten.

Given the settings of examples 4a and 4b, OPEN_IN #3,DEV1_TEXT will act as VIEW did before whereas OPEN_NEW #3,DEV1_TEXT creates FLP2_SOURCES_TEXT or reports an error/asks if you want to overwrite (if necessary).

DELETE always behaves as an exception in that it does not report an error if a file was not found.

You may have noticed that the third parameter allows a wider range than the DEV number. A zero as the third parameter simply does the same as no third parameter.

The third syntax of DEV_USE is completely different from the first two. It is analogous to the FLP_USE, RAM_USE and NFS_USE commands and allows you to use a different three letter code for the DEV device:

DEV_USE fry.

DEV1_ is now called fry1_, DEV2_ fry2_ and so on. However, you can also use existing devices.

Example 4c

DEV_USE FLP

Now, things become really complex. With examples 4a and 4b still being valid, FLP1_ actually refers to FLP1_SOURCES_, searching through all the other DEV definitions as well in order to find a file.

The definitions of DEV1_ as FLP1_SOURCES_ and DEVs as FLP do not collide. However, if you issued FLP_USE DEV, FLP1_ and DEV1_ are not known any more until FLP_USE FLP restores the default name for disk drives.

Equally, DEV_USE DEV restores the DEV name (although this can be abbreviated by a DEV_USE without any parameters).

Example 5

DEV_USE DEV1_

refers to the true DEV1_ again, DEV2_, DEV3_, …, too.

Renaming DEV has been mainly implemented to convince existing software believing that a directory file always has five letters (eg. MDV1_) to accept sub-directories of level-2 drivers as directory files, too.

NOTE

At least up to v2.01, the DEV device does not work fully on any machine. For example WSTAT lists the file names but not the other information: DEV_USE 1,FLP1_TEST_ WSTAT DEV1_

CROSS-REFERENCE

DATA_USE, PROG_USE,DEV_USE$, DEV_NEXT. DEV_USEN is the same as the third syntax on SMSQ/E. DEV_LIST lists all DEV definitions. MAKE_DIR and the DMEDIUM_XXX commands, starting with DMEDIUM_DENSITY are also interesting.