DEV_DEVICE and DEV_USE
Banger, Gwynedd, GREAT BRITAIN- Dilwyn Jones

Many QL users now have access to level 2 directories on
their systems, either through hard disks or through using HD
or ED disks.  It is easy enough to put software into these
directories to make sure that individual disks or drives
don't become cluttered with masses of small programs.  But
many QL programs were written by users who had no hard disk
or level 2 filing systems and not many programs give you the
facility to set up a program to work with sub-directories.
The Gold Card manual hints at a way of doing this with the
DEV device and DEV_USE commands, but doesn't really make it
obvious because the clue is hidden amid the level of detail
and options available.  Read the notes about the DEV device
in the manual first, then read this article and try it with
the short example below.

Quite simply, copy the program's files into a subdirectory,
use the DEV_USE command to assign default directories and
finally rename the DEV device to respond to the usual FLP1_
and FLP2_ devices recognised by most software, in other
words to 'magically' make the software work from hard disk
or other subdirectory without change!

Take as an example Quill. Since Quill users tend to generate
a lot of text files, it would be nice to be able to put
Quill files into their own little 'slot' or 'folder' on the
drive, so that extensive lists of files are only shown when
we want them. We can create 2 directories like this:

     MAKE_DIR WIN1_QUILL_

The program files live in WJN1_QUILL_QUILL.  We can create a
sub-directory to keep all the text files within.

     MAKE_DIR WIN1_QUILL_DATA_

Therefore our text files could be saved as
WIN1_QUILL_DATA_letter_doc, for example. NO IT COULDN'T -
Quill won't allow long names like that! Here is where the
DEV device comes in use.

Essentially what we now do is to leave the software itself
alone and so it will normally only try to load and save to
and from FLP1_ and FLP2_.  But the QL will automatically
change these names so that they appear to be WIN1_QUILL_ and
WIN1_QUILL_DATA respectively, giving a nice simple automatic
way of using directories with minimum effort from the user
and no need to make tricky changes to software.

We can set up two DEV devices, one to access the help files,
printer driver and so on. Assuming you have configured Quill
to load HELP files from FLP1 , to access its PRINTER dat
driver file from FLP1_, to load and save files from FLP2
and so on, it will now fetch them from the directories

100 DEV_USE 1, WIN1_QUILL
110 DEV_USE 2, WIN1_QUILL_DATA
120 DEV_USE'FLP'

Therefore, every time you tell Quill to save a file as
'FLP2_LETTER_doc' it will actually become
WIN1_QUILL_DATA_LETTER_DOC. Every time you ask Quill to list
files on FLP2_, it will actually list files on
WIN1_QUILL_DATA_.

You need to save a short basic program like that for each
program, which is a lot less work than modifying all your
programs.  Use it in place of a normal boot program (rename
the normal boot program to 'BOOT2' for example, and save
this as a BOOT (in the relevant directory).

ONE PROBLEM REMAIMS. You can't use the floppy disks now! Any
reference to FLP1_ and FLP2_ is automatically made a
reference to the hard disk.  The answer is to rename the
floppy drivers too since you won't be using them very much
when using hard disks. Try the command FLP_USE 'fdv' to
rename the floppy disks from FLP to FDV (FDV as opposed to
MDV for microdrives).  So you can access the floppy drives
using FDV1_ and FDV2_ instead of FLP1_ or FLP2_.

This is something which will take time to understand and
master, but it can't be explained any simpler than this.
Clearly there will be exceptions, programs which will fail
to work (e.g. protected microdrive software) and some
programs will need more than two DEVs set up, but at least
here is a working example which shows how simple it can be!
Oh yes, don't forget to reset the devices after using the
program with the command DEV_USE 'DEV' and possibly FLP_USE
'FLP' if you have used that too.

(NOTICE: Ensure you reset settings to NORMAL when leaving
the program in use.  The "DEV USE" by itself will cancel the
DEV setting.  Failing to cancel settings will affect your
next program. )



"PATHS" ON THE QL
Banger, Gwynedd, Great Britain - Dilwyn Jones

Following on from the article above using the DEV device on
Gold Cards to adapt software to run from subdirectories on
ED disks or from hard disks, I now present the second part
of this treatise on DEV. This time I show how to use it to
implement a facility along the lines of PATH on a PC.

What this means is that in effect you can type in LOAD
'myprog' without having to remember or set the subdirectory
name.  Great eh?  So why hasn't anyone told us about this
before?

Basically, it needs the combination of two facilities
available on the Gold Card.  It will normally only work with
software which uses the Toolkit 2 DATA_USE or PROG_USE
defaults.  BASIC is a good example of this - you can make
excellent use of this facility just by using the LOAD or
EXEC command.  Be a little wary of using SAVE etc in this
way because you may never know just where the file was saved
to!!!

The Gold Card manual explains that by using a third
parameter in the DEV_USE command, you can create links in a
chain of DEV device names.  So if you try to load from DEV1_
and it fails, it will also try the DEV2_  name and so on.
Now by making the Toolkit 2 defaults point to the DEV
device, we can make the system look through up to 8
directories to find the file we want!

The example below is only a simple example and I'm sure you
will adapt it to your requirements.  It is shown for hard
disks only (simply change WIN1 to FLPI for use with ED
floppy disks for example) with 7 subdirectories for commonly
used programs.


100 REMark further uses of DEV with sub directories
110 REMark this emulates the PATH facility of the PC
120:
130 REMark set up an 8 link DEV chain for common program
directories
140 REMark change these to whatever you normally use
150 DEV_USE 1,WIN1_,2
160 DEV_USE 2,WIN1_QUILL_,3
170 DEV_USE 3,WIN1_ARCHIVE_,4
180 DEV_USE 4,WIN1_ABACUS_,5
190 DEV_USE 5,WIN1_EASEL_,6
200 DEV_USE 6,WIN1_PERFECTION_,7
210 DEV_USE 7,WIN1_TEXT87_,8
220 DEV_USE 8,WIN1_BASIC_
230 :
240 REMark make Toolkit 2 defaults look through DEV chain
too
250 DATA_USE dev1_
260 PROG_USE dev1_
270:
280 REMark all references now to LOAD myprog or EXEC archive
for
290 REMark example will load or exec the program wherever
it's hiding!
300 REMark only works with software which checks Toolkit 2
defaults,
310 REMark obviously and is best not used when saving.

Suppose you try to load WIN1_BASIC_myprog_bas, but couldn't
remember where it had been saved.  You could, after running
that program, use LOAD 'myprog_bas'.  The QL would try to
load it as just that, and fail.  Normally this would give an
error such as 'not found'.  But first the QL adds the
ToolKit 2 default before trying again as LOAD
DEV1_myprog_bas.  This would be the same as LOAD
winl_myprog_bas.  But it is not found there and LOAD looks
set to give up.  But the QL notices that there is a link
from DEV1_ setting to DEV2_ setting.

So the QL now tries as WIN1_quill_myprog_bas.  And fails
again!  But there is another link to the Archive directory.
So the QL tries WIN1_archive_myprog_bas. This fails and it
tries all the links in the chain until WIN1_basic_myprog_bas
and finally succeeds!

You may well be thinking that this can be slow, looking for
various directories. It is not too bad on a hard disk or an
ED disk, but it does become slow if there are accesses to
drives which contain no floppy disks (and on my system makes
an awful noise for ages trying to access the disk, I don't
suggest you try it!!!).

The simple answer to the problem of speed of search is to
put the most commonly used subdirectories at the start of
the list.  So if the two greatest uses you make of your QL
are to use the word processor and SuperBasic, make those
into the DEV1_ and DEV2_ settings.
 
You may also like to experiment with DEV_USE 'FLP' as hinted
in the previous article to this work with software which
does not support toolkit 2 defaults, but be very careful
saving, it is all too easy to lose files by accidentally
storing them in the wrong directory!

While experimenting, what I did to prevent the risk of
trashing the hard disk was to use a formatted ED disk or
ramdisk, with the FLP or ram driver renamed as WIN with the
FLP_USE WIN or RAM_USE WIN commands.

I created the directories required to experiment with the
MAKE_DIR command, copied a few files into them, and renamed
the device with FLP_USE WIN or RAM_USE WIN.  By now, I had
devices renamed, devices which were ignored and defaults and
chains all over the place and had myself totally confused by
the end of it all, even though I'd managed to learn enough
to get it to work, what I didn't like was the thought of
unravelling everything again!

Please note the warning in the Gold Card manual - "it is
easy to become confused about the settings". You need a
clear head to keep track of what's going on, so if in doubt,
don't use this facility even though it is potentially useful
when used with care!

Although this is only useable on the Gold and Super Gold
Cards, users with other interfaces such as Trump Card which
do not support the DEV device can use fairly similar
utilities called PATH and SUB written by ex-quanta chairman
Phil Borman. These are available from Quanta's software
library.

    Source: geocities.com/svenqhj