Chapter 10 of 14
Open a device by name
Imagine removing the output cable from a terminal and plugging it into a disk. Programs would need radically different electrical signals for those two devices. OS-9 gives a program a simpler operation. Write bytes to an open path. The system finds the right file manager and driver for that path. See the dispatch in the live device table.
Catch the drive while it is open
Use a fresh filename on HD1. From Shell+ enter:
devs >/h1/devices
list /h1/devices
dmode /h1
There is a reason to save this particular report. While devs examines the active device table, its output file holds H1 open. If you just run devs at a prompt, an idle H1 may be absent from the display. The saved report records the conditions at the instant the utility ran.
Look for H1, EmuDsk and RBF on one row. The descriptor names the device and specifies its driver, file manager and operating parameters. RBF, the random block file manager, understands directories, files and disk sectors. EmuDsk is the driver that talks to the emulated virtual disk controller. In this profile, dmode /h1 reports drive number 01, and VCC Plus assigns the second working image to HD1. A different controller can use a different driver under an RBF filesystem.
Trace three paths from the same shell
| If the program sends bytes to… | Follow the request |
|---|---|
| A file under /h1 | IOMan dispatches through RBF. RBF resolves the file and its sectors. EmuDsk transfers blocks through the virtual hard-disk device to the image assigned to HD1. |
| The terminal /Term | SCF handles a stream of characters and its terminal options. The VTIO driver and the CoCo keyboard and display components deliver the interaction. Read the Term row next to H1 in the figure. |
| A shell pipeline | PipeMan manages a buffered stream with the supplied Piper driver. The writer sends bytes to one end. The reader takes them from the other. Closing the last writer lets the reader detect the end of the stream. |
The program refers to an open path number during I/O. It need not resolve the pathname or understand sectors each time it writes a line. The shell can arrange path 1 before launching the child, which is how the same program can write its report to any of those three destinations. A device descriptor is a named module that tells OS-9 how to reach a device. An open path holds the state of a particular opening, such as a file’s current position and access mode.
The graphic panels in VCC Plus show which host images are attached to the emulated drives. The guest device table shows the software OS-9 is using to reach them. Compare the quick-start equipment map with the same two assignments in your current profile. For the division of responsibilities see The NitrOS-9 Project, NitrOS-9 Technical Reference, revision 0.1 (2004), chapters 4–7, pp. 33–86.