# devices file

The devices file contains an item
for every terminal or printer device recognized by the D3 System.
The actual escape sequences produced by @ functions
in BASIC and PROC are defined within these device drivers.

## Description

The item-IDs are device codes
(for example, WY-100 is the WYSE WY-100 terminal). The define-terminal command defines additional terminals and printers.

The attributes
in the devices file for terminals are:

| Attribute | Name | Description |
| --- | --- | --- |
| 0 | | Full name and model number information for device. |
| 1 | desc | Description of device |
| 2 | bks.ss | ASCII character for backspacing, number of columns, number of rows |
| 3 | c.add | Device x-y cursor addressing statement will begin with ’=m’ |
| 4 | cac | Cursor Addressing Code |
| 5 | | CRT Functions statement will begin with ’=s’ |
| 6 | cls | @(-1) Clear screen and home |
Note: This file contains terminal specific code that can
cause your terminal to lose its characteristics during updates. When
an item in this file is modified, the term (c command *must* be run to recompile the device definition.

The
attributes in the devices file for printers are:

| Attribute | Name | Description |
| --- | --- | --- |
| 0 | | Full name and model number information for device. |
| 1 | desc | Description of device |
| 2 | points | ASCII character for backspacing, number of columns, number of rows |
| 3 | lpi | Device x-y cursor addressing statement, If applicable, will begins with ’=m’ otherwise the statement will contain a ’!’ (comment) |
| 4 | lpp | Cursor Addressing Code, if applicable, otherwise the statement will contain a ’!’ (comment) |
| 5 | orient | CRT Functions statement will begin with ’=s’,if applicable, otherwise the statement will contain a ’!’. |

## Example(s)

Show all the devices defined.

```
sort only devices
```

## CRT Control Language (CCL)

D3 has a universal
device function, the @() to specify certain terminal
and printer commands.

To perform a certain feature the programmer
will use the equivalent @() function. At runtime,
the system will look up the function and substitute the proper character
string then output it to the device. In this way, the compiled BASIC
program does not have to contain hardware specific commands.

This method of device independence is achieved by creating many look-up
tables - one for each device. Each look-up table contains over 300
different popular device functions, features and modes. Each function,
referred to as an @() function has a corresponding
character string which is output to the device. Such a look-up table
is considered to be a "script" written in D3’s CRT Control Language
or CCL.

D3 has expanded the uses of the @() functions to include printer devices as well.

Typical uses
of the @() function:

**Example 1**

- A user logs on and the system assigns a default device to the user

- The system inserts the default device from the dm,devices,file into the user’s CRT Control Block (CCB)

- When the user runs a BASIC program with an @() function, the system goes to the CCB, scans to find the proper @ function number and outputs the data string therein.

**Example 2**

- The user enters a TERM or TERM-TYPE command which specifies a device in the dm,devices,file

- the system retrieves the device from the dictionary of the dm,devices,and overwrites the CCB effectively changing the terminal type

- Now, when the user runs a BASIC program with an @() function, the system goes to the "new" CCB and finds the proper @ function and outputs the data string.

**Example 3**

- For printers, the system inserts the default printer device from the dm,devices,file into the user’s Printer Control Block (PCB)

- When the users enters an ASSIGNFQ or STARTSHP command which specifies a device in the dm,devices,file, the system retrieves the device from the dictionary of dm,devices,and overwrites the users PCB effectively changing the printer types

- Now when the user runs a BASIC program and prints to that device with an @ function, the system goes to the ’new’ PCB and finds the proper @ function and outputs a different data string.

A CCL script contains of several sections, each section contains
sentences, each sentence contains data elements

The specific
information for creating a CCL script is contained in the crt.control.language
item in the dm,devices, file. The information
can be displayed by using:

```
op dm,devices, crt.control.language.
```

## See also

- [.font command](https://d3codex.com/output-processor/dot-font-command/)
- [@() function](https://d3codex.com/pickbasic-flashbasic/at-parenthesis-function/)
- [assignfq (UNIX) command](https://d3codex.com/tcl/assignfq-unix-command/)
- [choose.term command](https://d3codex.com/tcl/choose-term-command/)
- [define-terminal command](https://d3codex.com/tcl/define-terminal-command/)
- [listabs command](https://d3codex.com/tcl/listabs-command/)
- [term command](https://d3codex.com/tcl/term-command/)
- [term-type command](https://d3codex.com/tcl/term-type-command/)
- [termp command](https://d3codex.com/tcl/termp-command/)

---
Source: https://d3codex.com/systemfiles/devices-file/ - part of the D3Codex reference.
