Make a device
A host does not have to build its devices in. On the device bus each device is a separate program, a driver, that talks to the core (the part that runs the processor) over a Unix-domain socket. A driver is written once, in any language, and works with any core that speaks the bus: the reference core terse-bus, tcore, or the hosts of "Make a host". One driver process serves every machine of a run, each with its own state.
Two examples
The terminal, device 2, written as a driver in two languages, each one file with no dependencies:
- In Go, in
examples/device/go: Make a device in Go. - In Rust, in
examples/device/rust: Make a device in Rust.
Each does just enough of the terminal for programs/hello: under the reference core, hello gives exactly the hashes it gives with the reference terminal, frame after frame. Each also runs under the other language's host, which is a good test of both.
What makes a device
A driver that serves a slot must implement the whole device: every call, exactly (results, charges, state), since a program can ask device which devices it has and relies on all of each, and the state hash covers it. There is no partial device. So the examples are honest about what they are: enough to show hello, not yet a terminal. Each page lists what is missing; it is what native/driver-example/terminal.c has, a complete terminal driver in one file of C (583 lines) that draws nothing. Only a complete driver may be installed as a user's own (terse drivers add, on the next page).
A new device is a change to the specification, or an experimental device on a slot of its own (DEVICES.md section 15); a made-up device on an unused slot is never asked for.
The full implementations:
native/driver-example/terminal.c: the terminal, complete, the example's README giving the reason for each step;crates/terse-devices: the reference drivers, one program per device, withcrates/terse-core/src/terminal.rsfor the terminal itself;crates/terse-devices/python/vector.py: the 2D and 3D vector displays in about 330 lines of Python.
The bus in full is DEVICES.md; section 13 lists what a minimal driver must do.