In this post I will briefly describe some of the features of AmigaDOS: command syntax, amiga shell, batch scripting.
In the beginning was the CAOS
In the original planning, the AmigaOS module for file system handling was called CAOS (Commodore Amiga Operating System)[a][b] and its design specs, written by the Exec creator Carl Sassenrath, were reach of advanced features such as resource tracking, a mechanism for keeping track of all resources used by a program and freeing them up in case of unexpected program ending.
Unfortunately the CAOS project was discontinued for lack of time and problems with the third-party software house wich was developing it.
The replacement of CAOS was AmigaDOS, an Amiga port of a university project called TripOS written in BCPL. While the AmigaDOS handled many of the tasks of CAOS, it was an inferior system, especially for the lack of resource tracking which would have increased the overall stability of the system.
The Amiga console is a standard Amiga virtual device, normally assigned to CON:. The native console handler – CLI (Command Line Interface) – was very simple and offered limited line editing capabilities. A better interface was the Amiga Shell, assigned to NEWCON: which offered improved line editing and command history. In versions 1.x of AmigaDOS Shell-Seg must be resident in order for the shell to work (otherwise a CLI is opened when you try to open a SHELL). It should have been made resident in your startup-sequence with this command:
Resident CLI L:Shell-Seg SYSTEM pure
Alternative console handlers
In addition to the NEWCON, other console handlers are available, with more advanced features:
- ConMan[c] runs under AmigaDOS V1.2 and later, and offers many features: line editing, command history, function keys.
- ViNCEd[d] by Thomas Richter offers an editor-like interface where you can freely move the cursor over the entire page, select and copy text to clipboard, scroll up/down left/right. It has a lot of other advanced features among which tab expansion is one of the most useful. ViNCEd supports AmigaDOS V1.x only until version 3.69. The latest version is 3.73 which requires Os 2.0 or better. After a test over OS 1.3 (using ViNCEd 3.42 and 3.69) everithing worked expect for filename completion. Whenever I hit TAB (or CTR+TAB depending on the version) the screen is flashing and nothing happens. When I install the same version of the handler on a OS 3.1, tab completion works normally.
- WShell [e] is a great shell replacement which works over OS 1.3. Version 2.0 offers many features: command and session history, aliases, display handler, path handler and a very powerful filename completion tool: FComp. I tested it over OS 1.3 and it works very well. OS 2 is required only for activating the shell menus.
- KingCon[f] is a very powerful console handler running on OS 3 (probably also 2, but not 1) offering the following features: filename-completion (TAB-expansion), a review-buffer, intuition menus for rapid configuration, global preferences, jump-scroll, (for fast output), asynchronous typeahead, cursor-positioning using the mouse, MC68020-optimized version.
These shortcuts work on all the shells introduced above.
- CTRL-x clear current row
- ESC-c clear screen
- Shift-[left, right] go next or previous word / go to line beginning or end (it depends on the shell)
- CTRL-\ insert an end of file character
- 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
Wildcards are used to describe multiple names with a single string:
- ? any character
- # zero or more characters equal to the next one
- #? any sequence of zero or more characters
- | the preceding or following string
- % empty string (useful in combination with |)
- [ ] any of the characters inside the brakets
- – a range of characters (i.e. 0-9 a-z A-Z)
- ~ any string or character sequence except the following
- ( ) the string inside the brakets
- ‘ escape for the wildcards
The ESC key, the shortcut CTRL+[ or the expression “*e” inside double quotes insert in the command line the escape character (code 27 or 0x1B). This character can be used to insert ANSI sequences[g] and Amiga sequences:
- *ec reset console window to the default
- *eD line feed
- *eE line feed and carriage return
- *e[0m reset graphics modes to default
- *e[1m bold
- *e[22m undo bold
- *e[3m italic
- *e[23m undo italic
- *e[4m underline
- *e[24m undo underline
- *e[7m reverse text and back color
- *e[27m undo reverse
- Filename characters: everything except / and : The ” needs escaping
- Escape character: *
- An asterisk by itself in AmigaDOS represents the keyboard and the current window. For example, COPY filename to * copies the file contents to the screen.
- Root dir – “:”
- Parent dir – “/”
Creating a bootable floppy disk
You need first to format the disk and then to properly write its boot-block to make it bootable (using the Install command).
; First format the disk
Format DRIVE DF0: NAME EmptyDisk
; Then make it bootable
- Floppy drives – DF[n]: (n from 0 to 3)
- Hard disk – DH[n]: (n from 0 to …)
- CD Roms – CD[n]: (n from 0 to …)
In addition, the logical device SYS: is assigned to the disk you started the system up from. To gain access to a file on a particular disk, you can type its unique name, which is known as the disk’s volume name, instead of the device name.
- RAM: it’s a virtual disk created in memory. Requires the library l/ram-handler to be on the disk. The device RAM: is created on first access, i.e.. cd ram: or dir ram: or makedir ram:c
- RAD: like RAM: it’s a virtual disk created in memory. Unlike RAM: its dimension is not dynamic (it depends on the mountlist settings) and, most important, its contents can survive a soft reset. Requires the devs/ramdrive.device to be on the disk. On OS 1.3 soft reset persistence doesn’t work if you have more than 512kB of CHIP RAM.
- 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.
- SER: serial port
- PAR: parallel port
- PTR: printer defined in preferences
- CON: console – format CON:x/y/width/height/[title]/[options]
- SYS: (Typical directory name: My.Boot.Disk:) “SYS ” represents the SYStem disk root directory
- C: (Typical directory name: My.Boot.Disk:c) C represents the Commands directory. When you type a command to the CLI (DIR, for example), AmigaDOS first searches for that command in your current directory. If the system cannot find the command in the current directory, it then looks for “C:DIR”.
- L: (Typical directory name: My.Boot.Disk:l) “L” represents the Library directory.
- S: (Typical directory name: My.Boot.Disk:s) “S” represents the Sequence library. Sequence files contain command sequences that the EXECUTE command searches for and uses. EXECUTE first looks for the sequence (or batch) file in your current directory. If EXECUTE cannot find it there, it looks in the directory that you have assigned S: to.
- LIBS: (Typical directory name: My.Boot.Disk:LIBS) OpenLibrary function calls look here for the library if it is not already loaded in memory.
- DEVS: (Typical directory name: My.Boot.Disk:DEVS) OpenDevice calls look here for the device if it is not already loaded in memory.
- FONTS: (Typical directory name: My.Boot.Disk:FONTS) OpenFonts look here for your loadable fonts if they are not already loaded in memory.
Use the ? character to get the paramaters of a command.
- /A The argument is required and may not be omitted.
- /K The argument must be given with the keyword and may not be used positionally.
- /S The keyword is a switch and takes no argument.
- /M Multiple argument.
- /N Numeric argument.
- /F The argument must be the last on the row.
Use command execute. The script can be launched only using its name if the protection bit “s” and “e” of the file are set.
Launching a background task
Background tasks are launched using the comman run. Multiple commands can be specified in different lines using a + character as separator, example:
Run Join text_file1 text—file2 AS text—file+
Sort text—file TO sorted-text+
Type sorted-text TO PRT:
- Redirection of standard input: <
- Redirection of standard output: > In OS 1.x it must follow the command, example:
AmigaDOS1Echo >test.txt "Hello world"
- Interrupting current command: CTRL-c
- Interrupting a script after the current command completion: CTRL-d