Year Of The Disc Feature

Using the DFS commands

Volume 2

Number 01

January 1984

How to use the DFS commands

NIGEL PETERS advises . . .

SO you've Finally got up the nerve and spent £300 on a DFS and disc drive. Now you've got them, how do you use them?

Well let's have the DFS come to your rescue. Type in *HELP DFS, press Return, and you'll see Table I come up on the monitor.

DFS 0.90
ACCESS <afsp> (L)
BACKUP <src drv> <dest drv>
COMPACT (<drv>)
COPY <src drv> <dest drv> <afsp>
DELETE <fsp>
DESTROY <afsp>
DIR (<dir>)
DRIVE (<drv>)
ENABLE
INFO <afsp>
LIB (<dir>)
RENAME <old fsp> <net fsp>
TITLE <title>
WIPE <afsp>
Table I

These are the DFS commands that I'll be concentrating on in this article.

I'll be ignoring normal OS commands such as *SPOOL and *SAVE and refer you to the User Guide for explanations of them.

To return to the DFS commands, you'll notice that each of the capitalised keywords like DELETE and RENAME has one or more arguments following it.

An "argument" in this context is just an additional piece of information needed by the command, and not what happened when you explained to your dear ones how much it all cost.

They're fairly self explanatory and I'll deal with each as they come up.

For the present let's just take a disc that we've formatted (with the aid of the formatter that came with the DFS) and see how it is configured.

Put a disc (any disc at all) into DRIVE 0. If you've got double drives this is usually the left hand one. If you've only got one drive then DRIVE 0 is the one you've got.

Now enter *CAT 0 and something like Figure I will appear on the display. I say "something like" because there is no guarantee that it will be identical.

Figure I

However if it's a blank disc that's just been formatted it won't be too different, if at all.

What we now have is the catalogue of the disc which tells us how the disc is configured and what is on it.

The top left item is the name of the disc. At the moment it hasn't got one but we'll remedy that later.

"Drive" is straightforward. It's the number of the drive that the disc is in. "Option" and "Library" we'll leave until later, and for the present we'll concern ourselves with "Directory".

As you'll probably already know, you LOAD and SAVE on disc in just the same way you used to do on tape.

However, on disc you're confined to only 31 files. These can have names of up to seven letters, and it can be very frustrating trying to think up meaningful names for your programs.

You tend to end up with PROG1, PROG2, and so on.

The DFS gives you a way of collecting similar programs in groups in the form of directories.

A directory is merely a single letter (or the dollar sign) placed before the program name. In effect, this is an index letter and is used to group similar programs under one prefix.

To see what I mean, type in a program - anything at all - and save it on your newly formatted disc. If you call it FRED and then *CAT 0 you'll see that the program appears on the catalogue as in Figure II. And, even though it isn't shown, it has a directory symbol.

Figure II

The reason that you don't see it is that it is the default directory that's in operation. This is the directory that prefixes all the program names with the dollar sign.

If you look at the catalogue heading you'll see that it tells you that the $ directory is in operation.

Saving a program while that directory is in operation automatically gives it $ as an index.

However it doesn't bother showing it in front of the filenames when you *CAT. After all, the heading tells you that you're in the $ directory - there's no need to repeat the information in front of every file.

If you wanted you could try LOADing $.FRED. The DFS knows exactly what you mean and will do it, even though you only saved FRED. Similarly you could save another program $.DICK and when you *CAT 0 it will just be shown as DICK.

Now you're not stuck with that directory - you can save programs under any of the 27 available. You could, if you wanted, save another program A.DICK.

The micro won't mind that the name is the same as the previous program you saved as the two programs are in different directories.

Try it and see. Notice how when you *CAT 0 you get the A directory shown with the later DICK. The DFS always shows the directory of a file if it isn't the default directory.

We'll cover how to change the default directory later, but for the time being let's stick with $. This is the one the DFS uses when you switch on, or after a Break.

Another default that you may have noticed if you have two drives is that when the micro is switched on or after Break is pressed it always goes to drive 0. This is the default drive.

If you want to work with drive 1 as the DFS's first choice then enter *DRIVE 1. To go back to drive 0 enter *DRIVE 0 or, more drastically, press Break.

Now that you know how to get to drive 1 you probably want to know how to catalogue it. As you might guess, you just enter *CAT 1. If you're lazy like me you can use abbreviations.

To catalogue the disc in drive 0 you use *.0 and for drive 1 you use *.1 as you might have guessed. Just typing in *. will catalogue the disc that's in the default drive.

So we've got our discs which we save to and load from in the usual manner. We can also see what files are on them and know about directories.

The trouble is that they get full up quite quickly as only 31 files are allowed.

How do we get rid of what we don't want?

Well, there are five ways of doing it, three intentionally and two unintentionally!

If you just want to get rid of a track you can use the *DELETE command with the name of the track you want to get rid of. In the case of FRED you would enter *DELETE FRED. This will delete the file straight away.

You could also use *WIPE FRED to get rid of FRED. This gives you a safety margin in that it asks you whether you really want to get rid of FRED. Pressing anything other than Y results in FRED not being wiped.

Another feature that WIPE has which *DELETE doesn't is that it allows the use of "wild cards". These allow you to substitute # or * for parts of a file name.

If you then operate on that pseudo filename the DFS will supply all the filenames that fit the wild cards.

It's much easier to understand with an example. Try saving a few programs on disc with similar names such as PROG1, PROGTWO, PROGOFF.

To get rid of them we could use *DELETE or *WIPE three times but using wild cards allows *WIPE PROG* to do it. The DFS will then question us for each filename, allowing us to select which files are erased and which remain.

As we've mentioned, there are two wild cards, # and *. The hash sign.#, represents just one character of the file name while the star, *, represents all the letters to the end of the file name.

Let's use a wild card to get rid of all the various PROGs. We enter *WIPE PROG*. The DFS will now go through all the PROGs on the disc and give us the option of wiping them.

As you can see from this the wild cards can save a lot of typing and time. You can use wild cards with any of the DFS commands in Table I that have afsp after them.

They also come in useful where there are several programs with the same name on different directories. Save some programs such as A.PROG, F.PROG, K.PROG. You get the choice of deleting them all with *WIPE #.PROG.

In other words, we've used a wild card to represent the directory letter. If you want to take this to its limit then try *WIPE#.* and see what happens.

As if all this isn't enough there is yet another way to get rid of unwanted files. This is the use of *DESTROY.

You use *DESTROY when you want to get rid of a group of files such as the PROGs we met before. What you do is type in *ENABLE (which is a sort of safety catch) and then enter *DES-TROY PROG*. If you make a mistake then you have to *ENABLE again before the DFS will allow you to *DESTROY.

Using *DESTROY with a wild card will result in the DFS listing all the files on the disc that fit the bill and asking "Delete Y/N". If you answer "Y" then the lot will go.

This is in contrast to *WIPE with a wild card which gives you the erase option on each file.

With *DESTROY it's all too easy to get rid of a wanted file along with the unwanted ones. For this reason I stick to *WIPE. I still make mistakes, though!

As mentioned previously there are two other ways you can get rid of files on a disc and it nearly always happens when you don't want it to.

The first is to format the disc. This will destroy all the files on it.

The second is to use the *BACKUP command which produces a duplicate of a disc. To do this you use *ENABLE (the safety catch) and then *BACKUP followed by the appropriate drive numbers.

If you were copying the disc on drive 0 to the disc on drive 1 you would enter *BACKUP 0 1. If you just have a single disc drive you would use *BACKUP 0 0 and the DFS will prompt you when to put in the source disc and the destination disc.

The trouble with *BACKUP is that if you're careless and mix up the source and destination discs you can end up with a perfect copy of a blank disc.

Also this command can use part of the micro's memory and cause you to lose whatever was in it - usually a vital Wordwise file in my case.

A milder form of *BACKUP is *COPY, which is used to copy a file from one disc to another. *BACKUP copies everything from one disc to another whereas *COPY only makes a copy of one file.

It can however use the micro's memory so, as with *BACKUP, beware if you've got anything important in it.

*COPY is simple to use. To create a copy of FRED you just use something like *COPY 0 1 FRED which copies the file FRED, which is on the disc in drive 0, to the disc in drive 1.

As it only copies FRED, not deleting the original, you end up with two FREDs, one on each disc.

If you only have one drive then *COPY 0 0 FRED will do the job for you, the micro prompting you when you have to put in the appropriate disc.

Having told you all these ways of destroying files, you might wonder if there was any way of protecting them, as they do seem rather vulnerable.

The obvious way is to put a write protect tab over the notch on the disc. This will physically stop the DFS altering the disc. The trouble is that it's not selective, all the files on the disc being shielded whether or not they are important.

To get around this the DFS has the *ACCESS command which allows you to lock a file. Suppose you had a file HARRY that you didn't want deleted. You could lock it with *ACCESS HARRY L and then *DELETE, *DESTROY and *WIPE won't touch it.

Sadly it won't protect against formatting and *BACKUP.

To unlock HARRY you just use *ACCESS HARRY, that is, you leave off the L. You'll see from the DFS command list that *ACCESS can be used with wild cards. *ACCESS *.* L will lock a whole disc. As you might guess *ACCESS *.* will unlock every file on a disc.

Locking a file will also stop you from renaming it with the self explanatory *RENAME.

If we wanted to rename a locked file HARRY with the new name TOM we would have to unlock it with *ACCESS HARRY then use *RENAME HARRY TOM.

It's quite simple to use and can help keep discs tidy and orderly.

You might have found, with all these programs going on your disc, that you've been running out of room to store things.

One way around this is to *COMPACT the disc. This tidies it up and releases extra space for new files.

To compact the disc on drive 0 you use *COMPACT 0. While this is happening the DFS displays the information about each file's structure.

Beware though, for like *BACKUP and *COPY, *COMPACT can corrupt what is already in the micro's memory.

The information displayed for all the files when you *COMPACT can also be gained by using *INFO.

To get the information about a file HARRY you just use *INFO HARRY and the display will tell you whether the file is locked, its load and starting addresses and its length. Figure III shows how it's displayed.

Figure III

During the normal course of events the DFS won't display this information about a file. You can, however change this by entering *OPT 1 1.

Now the file details will be displayed everytime it is used, rather like an automatic *INFO. To stop this just enter *OPT 1 0 and things return to normal.

To finish this tour of the DFS commands let's take a look at the catalogue again by entering *CAT (as my tabby is known).

Remember I said we could give a disc a name. To do this we use *TITLE. The name can be up to 12 letters long.

To name the disc in the current default drive EXAMPLE all we do is type in *TITLE "EXAMPLE" and press Return. Now enter *. and you'll see the name.

I also said that we could change the default directory of a disc. Usually it's $ but if we wanted (for reasons best known to ourselves) to change it to A we would enter *DIR A which makes the default directory A. Any programs we now save onto the disc will have the directory A (unless we do something about it).

Now the A won't show when you *CAT. This is because the default directory never does. What does happen is that files which were saved when $ was the default directory magically appear with $. in front of them when you *CAT after a change of directory.

Figure IV shows the catalogue of a disc named EXAMPLE. The default directory is $, the usual one after switching on or pressing Break.

Figure IV

Figure V shows the result of changing the default directory to X with *DIR X and saving a couple of more programs. You'll see that the previous programs now show their $ directory.

Figure V

The programs recorded under the new default, X, don't show their directory.

Now try entering another default directory, say *DIR Z, and you'll see the files with both $ and X directories as in Figure VI.

Figure VI

The point to remember is that the proper name of each file always includes the directory it was saved under. It just so happens that if it is the default directory it doesn't appear on the catalogue.

As you've seen, we can have files on the disc with different directories and we can save and load programs with their full name such as A.PROG1 or $.PROG2.

In fact, if the default directory of a disc is different from the directory of the file we want to load, we have to give it its full name or the DFS says it's not on the disc.

If you don't follow that then try saving a program A.GEORGE on a disc where $ is the default. Now try to load GEORGE from that disc and see where you get!

It's not only the directory that you can specify in a filename. You can even choose a drive.

You do this by putting the drive number at the beginning of a filename but after a colon which tells the DFS that the number following specifies a drive.

If you wanted to save a program EILEEN on the disc on drive 1 with the directory A then you would SAVE ":1.A.EILEEN". Try it and see.

The good thing about this is that you can use the non-default drive without having to type in *DRIVE 1 and *DRIVE 0 all the time.

Another way to get at programs that are on a disc on the non-default drive is to use *LIB. You'll have noticed something like LIBRARY:0.$ when you've catalogued a disc and probably wondered what it does.

The library tells the micro what drive and what directory to have a look at if it can't find what it's looking for on the current default drive and catalogue.

Don't worry too much if that doesn't make sense. It will when you try it in practice.

Normally the library is set to drive 0 and the $ directory. If you've got a Basic program on the disc such as BODGER, under the default directory you'll find that you can now load it with *BODGER.

This is the influence of the library, which is set to the default values. Purists say that you should use *L.BODGER or your micro might crash, but I've never had any problems.

This can be changed using the *LIB command. Before you do this, however, SAVE a few programs on the disc under another directory, for example, A.KATIE or A.PAUL.

Next change the library to the A directory on drive zero. *LIB:0.A will do this. Now the DFS has another default to look at when you want a program.

The good thing about this is that you can load programs that aren't on the current default directory without messing about changing directories.

Try it. If you want A.KATIE you can load it with *KATIE if it's a Basic program. If it's a machine code program it will actually run it for you as well.

This comes into its own when you've got two drives. You can use the first drive as normal but also you can access the second drive without having to use *DRIVE or LOAD using the full file specifications.

All you have to do is to change the library option to specify drive 1 and whatever directory you want to get at on that drive. Then just *FRED or whatever will load it from the non-default drive. It saves a lot of time and trouble.

And that's it for this tour of the DFS commands.

You'll notice that I've ignored the "option" part of the catalogue. I'll cover this in a later article when I plan to deal with all the commands you find when you enter *HELP UTILS.

As for now, I'll leave you to format a couple of discs and have fun playing around with the DFS.

It's not half as complicated to use as it is to read about.