Copyright (c) 2012-2016 Hyperion Entertainment and contributors.
AmigaOS Manual: AmigaDOS Advanced Features
The information in this appendix is intended for experienced AmigaDOS users. It includes the following:
- Customizing the window
- Customizing your Shell environment
- Using Escape sequences
- Customizing startup files
- Customizing Kickstart
Customizing the Window
The Shell supports a WINDOW Tool Type in the Shell icon that allows you to specify the size, position, and features of the Shell window. The format of the Tool Types is as follows:
For a description of the options and arguments for the Shell window specification, see the description of the NEWSHELL command in Chapter 6 and the examples in Chapter 8.
Public Screens - PUBSCREEN Option
Applications creating screens can mark them as public, enabling other applications and utilities to open windows on the same screen. AmigaDOS commands that have PUBSCREEN/K in their templates allow the commands to open windows on public screens.
For example, the Input Preferences editor template contains PUBSCREEN/K; open this editor on a public screen by entering the following:
1> INPUT PUBSCREEN "public screen name"
You must supply the name of the public screen. The internal names for public screens are given by applications and do not necessarily match the screen title printed in the screen's title bar. A screen's name can be the same as the application's name; however, consult the application's documentation to determine if it opens public screens and how it names them.
Customizing the Shell
You can customize your Shell environment by changing the S:Shell-startup file, which is a script that is executed each time a new Shell is opened. You can edit Shell-startup to set up command aliases and to change the Shell prompt.
An aliases is an abbreviation for a long and/or frequently used command. Aliases can be local or global. Local aliases are entered in a Shell window and are only recognized in that Shell. Global aliases area entered into the Shell-startup file and are recognized by all Shells.
The Alias format is as follows:
ALIAS <name> <string>
where <name> is the alias name to be entered at the Shell prompt to execute a command. The <string> is the command line to be executed.
See Chapter 6 for a full description of the ALIAS command and Chapter 8 for a list of useful aliases.
Changing the Prompt
The PROMPT command lets you customize the Shell prompt. By default, it shows the process number, a period, the current directory, a right angle bracket (>), and a space:
The prompt can display almost anything, with or without the process number and directory information. The return code of the last command executed can be included. The prompt can contain escape sequences, allowing you to change text color and style in the prompt string or clear the screen.
Benefits of customizing your Shell prompt include making the prompt:
- Easier to distinguish from commands and their output
- Match a prompt style with which you are familiar
- More informative
See Chapter 8 for examples of how to use escape sequences to make the prompt more readable.
Using Escape Sequences
Escape sequences can control how the text appears in a console window, such as the texrt color, style (bold, italics, underline), and margins. AmigaDOS recognizes standard ANSI X3.64 sequences entered on the command line or embedded in strings. Escape sequences consist of one or more characters, sometimes with a numerical argument, prefaced by the escape character. Spaces are not normally used in the sequence of characters.
The escape sequence is shown using the following format:
|Esc||Represents the Escape key. Press Esc or substitute *E if you are in an application such as ED that uses the Esc key for its own purposes. When you press Esc, a reversed-color open bracket ([) appears in the console window.|
|[||Represents the open bracket key, displayed in Figure D-1. If you country's keyboard does not have an open bracket key, press Alt plus the key shown, regardless of what is shown on the keycap.|
|#||Represents a numerical argument.|
|X||Represents an alphabetic key. Escape codes are case-sensitive. If an upper case letter is shown, press Shift and the key. If a lower case letter is shown, press the unshifted key.|
The standard escape sequences for console windows are:
|Escc||Clears the window and resets all modes to defaults.|
|Esc[0m||Resets graphics modes to defaults.|
|Esc[1m||Turns on text boldface.|
|Esc[3m||Turns on text italic.|
|Esc[4m||Turns on text underlining.|
|Esc[7m||Turns on reverse video text.|
|Esc[8m||Makes text match background color.|
|Esc[22m||Turns off boldface.|
|Esc[23m||Turns off italics.|
|Esc[24m||Turns off underlining.|
|Esc[27m||Turns off reverse video.|
|Esc[28m||Returns the text color to normal.|
|Esc[30m||Turns on text color0 (background, default grey).|
|Esc[31m||Turns on text color1 (shadow, default black).|
|Esc[32m||Turns on text color2 (shine, default white).|
|Esc[33m||Turns on text color3 (accent, default blue).|
|Esc[3#m||Turns on text color# (4-7).|
|Esc[39m||Turns on text default color (color1).|
|Esc[40m||Turns on text background color0 (default grey).|
|Esc[41m||Turns on text background color1 (default black).|
|Esc[42m||Turns on text background color2 (default white).|
|Esc[43,||Turns on text background color3 (default blue).|
|Esc[4#m||Turns on text background color# (4-7).|
|Esc[49m||Turns on default text background color (color0).|
|Esc[#u||Sets maximum length of lines in window to #.|
|Esc[#t||Sets maximum number of lines in window to #.|
|Esc[#x||Starts text # pixels from left edge of window.|
|Esc[#y||Starts text # pixels from top edge of window.|
The escape sequence is executed when you press Return or when the string containing the sequence is printed.
Certain characters cannot normally be used in string arguments for AmgaDOS commands. Preceding these characters with an asterisk allows them to be used in string arguments for most commands, as follows.
|*E||Represents the Escape key in a string.|
|*N||Forces a new line in the output.|
|*"||Allows a quotation mark character inside quotation marks.|
|**||Gives a single asterisk.|
Customizing Startup Files
Each time your Amiga is booted, it executes the Startup-sequence script file Startup-sequence script file located in the S: directory. The Startup-sequence file allocates disk buffers, makes device assignments, reads saved Preferences settings, and performs other functions that configure the Amiga for use.
Because any errors introduced into the Startup-sequence file can cause a fatal disruption of the normal system startup, we strongly recommend that you do not alter your Startup-sequence file. Instead, we recommend that you create a file called User-startup in the S:directory. Creating a User-startup file allows you to customize your system at startup while preventing any disruption of the normal booting process. This file is automatically executed by the Startup-sequence before opening Workbench.
|Do not modify the original Startup-sequence file. Altering your Startup-sequence file can cause fatal system startup errors.|
The User-startup and other startup files in the S:directory can be modified to run programs at startup, print special introductory messages, or automatically open a Shell window on the Workbench screen. Any AmigaDOS command can appear in a startup script, including commands to execute other scripts.
Refer to Chapters 6 and 7 for complete specifications about each command before making changes to any existing script.
Editing Startup Files
If you have a floppy-only system, make changes to your startup files only if you are working on a copy of your Workbench disk, not the original. If you make a mistake in your startup files and the execution of the Startup-sequence is aborted, only a Shell prompt remains. Normally, the FAILAT 21 command ensures that the Startup-sequence completes execution even after an error.
As long as you do not alter your standard Startup-sequence file, the possibility of a serious startup error is unlikely. If you attempt to boot from a disk that has no file named S:Startup-sequence or there is serious error in the startup process, you may see a screen similar to that shown in Figure D-2.
This is a Shell window at which you can enter commands, but from which your usual aliases and search path may not be available. This Shell allows you to try to edit the startup file that caused the problem. Because the system has not been fully configured, this can be difficult. It is usually easier to reboot using a different disk.
When editing your User-startup file:
- Be sure to use the correct command syntax. Test any commands you plan to insert into the User-startup in a Shell window first. If a command works properly in the Shell, it should work as expected in the User-startup.
- Pay attention to the order of commands commands:order of commands in script in the script. Some commands, such ECHOcommands:ECHO and RESIDENT, can be put anywhere. However, when inserting commands that refer to directories and files, an error can result if you reference anything that has not yet been created, assigned, or given a valid path.
- Specify the complete path to directories that you wish to access.
- Add commands to your scripts. If you insert a semicolon at the end of a command line, anything to the right of the semicolon is ignored by AmigaDOS, but appears in the script as a comment. For example:
- ASSIGN T: RAM:T ; set up directory for scripts
- explains why you inserted the command.
- Test changes to your User-startup file. When experimenting with your User-startup file, reboot your Amiga after each change to test the result. However, be sure to wait until you are sure the file is completely written to disk before the reboot to avoid potential data loss.
Common Additions to the Startup Files
The following is a list of some of the most common additions that can be made to your startup files.
- Opening a Shell window
- Adding directories to the search path
- Adding logical device names to the assign list
- Making additional commands resident
- Starting input commodities and other programs
- Adding drive cache buffers
The PIPE: device transfers data from one program to another using temporary storage in RAM. Use a pipe: when you wish to apply output from one process as input to another process. Using a pipe to transfer data reduces the possibility of running out of memory when working with very large files and eliminates the need to create, save, and later delete a file needed only once.
The source and destination processes cannot be the same when using PIPE:. As you write information to the pipe, another process can read the data in First In First Out (FIFO) order. Providing a name after PIPE: gives the pipe a name.
Data sent to PIPE: is buffered in memory. When another application reds the pipe it gets the data in the order it came in. The pipe stays in RAM until its contents are emptied by the reading processes or until the next reboot.
PIPE: uses at least a 4 KB buffer per pipe-name. When the maximum buffer capacity is reached, PIPE: stops accepting data until another process reads data out of the buffer. If a process is reading data, it waits until more data arrives in the buffer. Buffer size can only be specified on the first reference to a particular channel.
The following are the options for PIPE:PIPE:options.
|channel_name||A unique channel name. Must begin with a non-numeric character. The channel_name is optional; using PIPE: alone is possible if not using multiple pipes.|
|Buf_size||Size in bytes of the buffer to allocate. (The default size is 4 KB). The buf_size is optional.|
|max_buffers||Maximum number of buffers allowed. Suspends the output channel if exceeded. Max_buffers = 0 indicates there should be no fixed limit on the number of buffers allocated.|
PIPE: can be used from other programs, such as word processors or terminal programs. You can use any pipe-name. If the application reads the file sequentially, you can specify PIPE:<name> and it appears the same as an ordinary file to the application.
Information from one pipe can be copied to another. For example:
Shell window 1:
COPY Hugefile PIPE:a
Shell window 2:
COPY PIPE:a PIPE:b
Shell window 3:
COPY PIPE:b PIPE:c
Shell window 4:
COPY PIPE:b PIPE:d
Shell window 5:
COPY PIPE:d PIPE:e
Shell window 6:
TYPE PIPE:e ;Hugefile is TYPEd
The DOSDrivers mount file for PIPE: mount files:for PIPE:is as follows:
Handler = L:Queue Handler Priority = 5 StackSize = 3000 GlobVec = -1
PIPE: is mounted by default during the standard Startup-sequence.
See Chapter 8 for additional PIPE: examples.