AmigaDOS
Encyclopedia
AmigaDOS is the disk operating system
Disk operating system
Disk Operating System and disk operating system , most often abbreviated as DOS, refers to an operating system software used in most computers that provides the abstraction and management of secondary storage devices and the information on them...

 of the AmigaOS
AmigaOS
AmigaOS is the default native operating system of the Amiga personal computer. It was developed first by Commodore International, and initially introduced in 1985 with the Amiga 1000...

, which includes file system
File system
A file system is a means to organize data expected to be retained after a program terminates by providing procedures to store, retrieve and update data, as well as manage the available space on the device which contain it. A file system organizes data in an efficient manner and is tuned to the...

s, file and directory manipulation, the command-line interface
Command-line interface
A command-line interface is a mechanism for interacting with a computer operating system or software by typing commands to perform specific tasks...

, and file redirection.

In AmigaOS 1.x, AmigaDOS was based on a TRIPOS
TRIPOS
TRIPOS is a computer operating system. Development started in 1976 at the Computer Laboratory of Cambridge University and it was headed by Dr. Martin Richards. The first version appeared in January 1978 and it originally ran on a PDP-11. Later it was ported to the Computer Automation LSI4 and the...

 port by MetaComCo
MetaComCo
MetaComCo was a computer systems software company started in 1981 and based in Bristol, England by Peter Mackeonis and Derek Budge.MetaComCo's first product was an MBASIC compatible interpreter for IBM PC's, which was licensed by Peter Mackeonis to Digital Research in 1982, and issued as the...

, written in BCPL
BCPL
BCPL is a procedural, imperative, and structured computer programming language designed by Martin Richards of the University of Cambridge in 1966.- Design :...

. BCPL does not use native pointers, so the more advanced functionality of the operating system was difficult to use and error-prone. The third-party AmigaDOS Resource Project (ARP, formerly the AmigaDOS Replacement Project), a project begun by Amiga developer Charlie Heath, replaced many of the BCPL utilities with smaller, more sophisticated equivalents written in C and assembler, and provided a wrapper library, arp.library. This eliminated the interfacing problems in applications by automatically performing conversions from native pointers (such as those used by C or assembler) to BCPL equivalents and vice versa for all AmigaDOS functions.

From AmigaOS 2.x onwards, AmigaDOS was rewritten in C, retaining 1.x compatibility where possible. Starting with AmigaOS 4, AmigaDOS abandoned its legacy with BCPL. Starting from AmigaOS 4.1, AmigaDOS has been extended with 64-bit file-access support.

Console

The Amiga console is a standard Amiga virtual device, normally assigned to CON: and driven by console.handler. It was developed from a primitive interface in AmigaOS 1.1, and became stable with versions 1.2 and 1.3, when it started to be known as AmigaShell and its original handler was replaced by newconsole.handler (NEWCON:).

The console had various features that were considered up to date when it was created in 1985, like Command Template Help, redirection to null ("NIL:"), and ANSI
Ansi
Ansi is a village in Kaarma Parish, Saare County, on the island of Saaremaa, Estonia....

 color terminal. The new console handler allowed many more features, such as command history, pipelines, and automatic creation of files when output was redirected. When the Internet became popular, the console could also receive redirection from Amiga Internet stacks employing Internet-enabled Amiga device handlers (e.g., TCP:, copy file TO TCP:Site/Port).

Unlike other systems of its age, AmigaDOS did not implement a proprietary character set; the developers chose to use the ANSI–ISO
International Organization for Standardization
The International Organization for Standardization , widely known as ISO, is an international standard-setting body composed of representatives from various national standards organizations. Founded on February 23, 1947, the organization promulgates worldwide proprietary, industrial and commercial...

 standard ISO-8859-1 (Latin 1), which includes the ASCII
ASCII
The American Standard Code for Information Interchange is a character-encoding scheme based on the ordering of the English alphabet. ASCII codes represent text in computers, communications equipment, and other devices that use text...

 character set. As in Unix
Unix
Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...

 systems, the Amiga console accepts only linefeed ("LF") as an end-of-line ("EOL
Newline
In computing, a newline, also known as a line break or end-of-line marker, is a special character or sequence of characters signifying the end of a line of text. The name comes from the fact that the next character after the newline will appear on a new line—that is, on the next line below the...

") character. The Amiga console has support for accented characters as well as for characters created by combinations of 'dead keys' on the keyboard.

Syntax of AmigaDOS commands

This is an example of typical AmigaDOS command syntax:
{|style="background:transparent"

|rowspan=1 valign=top| 1> DIR Df0:
|-
|
Without entering the directory tree, this shows the content of a directory of a floppy disk and lists subdirectories as well.

|-
|rowspan=1 valign=top| 1> DIR SYS: ALL
|-
|
The argument "ALL" causes the command to show the entire content of a volume or device, entering and expanding all directory trees. "SYS:" is a default name that is assigned to the boot device, regardless of its physical name.

|}

Command redirection

AmigaDOS can redirect the output of a command to files, pipes, a printer, the null device, and other Amiga devices.
{|style="background:transparent"

|rowspan=1 valign=top| 1> DIR >Speak: ALL
|-
|
Redirects the output of the "dir" command to the speech synthesis handler. The colon character ":" indicates that Speak: points to an AmigaDOS device. While a typical use for a device is file system
File system
A file system is a means to organize data expected to be retained after a program terminates by providing procedures to store, retrieve and update data, as well as manage the available space on the device which contain it. A file system organizes data in an efficient manner and is tuned to the...

s, special-purpose device names such as this are commonly used in the system.

|}

Command template

AmigaDOS commands are expected to provide a standard "template" that describes the arguments they can accept. This can be used as a basic "help" feature for commands, although third-party replacement console handlers and shells, such as Bash or Zshell (ported from Unix
Unix
Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...

), or KingCON often provide more verbose help for built-in commands.

On requesting the template for the command "Copy", the following output is obtained:
{|style="background:transparent"

|rowspan=1 valign=top| 1> Copy ?
|-
|
|-
|rowspan=1 valign=top| FROM, TO/A, ALL/S, QUIET/S
|-
|
This string means that the user must use this command in conjunction with FROM and TO arguments, where the latter is compulsory (/A). The argument keywords ALL and QUIET are switches (/S) and change the results of the command Copy (ALL causes all files in a directory to be copied, while QUIET will cause the command to generate no output).

|-
|}

By reading this template, a user can know that the following syntax is acceptable for the command:
{|style="background:transparent"

|-
|rowspan=1 valign=top|Copy DF0:Filename TO DH0:Directory/Filename
|}

Command Break and pausing console output

User can terminate a program by invoking the combination of keys+ and . Pressing or any printing characters on the keyboard suspends the Console Output. Output may be resumed by pressing the key to delete all of the input, or by pressing (which will cause the input to be processed as a command as soon as the current command stops running).

Wildcard characters

Like other operating systems, AmigaDOS also provides wildcard characters that are substitutes for any character or any sequence of random characters in a string. Here is an example of wildcard characters in AmigaDOS commands:
{|style="background:transparent"

|rowspan=1 valign=top| 1> DIR #?.info
|-
|
searches the current directory for any file containing ".info" at its end as suffix, and displays only these files in the output.

|}

The parsing of this is as follows. The "?" wildcard indicates "any character". Prefixing this with a "#" indicates "Any number of repetitions". This can be viewed as analogous to the regular expression ".*".

Scripting

AmigaDOS also has the feature of dealing with batch
Batch file
In DOS, OS/2, and Microsoft Windows, batch file is the name given to a type of script file, a text file containing a series of commands to be executed by the command interpreter....

 programming, which it calls "script" programming, and has a number of commands such as Echo, If, Then, EndIf, Val, and Skip to deal with structured script programming. Scripts are text-based files and can be created with AmigaDOS's internal text editor program, called Ed (unrelated to Unix's Ed
Ed (text editor)
ed is a line editor for the Unix operating system. It was one of the first end-user programs hosted on the system and has been standard in Unix-based systems ever since. ed was originally written in PDP-11/20 assembler by Ken Thompson in 1971...

), or with any other third-party text editor. To invoke a script program, AmigaDOS uses the command Execute.
{|style="background:transparent"

|rowspan=1 valign=top| 1> Execute myscript
|-
|
executes the script called "myscript".

|}

This method of executing scripts keeps the console window busy until the script has finished its scheduled job. Users cannot interact with the console window until the script ends or until they interrupt it.

While:
{|style="background:transparent"

|rowspan=1 valign=top| 1> Run Execute myscript
|-
|
The AmigaDOS command "Run" executes any DOS command or any kind of program and keeps the console free for further input.

|}

If the protection bit "S" (meaning "Script") is set on, then AmigaDOS is able to recognize and automatically run the script by simply invoking its name.

Protection bits

Protection bits are flags that files, links and directories have in the filesystem. To change them one can either use the command Protect, or use the Information entry from the Icons menu in Workbench on selected files. AmigaDOS supports the following set of protection bits (abbreviated as HSPARWED):
  • H = Hold (reentrant commands with the P-bit set will automatically become resident on first execution. Requires E, P and R bits set to work. Does not mean "Hide". See below.)
  • S = Script (Batch file. Requires E and R bits set to work. Without S bit scripts can still be launched using the Execute command.)
  • P = Pure (indicates reentrant commands that can be made resident in RAM and then no longer need to be loaded any time from flash drives, hard disks or any other media device. Requires E and R bits set to work.)
  • A = Archive (Archived bit, used by various backup programs to indicate that a file has been backed up)
  • R = Read (Permission to read the file, link or content of directory)
  • W = Write (Permission to write the file, link or inside a directory)
  • E = Execute (Permission to execute the file or enter the directory. All commands need this bit set, or they won't run. Requires R bit set to work.)
  • D = Delete (Permission to delete the file, link or directory)


The H-bit has often been misunderstood to mean "Hide", something that doesn't make any sense as files with the H-bit set remain visible in all respects, there are no options for C:List or C:Dir to display files with H-bit set any differently than other files. Where this misunderstanding has its origin is unclear.

Demonstration of H-bit in action:
{|style="background:transparent"|rowspan=1 valign=top|


AmigaPrompt> which list
Workbench:C/List
AmigaPrompt> list workbench:c/list
Directory "workbench:c" on Thursday 30-Oct-08
list 6464 --p-rwed 25-Feb-02 22:30:00
1 file - 14 blocks used
AmigaPrompt> which list
Workbench:C/List
AmigaPrompt> protect workbench:c/list +h
AmigaPrompt> which list
Workbench:C/List
AmigaPrompt> list workbench:c/list
Directory "workbench:c" on Thursday 30-Oct-08
list 6464 h-p-rwed 25-Feb-02 22:30:00
1 file - 14 blocks used
AmigaPrompt> which list
RES list

|-
|
Notice how the list command becomes resident after execution when the H-bit is set.

|}

Local and global variables

As any other DOS, Amiga deals with environmental variables
Variable (programming)
In computer programming, a variable is a symbolic name given to some known or unknown quantity or information, for the purpose of allowing the name to be used independently of the information it represents...

 as used in batch programming.

There are both global and local variables, and they are referred to with a dollar sign in front of the variable name, for example $myvar. Global variables are available system-wide; local variables are only valid in the current shell. In case of name collision, local variables have precedence over global variables. Global variables can be set using the command SetEnv, while local variables can be set using the command Set. There are also the commands GetEnv and Get that can be used to print out global and local variables.

The examples below demonstrate simple usage:
{|style="background:transparent"|rowspan=1 valign=top|


1> setenv foo blapp
1> echo $foo
blapp
1> set foo bar
1> echo $foo
bar
1> getenv foo
blapp
1> get foo
bar
1> type ENV:foo
blapp
1> setenv save foo $foo
1> type ENV:foo
bar
1> type ENVARC:foo
bar

|-
|
Note the save flag of the SetEnv command and how global variables are available in the filesystem

|}

Global variables are kept as files in ENV:, and optionally saved on disk in ENVARC: to survive reboot and power cycling. ENV: is by default an assign to RAM:Env, and ENVARC: is an assign to SYS:Prefs/Env-archive where SYS: refers to the boot device. On bootup, the content of ENVARC: is copied to ENV: for accessibility.

When programming AmigaDOS scripts, one must keep in mind that global variables are system-wide. All script-internal variables shall be set using local variables, or one risks conflicts over global variables between scripts. Also, global variables require filesystem access, which typically makes them slower to access than local variables.

Since ENVARC: is also used to store other system settings than just string variables (such as system settings, default icons and more), it tends to grow large over time, and copying everything over to ENV: located on RAM disk becomes expensive. This has led to alternative ways to set up ENV: by using dedicated ramdisk handlers that only copy files over from ENVARC: when the files are requested. Examples of such handlers are http://aminet.net/package/disk/misc/HappyENV and http://aminet.net/package/util/sys/envhandler.

A rather insane example demonstrating creative abuse of global variables as well as Lab and Skip, the AmigaDOS variant of the infamous GOTO
Goto
goto is a statement found in many computer programming languages. It is a combination of the English words go and to. It performs a one-way transfer of control to another line of code; in contrast a function call normally returns control...

.

Case sensitivity

AmigaDOS is in general case-insensitive
Case sensitivity
Text sometimes exhibits case sensitivity; that is, words can differ in meaning based on differing use of uppercase and lowercase letters. Words with capital letters do not always have the same meaning when written with lowercase letters....

. Indicating a device as "Dh0:", "DH0:" or "dh0:" always refers to the same partition; however, for file and directory names, this is filesystem-dependent, and some filesystems allow case sensitivity as a flag upon formatting. An example of such a file system is Smart File System
Smart File System
The Smart File System is a journaling filesystem used on Amiga computers. It is designed for performance, scalability and integrity...

. This is very convenient when dealing with software ported over from the mostly case-sensitive Un*x
Unix-like
A Unix-like operating system is one that behaves in a manner similar to a Unix system, while not necessarily conforming to or being certified to any version of the Single UNIX Specification....

 world, but causes much confusion for native Amiga applications, which assume case insensitivity. Advanced users will hence typically only use the case sensitivity flag for file systems used for software originating from Un*x.

Note also that re-casing of file, directory and volume names is allowed using ordinary methods; the commands "rename foo Foo" and "relabel Bar: bAr:" are valid and do exactly what is expected, in contrast to for example on Linux
Linux
Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of any Linux system is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds...

, where "mv foo Foo" results in the error message "mv: `foo' and `Foo' are the same file" on case-insensitive filesystems like VFAT
File Allocation Table
File Allocation Table is a computer file system architecture now widely used on many computer systems and most memory cards, such as those used with digital cameras. FAT file systems are commonly found on floppy disks, flash memory cards, digital cameras, and many other portable devices because of...

.

Volume naming conventions

Partitions and physical drives are typically referred to as DF0: (floppy drive 0), DH0: (hard drive 0), etc. However, unlike many operating systems, outside of built-in physical hardware devices like DF0: or HD0:, the names of the single disks, volumes and partitions are totally arbitrary: for example a hard disk partition could be named Work or System, or anything else at the time of its creation. Volume names can be used in place of the corresponding device names, so a disk partition on device DH0: called Workbench could be accessed either with the name DH0: or Workbench:. Users must indicate to the system that "Workbench" is the volume "Workbench:" by always typing the colon ":" when they are entering information in a requester form or into AmigaShell. In addition, logical device names can be set with the "assign" command to any directory or device; programs often assigned a virtual volume name to their installation directory (for instance, a fictional wordprocessor called Writer might assign Writer: to DH0:Productivity/Writer). This allows for easy relocation of installed programs. The default name SYS: is used to refer to the volume that the system was booted from.

Conventions of names and typical behaviour of virtual devices

The physical device DF0: shares the same floppy drive mechanics with PC0:, which is the CrossDOS virtual device capable of reading PC formatted floppy disks. When any PC formatted floppy disk is inserted into the floppy drive, then the DF0: floppy Amiga icon will change to indicate that the disk is unknown to the normal Amiga device, and it will show four question marks ???? as the standard "unknown" volume name, while the PC0: icon will appear revealing the name of the PC formatted disk. Any disk change with Amiga formatted disks will invert this behaviour.

File systems

AmigaDOS supports various filesystems and variants. The first filesystem was simply called Amiga FileSystem
Amiga Old File System
On the Amiga, the Old File System was the filesystem for Amiga OS before the Amiga Fast File System. Even though it used 512-byte blocks, it reserved the first small portion of each block for metadata, leaving an actual data block capacity of 488 bytes per block...

, and was suitable mainly for floppy disks, because it did not support automatic booting from hard disks (on floppy, booting was done using code from the bootblock). It was soon replaced by FastFileSystem
Amiga Fast File System
The Amiga Fast File System is a file system used on the Amiga personal computer. The previous Amiga filesystem upon the release of FFS became known as Amiga Old File System . OFS, while fine on floppy disk, soon proved too slow to keep up with era hard drives...

 (FFS), and hence the original filesystem was known by the name of "Old" FileSystem (OFS). It also was more efficient on space and quite measurably faster, hence the name.

With AmigaOS 2.x, FFS became an official part of the OS and was soon expanded to recognise cached partitions, international partitions allowing accented characters in file and partition names, and finally (with MorphOS
MorphOS
MorphOS is an Amiga-compatible computer operating system. It is a mixed proprietary and open source OS produced for the Pegasos PowerPC processor based computer, PowerUP accelerator equipped Amiga computers, and a series of Freescale development boards that use the Genesi firmware, including the...

 and AmigaOS 4
AmigaOS 4
AmigaOS 4, , is a line of Amiga operating systems which runs on PowerPC microprocessors. It is mainly based on AmigaOS 3.1 source code, and partially on version 3.9 developed by Haage & Partner...

) long filenames, up to 108 characters.

Both AmigaOS 4.x and MorphOS featured a new version of FFS called FastFileSystem 2. FFS2 incorporated all of the features of the original FFS including, as its author put it, "some minor changes". In order to preserve backwards compatibility, there were no major structural changes. (However, FF2 on AmigaOS 4.1 differs in that it can expand its features and capabilities with the aid of plug-ins). As with FFS2, the AmigaOS 4 and MorphOS version of Smart FileSystem is a fork of original SFS and are not 100% compatible with it.

Other filesystems like FAT12, FAT16, FAT32 from Windows or ext2
Ext2
The ext2 or second extended filesystem is a file system for the Linux kernel. It was initially designed by Rémy Card as a replacement for the extended file system ....

 from Linux are available through easily installable (drag and drop) system libraries or third party modules such as FAT95 http://aminet.net/package/disk/misc/fat95 (features read/write support), which can be found on the Aminet
Aminet
Aminet is the world's largest archive of Amiga-related software and files. Aminet was originally hosted by several universities' FTP sites, and is now available on CD-ROM and on the web.-History:...

 freeware software repository. MorphOS 2 has built-in support for FAT filesystems.

AmigaOS 4.1 adopted a new filesystem called JXFS capable to support partitions over a Terabyte of size.

Alternate filesystems from third party manufacturers include Professional FileSystem
Professional File System
The Professional File System is a filesystem originally developed commercially for the Amiga, it is now distributed on Aminet with a 4-clause BSD license. PFS tends to perform very well, due to the simplicity of design. Compatible successor of Ami-FileSafe....

 which is a filesystem with an easy structure, based on metadata
Metadata
The term metadata is an ambiguous term which is used for two fundamentally different concepts . Although the expression "data about data" is often used, it does not apply to both in the same way. Structural metadata, the design and specification of data structures, cannot be about data, because at...

, allowing high internal coherence, capable of defragmenting itself on the fly, and does not require to be unmounted before being mounted again; and Smart FileSystem
Smart File System
The Smart File System is a journaling filesystem used on Amiga computers. It is designed for performance, scalability and integrity...

 which is a journaling
Journaling file system
A journaling file system is a file system that keeps track of the changes that will be made in a journal before committing them to the main file system...

 filesystem which performs journaled activities during system inactivities, and has been chosen by MorphOS as its standard filesystem.

Official variants of Amiga filesystems

Old File System/Fast File System
  • OFS (DOS0)
  • FFS (DOS1)
  • OFS International (DOS2)
  • FFS International (DOS3)
  • OFS Directory Caching (DOS4)
  • FFS Directory Caching (DOS5)


Fast File System 2 (AmigaOS4.x/MorphOS)
  • OFS Long filenames (DOS6)
  • FFS Long filenames (DOS7)


Both DOS6 and DOS7 feature International filenames featured in DOS2 and DO3, but not Directory Caching, which was abandoned due to bugs in the original implementation. DOS4 and DOS5 are not recommended for use for this reason.

Dostypes are backwards compatible with each other, but not forward compatible. A DOS7 formatted disk cannot be read on original Amiga FFS, and a DOS3 disk cannot be read on a KS1.3 Amiga. However, any disk formatted with DOS0 using FFS or FFS2 can be read by any version of the Amiga operating system. For this reason, DOS0 tended to be the format of choice of software developers distributing on floppy, except where a custom filesystem and bootblock was used - a common practice in Amiga games. Where software needed AmigaOS 2 anyway, DOS3 was generally used.

FastFileSystem2 plug-ins

With the first update of AmigaOS 4.0 in 2007, the first two plug-ins for FFS2 were released:
  • fs_plugin_cache: increases performance of FFS2 by introducing a new method of data buffering.
  • fs_plugin_encrypt: data encryption plug-in for partitions using the Blowfish
    Blowfish (cipher)
    Blowfish is a keyed, symmetric block cipher, designed in 1993 by Bruce Schneier and included in a large number of cipher suites and encryption products. Blowfish provides a good encryption rate in software and no effective cryptanalysis of it has been found to date...

    algorithm.

Filename extensions

AmigaDOS has only a single mandated filename extension: ".info", which must be appended to the filename of each icon. If a file called myprog exists, then its icon file must be called myprog.info. In addition to image data, the icon file also records program metadata such as options and keywords, its own position on the desktop (AmigaOS can "snapshot" icons in places defined by the user), and other information about the file.

With the exception of icons, the Amiga system does not identify file types using extensions, but instead will examine either the icon associated with a file or the binary header of the file itself to determine the file type.
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK