Modular Computers the manual GitHub

The bus

The bus is the list of devices a computer can talk to. A program never reaches a block in the world directly: it reaches whatever is on its computer’s bus.

What is on a bus

The CPU decides how big the bus is

How many devices fit comes entirely from the CPU: a tier 1 bus holds 4, tier 2 holds 16 and tier 3 holds 64. The case’s own devices count against it as much as external ones, so a tier 1 bus holds the essentials: an EEPROM, a battery, a disk and one card or external device.

When a bus is full, the devices that don’t fit wait, shown as such, and are not on the bus. A program can ask how full the bus is.

Bus order

The order of the bus is like a PC’s UEFI boot order. The case’s own connectors come first, in their fixed order. External devices follow in a saved list that you, the player, can reorder. The list is kept by device id, so a device in a chunk that loads late, or one that is unplugged for a while, keeps its place and shows as offline meanwhile. A device seen for the first time goes to the end of the list. You can disconnect an external device: it stays in the list, in its place, but is not on the bus.

The boot EEPROM tries the disks in bus order, so the order decides which disk starts the computer.

A device behind another

Some devices sit behind a host, as a USB dock’s drives sit behind the dock. The disks in a Disk Station are on the bus only while the station is. If the station is disconnected, missing, or held by another computer, its disks show offline too, and if the bus has no room for the station, they stay off. This is one rule in the bus order and holds for every such host.

One bus at a time

A device is on one computer’s bus at a time. If two computers could reach the same screen or cabled disk, whichever computer has it first holds it; the other sees it as absent until the first lets go (the device is unplugged, or that computer unloads or loses its CPU). Then the others lay out their buses again and the first to do so takes it. Holds are worked out afresh as computers load and are never saved.

Two computers on one cable are therefore not sharing a disk; they are two hosts on the same cable. What they can share is the network: see Network card and Networking in mcos.

Hot-plug

External devices come and go while a computer runs. A device that isn’t there isn’t on the bus, and calls to it fail at once instead of stopping the machine. The bus raises its own interrupt when it changes, and mcos reads it again and mounts or unmounts disks as they come and go (see Filesystem).