Copyright (c) Hyperion Entertainment and contributors.
AmigaDOS Device Input and Output
AmigaDOS uses handlers and filesystems to provide a standard method of interaction with physical I/O devices. Handlers and filesystems are similar; handlers are a subset of a filesystem, supporting only a few I/O operations, while filesystems include additional support for file operations as well as directory-type operations. Handlers and filesystems reside either in ROM or in the L: directory.
Handlers and filesystems are often referred to as "AmigaDOS devices" but keep in mind that an AmigaDOS device is different from an Exec device. AmigaDOS devices appear as names within the DOS name space, for example, SER:, RAM: or DF0: (rather than Exec's serial.device or trackdisk.device). AmigaDOS devices are often built on top of Exec devices using the Exec device to perform the low-level functions.
Examples of this type include:
- The Port-handler (SER:, PAR:, and PRT:) which is built on top of the serial.device, parallel.device, and printer.device.
- The filesystem (DF0:, DF1:) which is built on top of the trackdisk.device.
- CON: (console handler) which is built on top of the console.device.
It is not required for a handler or filesystem to be built on top of an Exec device. In some cases the handler manages its own resources. For example, for the RAM-handler the resource being maintained is RAM. While the memory used by the RAM-handler is still allocated by Exec, there is really no underlying Exec device.
Note that, unlike an Exec device, each handler and filesystem executing must have its own process.
AmigaDOS Devices
Here is a list of AmigaDOS devices implemented as handlers. Note that some handlers have more than one name. (RAW: and CON: are the same handler with different names. The port handlers SER:, PAR:, and PRT: are also implemented as a single handler with more than one name.)
AUX:
The AUX: handler provides unbuffered serial I/O. It is basically a console handler that uses the serial port rather than the Amiga screen or keyboard. For instance, the command NEWSHELL AUX: allows you to run a Shell over the serial port.
CON:
Provides buffered keyboard and screen I/O and allows definition of a new window for the output. With CON:, keystrokes are buffered and held back from the application until the user presses the RETURN key. The keyboard input is filtered: function keys and cursor keys are not transmitted. Other keys are automatically echoed in the CON: window.
The window is specified using x/y/width/height/title where x and y are the distance from the top and left edge of the screen the window should open. For instance, the command TYPE >CON:5/5/100/100/Output DEVS:mountlist shows the mountlist file in a new window named Output which is 100 x 100 pixels and is positioned 5 pixels down and to the right of the upper left corner of the screen.
Instead of using a new window for the output, you can send it to the currently selected window by using * instead of CON:x/y/width/height/title.
Under V2.0 and later versions of AmigaDOS, there are new keywords which allow further customizing of the CON: window. These new keywords may appear in any order after the title string in the CON: specifier (use a slash to separate them). The new keywords are:
AUTO | Don't open window until or unless I/O occurs |
CLOSE | Put a close gadget on the window. If the user closes the window, a read from CON: will return -1L; a read from RAW: (or a CON: in raw mode) will retuirn the Raw Event escape string for a close gadget. |
WAIT | Hold off close until user clicks the close gadget or types Control-\. |
WINDOW 0xaddr | Use window pointed to by addr (may be [on] a custom screen). |
SCREEN name | Opens on the public screen specified by name. |