Peripherals
Overview
Peripherals extend the NCS/e with additional input, output, storage, communications, and other hardware capabilities.
Programs communicate with most peripherals using EXT verbs. These use the same instruction syntax as native CPU operations, but are handled by the connected peripheral rather than by the CPU itself.
For example:
D.TXT "Hello, world!"
D.BLT
PRINT.NEW
PRINT.DATA "Hello, world!\n"
PRINT.DONE
Peripheral verbs are grouped into namespaces identifying the interface they belong to. D.*, for example, provides the standard Display interface, while PRINT.* provides the standard Printer interface.
Peripheral availability
Peripherals are not part of the base CPU and may not be present in every NCS/e system.
Programs using a peripheral require a compatible implementation of its interface to be connected.
Different peripherals may implement the same interface. Programs generally communicate with the interface rather than depending on a particular physical peripheral model.
Operands and locations
EXT verbs receive the operands supplied by the program in the same general form as native CPU instructions.
An operand may provide a value directly:
D.CUR 10 4
or identify a location that the peripheral may read from or write to:
D.CURGET $000 $001
How each operand is interpreted is defined by the peripheral verb.
A location may therefore be used as an input, an output, or both. The peripheral is responsible for interpreting values according to the operation being performed.
For example:
D.CURGET $000 $001
writes the current cursor coordinates to $000 and $001.
Similarly:
NET.LOCAL.RECV $000 $001 $002 $003
may write several different kinds of values:
| Location | Value |
|---|---|
$000 |
Message body. |
$001 |
Channel. |
$002 |
Sender name. |
$003 |
Sender UUID. |
Memory itself remains untyped. The peripheral verb determines how input values are interpreted and what representation is written to each destination.
Peripheral documentation identifies the expected operands and locations modified by each verb.
Peripherals may also report errors through the er register.
Execution
Peripheral calls may be synchronous or asynchronous.
A synchronous operation completes before execution continues:
D.BLT
MOVE $000 1
An asynchronous operation allows execution to continue without waiting for the peripheral operation to finish:
D.BLTN
MOVE $000 1
When synchronous peripheral calls appear among coalesced instructions, the current program line waits for the call to complete before continuing with the next instruction.
Standard peripherals
The standard NCS/e peripheral interfaces include:
- Display — Character display and graphics attributes.
- Keyboard — Buffered text input.
- Printer — Document output.
- Modem — Local, grid, HTTP, and email communications.
Additional peripherals and expansion hardware may provide their own EXT interfaces.