----------------------------------- THE SHELL GAME: A Continuing Column Names: Devices, Volumes, Logical... By Brad Webb ----------------------------------- This month you'll learn about Amiga system "names". For some of the experimentation you'll need a CLI or Shell window. If you know how to get either of these on screen, skip on to the start of the tutorial. Otherwise, consider this: IF YOU'RE NEW HERE The shell and the CLI are special windows. In these windows commands and programs are run by typing, rather than by using the mouse and icons as with the Workbench. The CLI is an older, more primitive version of the shell. In this column we concentrate on the newer shell window. We examine uses of the shell itself, utilities and programs you can run from the shell, and the shell's interactions with the familiar Workbench environment. This column provides tutorials and examples to make it easier to follow. You will find a shell icon on your Workbench 1.3 disk in the window that opens when you double-click on the disk icon. Double-click on the shell icon and you have a window in which you can type the exercises and experiments from this column. If you have displayed this text by clicking on the ShellGame icon in the J: window, you can resize the PPMORE reader screen smaller to both display this text and type the commands. To resize, click on southeast corner, hold and roll mouse, then release. Move the shell window to the bottom to the screen. Click in either window to activate it. Before working any exercises, be sure you have started your Amiga with a copy of an unmodified Workbench disk. BUILDING ON LAST MONTH'S TOPIC I covered extending your Workbench space last month. One of the ways I suggested you could do that is by creating disks named LIBS: and FONTS: and pointed out the trick depended on the fact both disk names and the shorthand names assigned to the directories for fonts and libraries are similar. The obvious question is, "OK, so what do both have in common?" Let's explore that question in detail. In fact, let's expand the topic to include all the special types of names in use for parts of the Amiga computing system. When you called a floppy FONTS:, you were giving the disk a volume name. So far, that's fairly easy to understand. A disk can be thought of as a volume, like a book, of electronic information. You put the disk in a disk drive, probably either df0: or df1: The names of the drives are device names. That's not too difficult to understand either, since a floppy disk drive certainly is a device. As you look closer, you find there is one other type of name, the "logical" name. Logical in this case doesn't refer to a strict system of reasoning, but rather to the fact that the name is used as a sort of nickname. It's a name that is used by the computer's logical systems to find something else. At least, that's the best reasoning I can come up with for why this term is in use. Finally, close examination reveals there are two distinct types of the device names. The Amiga knows about and uses both hardware and software devices. We'll go over all these concepts today in some detail. Let's start on familiar ground, with floppy disks and floppy disk drives. If you've been using your Amiga for any time and are fairly comfortable with the Shell or CLI, you probably know you can obtain a list of floppy disk files by using either the DIR or LIST command. You can use a command and specify either the disk volume name, or the name of the device (floppy drive) the disk is in. The results are the same. If you think about it for a moment, that may seem just a bit strange, especially if you are used to other computers. You can't do that on an MS/DOS computer, for example. If you have a disk named DOCUMENTS in a drive on an MS/DOS machine, you must remember the device name, usually A: or B:, and use DIR only with the drive designator such as DIR A:. DIR DOCUMENTS: will return a "File not found" error. This dual method of looking at disks works because the Amiga has intelligent disk drives. They actually know what disk is in them, so if you send a command to examine a disk by name, the drive which contains that disk responds. Pretty darn clever, that. It means you don't normally have to worry which disk drive holds which disk. You can even move a disk from drive to drive and the Amiga can still find it by name. For this reason, all Amiga disks must have volume names, even if just the word "empty". HARD DISK DRIVES ARE MORE CONFUSING The principle of volume name and device name extends to hard drives too. If I use the INFO command to get a summary of the drives attached to my computer, I see a listing like this: Mounted disks: Unit Size Used Free Full Errs Status Name FAST: 39M 70811 10702 87% 0 Read/Write DH1 RAM: 62K 62 0 100% 0 Read/Write Ram Disk DH0: 606K 1245 28 98% 0 Read/Write DH0 DF0: 837K 578 1180 33% 0 Read/Write Daily_BU Volumes available: Daily_BU [Mounted] Ram Disk [Mounted] DH1 [Mounted] DH0 [Mounted] There are two partitions on my hard drive. Each has a device name and a volume name. Device names are listed under Unit in the chart above. Volume names are under Name. That's confusing enough right there, in my opinion. My main partition has the device name of FAST: (because it is formatted with the Fast File System) and a volume name of DH1:. For the other partition, the device name and volume name are the same, a fairly common situation for hard drives. If you are unfamiliar with hard drives, you should know you can take one hard drive and "logically" make it look like two or more to the computer, as I have done here. There are many reasons for doing this, but they are the stuff of another column another day. I suspect many people are confused by this dual nature of hard drive names. It makes sense if you consider that the naming convention works this way to be consistent with floppy drive and disk names. Also, there are a number of hard drives out there with replaceable disk modules. These drives work much like glorified floppy disks. This provides another reason for assigning volume names to hard disks. If you have never done so, take a few moments and type the command INFO in your Shell window. Study the display you receive, comparing it to the one shown above. There's much information there for your use. LOGICAL NAMES If we can create partitions on a hard drive and give each a separate name, can we go one step further? Can we give volume names to a part of a partition, perhaps just one directory? The answer is yes, we certainly can. Such a name is called a LOGICAL name, however, not a volume name, because it doesn't refer to a separate physical disk or drive. Even a partition on a hard drive acts like a real physical object. You cannot change your partitions without losing the data on them. Therefore, consider the names given to partitions to be real volume and device names. You can assign a logical name to any directory you wish by using the AmigaDOS ASSIGN command. If you want to confuse yourself, you can even assign a logical name to an entire disk or partition, giving it a total of three names: device, volume and logical. Actually, there is no limit to how many logical names you can assign to one directory or disk if you want to get carried away. The term "assigning a name" may be confusing. It means both creating the name and assigning it somewhere. Let's see one reason why you might want to use a logical name. In your Shell, type: dir Workbench1.3:libs OR dir Workbench2.0:libs OR dir {whatever you call your boot partition}:libs ... and press the RETURN key. If you aren't sure of the volume name of your boot partition, use the INFO command first, as described above. After issuing the command, you will see all the Amiga's operating system libraries listed on the screen. Now, type the following command (everyone uses the same command this time): dir libs: RETURN The exact same listing scrolls by. Make a mental note of a couple of items. First, the second time there was less typing. ALso, the second time there was no need to remember the exact name of the disk or partition that booted your computer. At boot time, the logical name LIBS: is assigned to the libs directory on whatever disk or partition does the booting, allowing the disk to have any name at all. As I've noted in the past, this is why you can buy a disk named SuperGameWhatever: instead of having all the disks you buy named Workbench:. A few last words before we leave the subject of logical names. There are some common logicals almost always in use. As indicated, they allow the Amiga to treat all boot disks the same, whatever they are really named. They have the secondary value of letting programmers write programs that will work on almost any machine, no matter how it is set up by the user. This means less frustration for you and quicker development time for the programmer. Everyone wins. You should probably at least see these names, in case you bump into them again someday. Here are the most important: SYS: logical name for the entire boot disk or boot partition. C: logical name for the boot disk directory containing most AmigaDOS commands. LIBS: the boot disk directory containing software data libraries for use by any program. S: the boot disk directory containing script files, including the Amiga's startup scripts. T: a directory for temporary files such as backups produced by a text editor. This directory may be on the SYS: disk or in RAM:. DEVS: on the boot disk and containing device files such as printer drivers. CLIPS: where the Amiga stores data during cut and paste operations. It is usually in RAM:. ENV: usually in RAM:. The Amiga stores special operating system variables called environmental variables here. FONTS: usually on the SYS: disk, fonts are here. There are some others, but these are the ones you are most likely to hear about. SOFTWARE DEVICES So far, I have mostly covered hardware. Computers, though, are a mixture of hardware and software. As it turns out, there are software devices working alongside the hardware ones. These software devices are special programs. Sometimes when there is a job to do with software, it is most useful to set the program up as if it were a separate, physical entity, to make the program "look" to the computer almost like a piece of hardware. Software devices are such programs. The common characteristic of these devices is how they are used. They are all programs designed to be used by other programs, sort of tools for the use of other tools. As an example, consider the SPEAK: device. It is a software device which gives the Amiga one way of making speech. You can copy a file to SPEAK: just as you copy a file to df0: The computer handles the file going to the SPEAK: program in the same way it handles a file going to df0: That means you can use Amiga commands with the SPEAK: device. Valid command lines might be "copy myfile.txt to speak:" or "type myfile.txt to speak:". Both will work to send a file of text through the SPEAK: device, producing sound. This provides a more flexible approach to making speech than does the older AmigaDOS SAY command. Like SPEAK, most of the software devices in use on Amigas are those provided with the operating system. You can use the ASSIGN command to see what software devices are available to you at any given time. Some are always made available when the Amiga boots. The standard Startup-sequence script file that is run whenever the Amiga starts makes them available. Let's take a look. In your Shell type: assign RETURN At the bottom of the list produced, you will something similar to: Devices: PIPE AUX SPEAK FAST RAM CON RAW SER PAR PRT DH0 DF0 ... which lists all the hardware and software devices known to your Amiga. In this list from my computer you see our old friends the hardware devices FAST: and DH0:, along with several software devices. Among the most important are the PRT: device, a software device for communicating with the printer. It performs its work through one of two other software devices, SER: which manages the Amiga's serial port and PAR: which manages the Amiga's parallel port. As this example shows, devices can work together. SOME FACTORS LEADING TO CONFUSION It's almost enough to make your head swim. Hardware devices with names, software devices with names, logical names, and volume names. They're all slightly different, as you've seen. However, all are used in similar ways, which is why they have names with similar structures. Every one of the names can be treated by you as a separate entity and manipulated. It can be very confusing to be able to use different names to accomplish the same ends, especially when the names look similar. There is little visible difference, after all, between the device name df0: and the logical name DEVS:. Both are a few letters followed by a colon. To help clarify things, let's take a typical case and examine it. Every Workbench disk has a directory named LIBS (see above). It's one of those we spent some time with last month and so should be familiar to regular readers. Contained in this directory are software libraries, which are nothing more than groupings of commonly needed information, set up to be used by multiple Amiga programs. If you wanted to obtain a directory of the libraries on a particular boot disk there are a number of ways to do so. Here are some examples: dir libs: using the logical name for the active libs directory. dir sys:libs using the logical name for the boot disk, then the real name for the libs directory dir df1:libs using the device name for a disk with the Workbench disk in it, then the name of the directory dir Workbench2.0:libs using the volume name of the disk and real name of the directory. What is the purpose behind so many ways of accessing one directory? Flexibility. The first method will always find the libraries that are available for use, even if the boot disk name changes. It will also find the active libraries in such cases as described last month where there is a disk named LIBS: in a drive. It will automatically look to the disk named LIBS: because such a disk overrides the logical name LIBS: The second example will always find the libs directory on the boot disk, even if there were a disk named LIBS: in a drive. There will be more about this potentially confusing matter in a moment. The third and fourth examples look to a specific drive or disk. Note in example three there is df1: and not df0:. If you want to see what libraries are on a boot disk other than the one you used to start the computer, you could put it in a second drive and tell DIR to look there. You could also examine a disk named Workbench2.0 the same way from a boot disk named something else (like MyWorkbench:) as is shown in example four. Splitting hairs? Yes, probably. But that's the kind of flexibility this system provides. For people interested in writing script files, the flexibility can be very valuable. For the rest, it is important to know it exists in case someday a command you type doesn't work quite as expected. Pondering logical names versus volume names versus device names may make it easier to figure out. In most cases, a little knowledge of these names means you can save some typing, and that's probably enough for most people. I wouldn't worry if you can't remember all the distinctions. If you know they exist you can always look up the information as it's needed. Another factor leading to confusion in the colon. I've used it every time I've typed a name or had you type a name. However, in the printouts from the Amiga it seldom appears. That's just the way it is, I'm afraid. As a general rule, whenever you need to type a device (hardware or software) name, volume name or logical name, you must include a colon. When the computer prints them out, it will usually not add the colon. NAME PRIORITIES If you read last month's column, you may remember we used the capabilities of logical and volume names as the core to our Workbench stretching. If you didn't read it, there is something you should know about all these names. Not all are created equal. To prevent confusion, if the Amiga sees the same name twice, it will use a priority system. For instance, if a disk in a drive has a volume name that matches an existing logical name, the volume name takes precedence. As long as the physical disk is in the drive, the logical name that matches will be ignored. In the same way, you cannot assign a logical name that duplicates an existing volume or device name known to your computer. You can always tell if the computer knows about a name by using the INFO command discussed earlier. Try this. In your Shell, type the following command: assign df0: ram: RETURN The command tells the Amiga to create the logical name df0: and assign it to the RAM disk. All Amigas already have a device named df0: known to them. What happened when you pressed the RETURN key? The error message displayed is saying, "Hey, I can't get rid of the existing df0: so I can't assign that name to RAM: as a logical name". SUMMING UP The subject of Amiga system "names" is an inherently confusing one. However, there are only a few things you really need to take away from this column. First is the knowledge that there are several types of names, and not all those designations ending with a colon are the same. Second, there are both hardware and software devices. You might also want to remember one or two of the important logical names I listed above, especially C: and SYS:. If you put these core bits of information somewhere in the back of your mind, you can always return and re-read this column or refer to your Amiga manuals for more details. You will be much less likely to be baffled by the confusing subject of Amiga names. END OF TEXT