Copyright (c) Hyperion Entertainment and contributors.

AmigaDOS Introduction

From AmigaOS Documentation Wiki
Jump to navigation Jump to search

About AmigaDOS Processes

AmigaDOS is a multitasking disk operating system designed for the Amiga. You normally run AmigaDOS for a single user. The multitasking facility lets many jobs take place simultaneously. You can also use the multitasking facility to suspend one job while you run another.

Each AmigaDOS process represents a particular process of the operating system - for example, the filing system. Only one process is running at a time, while other processes are either waiting for something to happen or have been interrupted and are waiting to be resumed. Each process has a priority associated with it, and the process with the highest priority that is free to run does so. Processes of lower priority run only when those of higher priority are waiting for some reason - for example, waiting for information to arrive from the disk.

 The standard AmigaDOS system uses a number of processes that you did not

start, for example, the process that handles the serial line. These processes are known as system processes. Other system processes handle the console and the filing system on a disk drive. If the hardware configuration contains more than one disk drive, there is a process for each drive.

 AmigaDOS provides a process that you can use, called a Command Line

Interface or Shell. There may be several Shell processes running simultaneously, numbered from 1 onwards. The Shell processes read commands and then execute them. To make additional Shell processes, you use the NEWSHELL or RUN commands. To remove a Shell process use the ENDSHELL command. (You can find a full description of these commands in Chapter 2).

Console Handling

You can direct information that you enter at the terminal to a Command Line Interface (Shell) that tells AmigaDOS to load a program, or you can direct the information to a program running under that Shell. In either case, a @{b}console@{ub} (or @{b}terminal@{ub}) @{b}handler@{ub} processes input and output. This handler also performs local line editing and certain other functions. You can type ahead as many as 512 characters - the maximum line length.

 To correct mistakes, you press the BACKSPACE key. This erases the last

character you typed. To rub out an entire line, hold down the Ctrl key while you press X. This @{b}control combination@{ub} is referred to from this point on in the manual as Ctrl-X. You may also use the left and right cursor keys to move within the command line to insert or remove characters if you make a mistake.

 You can also search for the most recent occurrence of a specific command

by typing the command line, or the beginning of it, then pressing Shift-Up (or Ctrl-R). For instance, if you type DIR and press Shift-Up, you will be returned to the last command to perform a DIR of any directory. Pressing Shift-Down moves you to the bottom of the history buffer, leaving the cursor on a blank line.

 In addition to command line editing, the Shell also provides command

history, which allows you to recall previously-entered command lines, edit them, and re-enter them. This is useful when you want to repeat a command or enter several very similar commands.

 The shell uses a 2K command line buffer to retain command lines. The

exact number of lines varies depending on [the] lengths of the lines actually stored. When the buffer fills up, the oldest lines are lost. You access lines in the buffer through the up and down cursor keys:

up cursor Moves backwards in the history buffer (earlier lines).
down cursor Moves forwards in the history buffer (later lines).

If you type anything, AmigaDOS waits until you have finished typing before displaying any other output. Because AmigaDOS waits for you to finish, you can type ahead without your input and output becoming intermixed. AmigaDOS recognizes that you have finished a line when you press the RETURN key. You can also tell AmigaDOS that you have finished with a line by cancelling it. To cancel a line, you can either press Ctrl-X or press BACKSPACE until all the characters on the line have been erased. Once AmigaDOS is satisfied that you have finished, it starts to display the output that it was holding back. If you wish to stop the output so that you can read it, simply type any character (pressing the space bar is the easiest), and the output stops. To restart output, press BACKSPACE, Ctrl-X, or RETURN. Pressing RETURN causes AmigaDOS to try to execute the command line typed after the current program exits.

 AmigaDOS recognizes Ctrl-\\ as an end-of-file indicator. In certain

circumstances, you use this combination to terminate an input file. (For a circumstance when you would use Ctrl-\\, see "Understanding Device Names", below).

 If you find that strange characters appear on the screen when you type

anything on the keyboard, you have probably pressed Ctrl-O by mistake. AmigaDOS recognizes this control combination as an instruction to the console device (CON:) to display the alternative character set. To undo this condition, you press Ctrl-N. Any further characters should then appear as normal. You could press Esc-C to reset the console. This clears the screen and displays normal text.

 The table below summarizes the editing capabilities of the Amiga's Shell

interface:

Key Shell Editing Commands
left cursor Moves cursor one character to the left. right cursor Moves cursor one character to the right. Shift-left cursor Moves cursor to the beginning of the line. Shift-right cursor Moves cursor to the end of the line. Backspace Deletes the character to the left of the cursor. Del Deletes the character highlighted by the cursor. Ctrl-H Deletes the last character (same as BACKSPACE). Ctrl-M Processes the command line (same as RETURN). Ctrl-J Adds a line feed. Ctrl-W Deletes the word to the left of the cursor Ctrl-X Deletes the current line. Ctrl-K Deletes everything from the cursor forwards to the end of the line. Ctrl-Y Replaces the characters deleted with Ctrl-K. Ctrl-U Deletes everything from the cursor backwards to the start of the line. Space bar (or any printable character) Suspends output (stops scrolling). Backspace Resumes output (continues scrolling). Ctrl-C Sends a BREAK command to the current process (halts the process). Ctrl-D Sends a BREAK command to the current script (halts the script). Ctrl-S Suspends output. Ctrl-Q Resumes output if it was suspended with Ctrl-S. Ctrl-\ Closes the Shell window.

Finally, AmigaDOS recognizes all commands and @{b}arguments@{ub} typed in either upper or lower case. AmigaDOS displays a @{b}filename@{ub} with the characters in the case used when it was created, but finds the file no matter what combination of cases you use to specify the filename.

Using the Filing System

This section describes the AmigaDOS filing system. In particular, it explains how to name, organize, and recall your files.

 A file is the smallest named object used by AmigaDOS. The simplest

identification of a file is by its filename, discussed below in "Naming Files". However, it may be necessary to identify a file more fully. Such an identification may include the device or volume name, and/or directory name(s) as well as the filename. These will be discussed in [the] following sections.

Naming Files

AmigaDOS holds information on disks in a number of @{b}files@{ub}, named so that you can identify and recall them. The filing system allows filenames to have up to 30 characters, where the characters may be any printing character except slash (/) and colon (:). This means that you can include space ( ), equals (=), plus (+) and double quote ("), all special characters recognized by the CLI, within a filename. However, if you use these special characters, you must enclose the entire filename within double quotes. To introduce a double quote character within a filename, you must type an asterisk (*) immediately before that character. In addition, to introduce an asterisk, you must type another asterisk. This means that a file named:

A*B = C"

should be typed as follows:

"A**B = C*""

for the CLI to accept it.

 @{b}Note:@{ub} This use of the asterisk is in contrast to many other operating

systems where it is used as a universal @{b}wild card@{ub}. An asterisk by itself in AmigaDOS represents the keyboard and the current window. For example,

COPY filename TO *

copies the filename to the screen. On the Amiga, the universal wild card is #?.

 When spaces are used within a file, directory, or device name, quotes

are required when accessing the name. For example,

COPY "df0:My file" TO ram:

Avoid spaces before or after filenames because they may cause confusion.

Using Directories

The filing system also allows the use of @{b}directories@{ub} as a way to group files together into logical units. For example, you may use two different directories to separate program source from program documentation, or to keep files belonging to one person distinct from those belonging to another.

 Each file on a disk must belong to a directory. An empty disk contains

one directory, called the @{b}root directory@{ub}. If you create a file on an empty disk, then that file belongs to the root directory. However, directories may themselves contain other directories. Each directory may therefore contain files, or yet more directories, or a mixture of both. Any filename is unique only within the directory it belongs to, so that the file "fred" in the directory "bill" is a completely different file from the one called "fred" in the directory "mary".

 This filing structure means that two people sharing a disk do not have

to worry about accidentally overwriting files created by someone else, as long as they always create files in their own directories.

WARNING: When you create a file with a filename that already exists,

AmigaDOS deletes the previous contents of that file. No message to that effect appears on the screen.

You can also use this directory structure to organize information on the disk, keeping different sorts of files in different directories.

An example might help to clarify this. Consider a disk that contains two directories, called "bill" and "mary". The directory "bill" contains two files, called "text" and "letter". The directory "mary" contains a file called "data" and two directories called "letter" and "invoice". These subdirectories each contain a file called "jun18". [This figure] represents this structure as follows:

                       ROOT
                         |
              +----------+----------+
              |                     |
            BILL                  MARY
              |                     |
         +----+----+           +--------+--------+
         |         |           |        |        |
       TEXT     LETTER       DATA    LETTER   INVOICE
                                        |        |
                                      JUN18    JUN18

@{b}Note:@{ub} The directory "bill" has a file called "letter", while the directory "mary" contains a directory called "letter". However, there is no confusion because both...are in different directories. There is no limit to the depth that you can "nest" directories.

 To specify a file fully, you must include the directory that owns it,

the directory owning that directory, and so on. To specify a file, you give the names of all the directories on the path to the desired file. To separate each directory name from the next directory or filename, you type a following slash (/). Thus, the full specification of the data files on the disk shown...above is as follows:

bill/text
bill/letter
mary/data
mary/letter/jun18
mary/invoice/jun18

Setting the Current Directory

A full file description can get extremely cumbersome to type, so the filing system maintains the idea of a @{b}current directory@{ub}. The filing system searches for files in this current directory. To specify the current directory, you use the CD (@{u}C@{uu}urrent @{u}D@{uu}irectory) command. If you have set "mary" as your current directory, then the following names would be sufficient to specify the files in that directory:

data
letter/jun18
invoice/jun18

You can set any directory as the current directory. To specify any files within that directory, simply type the name of the file. To specify files within subdirectories, you need to type the names of the directories on the path from the current directory specified.

 All the files on the disk are still available even though you've set up

a current directory. To instruct AmigaDOS to search through the directories from the root (top level) directory of a volume (disk or partition), you type a colon (:) at the beginning of the file description. Thus, when your file description [sic] has the current directory set to "mary", you can also obtain the file "data" by typing the description ":mary/data". Using the current directory method simply saves typing, because all you have to do is specify the filename "data".

 To obtain the other files on the disk, first type ":bill/text" and

":bill/letter", respectively. Another way might be to CD or type / before the filename. Slash [(/)] does not mean "root" as in some systems, but refers to the directory above the current directory. AmigaDOS allows multiple slashes. Each slash refers to the level above. So a UNIX ../ is a / in AmigaDOS. Similarly, an MS-DOS ..\\ is a / in AmigaDOS. Thus, if the current directory is ":mary/letter", you may specify the file ":mary/invoice/jun18" as "/invoice/jun18". To refer to the files in ":bill", you could type:

CD :bill

or

CD //bill

Then you could specify any file in "bill" with a single filename. Of course, you could always use the // feature to refer directly to a specific file. For example,

TYPE //bill/letter

displays the file without your first setting "bill" as the current directory. To go straight to the root level, always type a colon (:) followed by a directory name. If you use slashes, you must know the exact numbewr of levels back desired.

Setting the Current Device

Finally, you may have many disk drives. Each [floppy] disk device has a name in the form DFn (for example DF1), where the "n" refers to the number of the device. (Currently, AmigaDOS accepts the device names DF0 to DF3.) Each individual disk is also associated with a unique name, known as a volume name (see below for more details).

 In addition, the logical device SYS: is assigned to the disk you started

the system up from. You can use this name in place of a disk device name (like DF0:).

 The current directory is also associated with a @{b}current drive@{ub}, the drive

where you may find the [current] directory. As you know, prefacing a file description with a colon serves to identify the root of the current drive. However, to give the root directory of a specific drive, you precede the colon with the drive name. Thus, you have yet another way of specifying the file "data" in directory "mary", that is "DF1:mary/data". This assumes that you have inserted the disk into drive DF1. So, to reference a file on the drive DF0 called "project-report" in directory "peter", you would type "DF0:peter/project-report", no matter which directory you had set as the current one.

@{b}Note:@{ub}When you refer to a disk drive or any other device, on its own or with a directory name, you should always type the colon; for example, DF1:.

This table illustrates the structure of a file description

Left of the : Right of the : Right of a /
Device name or Volume name Directory name or Filename Subdirectory name or Filename

Here are some examples of valid file descriptions.

SYS:commands
DF0:bill
DF1:mary/letter
DF2:mary/letter/jun18
DOC:report/section1/figure
FONTS:silly-font
C:cls

To gain access to a file on a particular disk, you can type its unique name, which is known as the disk's @{b}volume name@{ub}, instead of the device name. For instance, if the file is on the disk "MCC", you can specify the same file by typing the name "MCC:peter/project-report". You can use the volume name to refer to a disk regardless of the drive it is in. You assign a volume name to a disk when you format it (for further details, see FORMAT in @{" Chapter 2 " link Two}). You can also change the volume name using the RELABEL command.

 A device name, unlike a volume name, is not really part of the name. For

example, AmigaDOS can read a file you created on DF0: from another drive, such as DF1:, if you place the disk in that drive, assuming of course that the drives are interchangeable. That is, if you created a file called "bill" on a disk in drive DF0:, the file is known as "DF0:bill". If you then move the disk to drive DF1:, AmigaDOS can still read the file, which is then known as "DF1:bill".

Attaching a Filenote

Although a filename can give some information about its contents, it is often necessary to look in the file itself to find out more. AmigaDOS provides a simple solution to this problem. You can use the command called FILENOTE to attach an associated comment. You can make up a comment of up to 80 characters (you must enclose comments containing spaces in double quotes). Anything can be put in a file comment: the day of the file's creation, whether or not a bug has been fixed, the version number of a program, and anything else that may help to identify it.

 You must associate a comment with a particular file - not all files have

them. To attach comments, you use the FILENOTE command. If you create a new file, it will not have a comment. Even if the new file is a copy of a file that has a comment, the comment is not copied to the new file. However, any comment attached to a file which is overwritten is retained. To write a program to copy a file and its comment, you'll have to do some extra work to copy the comment. For details, see @{" Chapter 6 " link Six}.

 When you rename a file, the comment associated with it doesn't change.

The RENAME command only change the name of the file. The file's contents and comment remain the same regardless of the name change. For more details, see LIST and FILENOTE in @{" Chapter 2 " link Two}.

Understanding Device Names

Devices have names so that you can refer to them by name. Disk names such as DF0: are examples of @{b}device names@{ub}. Note that you may refer to device names, like filenames, using either upper or lower case. For disks, you follow the device name by a filename because AmigaDOS supports files on these devices. Furthermore, the filename can include directories because AmigaDOS also supports directories.

 You can also create files in memory with the device called RAM:. RAM:

implements a filing system in memory that supports any of the normal filing system comands.

 @{b}Note:@{ub} If you are running AmigaDOS 1.3 or an earlier version,

RAM: requires the library L:ram-handler to be on the disk. (Under 2.0 the RAM-handler is in the ROMs).

 Once the RAM: device exists, you can, for instance, create a directory

to copy all the commands into memory. To do this, type the following commands:

MAKEDIR ram:c
COPY sys:c TO ram:c
ASSIGN C: ram:c

You could then look at the output with DIR RAM:. It would include the direcotry "c" (DIR lists this as "c (dir)"). This would make loading commands very quick but would leave little room in memory for anything else. Any files in the RAM: device are lost when you reset the machine.

 AmigaDOS also provides a number of other devices that you can use

instead of a reference to a disk file. The following paragraphs describe these devices including NIL:, SER:, PAR:, PRT:, CON:, and RAW:. In particular, the device NIL: is a dummy device. AmigaDOS simply throws away output written to NIL:. While reading from NIL:, AmigaDOS gives an immediate "end-of-file" indication. For example, you would type the following:

EDIT abc TO nil:

to use the editor to browse through a file, while AmigaDOS throws away the edited output.

 You use the device called SER: to refer to any device connected to the

serial line (often a [modem or] printer). Thus, you would type the following command sequence:

COPY xyz TO ser:

to instruct AmigaDOS to send the contents of the file "xyz" down the serial line. Note that the serial device only copies in multiples of 400 bytes at a time. Copying with SER: can therefore appear granular.

 The device PAR: refers to the parallel port in the same way.
 AmigaDOS also provides the device PRT: (for PRinTer). PRT: is the

printer you chose in the Preferences program. In this program, you can define your printer to be connected through either the serial or parallel port. Thus, the command sequence:

COPY xyz TO prt:

prints the file "xyz", no matter how the printer is connected.

 All output sent to PRT: is translated through the printer driver

selected in Preferences. The printer driver will translate standard ANSI escape codes into the specific code required by the printer. PRT: translates every linefeed character in a file to carriage return plus linefeed. Some printers, however, require files without translation. To send a file with the linefeeds as just linefeeds, you use PRT:RAW instead of PRT:.

 AmigaDOS supports multiple windows. To make a new window, you can

specify the device CON:. The format for CON: is as follows:

CON:x/y/width/height/[title]

where "x" and "y" are coordinates, "width" and "height" are integers describing the width and height of the new window, and "title", which is optional, is a string. The title appears on the window's title bar. You must include all the slashes, including the last one. Your title can include up to 30 characters (including spaces). If the title has spaces, you must enclose the whole description in double quotes (") as shown in the following example:

"CON:20/10/300/100/my window"

Under 2.0 and later versions of AmigaDOS, CON: windows have additional special features. Refer to @{" Chapter 8 " link Eig} for a complete description.

 There is another window device called RAW:, but it is of little use to

the general user. (See @{" Chapter 8 " link Eig} for further details.) You can use RAW: to create a raw window device similar to CON:. However, unlike CON:, RAW: does no character translation and does not allow you to change the contents of a line. That is to say, RAW: accepts input and returns output in exactly the same form that it was originally typed. This means characters are sent to a program immediately without letting you erase anything with the BACKSPACE key. You usually use RAW: from a program where you might want to do input and output without character translation.

WARNING: RAW: is intended for the advanced user. Do not use RAW: experimentally.

There is one special name, which is * (asterisk). You use this to refer to the current window, both for input or for output. You can use the COPY command to copy from one file to another. Using *, you can copy from the current window to another window, for example,

COPY * TO CON:20/20/350/150/

from the current window to the current window, for example,

COPY * TO *

or from a file to the current window, for example,

COPY bill/letter TO *

AmigaDOS finishes copying when it comes to the end of the file. To tell AmigaDOS to stop copying from *, you must give the Ctrl-\\ combination. Note that * is NOT the universal wild card.

Using Directory Conventions and Logical Devices