7.1.4) How is the Input/Output subsystem of the Atari OS organized?

Derived primarily from the Operating System User's Manual and De Re Atari.

The Input/Output (I/O) subsystem of the Atari Operating System (OS) comprises
a collection of software utilities/routines, offered at three different levels
of abstraction (CIO, Device Handlers, SIO), that allow for user communication
with local system and peripheral devices.  Communications between adjacent
levels of the I/O subsystem are carried via one of the three types of I/O
system control blocks (IOCB, ZIOCB, DCB).

Presented in order from the highest level to the lowest level:


Carries communications between a user program and Central I/O (CIO)
- 8 IOCBs (#0-#7) are provided by the OS. 
- Each IOCB can be assigned to control any device/file.
- IOCB #0 is assigned by the OS to the E: Screen Editor at power-up and
   system reset.
- Software programming environments may reserve other IOCBs for internal
   use.  For example, Atari BASIC uses IOCB #6 to interact with the S:
   device when using graphics modes other than zero, and uses IOCB #7 for
   I/O with the printer, disk drive, and cassette.  (Patchett/Sherer,
   Master Memory Map, http://www.atariarchives.org/mmm/iocbs.php)

CENTRAL I/O (CIO) utility/routine
Intended for user program access to system and peripheral devices.  A device
consists of one or more "files" where each file consists of a sequential
collection of data bytes.  Files are optionally organized into "records" which
are delineated by the End Of Line character/byte ($9B).  8 basic functions
PUT RECORD, GET STATUS, Special (handler-specific)
Additional CIO features:
- Device independence
    - Single entry point for all devices (and for all operations)
    - Device-independent calling sequence
    - Uniform rules for data transfers, regardless of actual device storage
      block sizes
- Data access methods
    - Byte-aligned.  Any number of bytes can be read or written, and the
      next operation will continue where the prior one left off.
    - Record-aligned.  A single record of bytes can be read or written, and
      the next operation will continue at the beginning of the next record.
- Multiple device/file concurrency
    - Up to 8 device/files can be accessed concurrently, each operating
      independently of the others.
- Unified error handling
- Device expansion: while the OS supplies several device handlers in ROM,
   CIO also supports the loading of additional CIO-compatible device
   handlers into RAM.

Carries communications between higher-level CIO and lower-level device
handlers.  There is a single ZIOCB only.

Device-specific communication.  Handlers provided by the Atari OS:
- K: Keyboard Handler (read only)
- S: Display Handler (read/write)
      Offers the special CIO commands DRAW and FILL.
- E: Screen Editor (read/write)
    - Uses the K: Keyboard Handler and the S: Display Handler to provide
      "line-at-a-time" input with interactive editing functions, as well as
      formatted output.
- C: Cassette Handler (read/write)
- P: Printer (write only)
    - 400/800 OS: Supports a single printer device; any
      device number is ignored.  All powered printers attached via SIO or
      the 850 parallel port respond to all print commands.
    - XL OS: Supports 8 different printer devices: P1:-P8:
      P: (no device number) is interpreted to mean: P1:
      Printer devices are associated with specific models of Atari printers as
        P1: All printers attached via SIO or the 850 parallel port
        P2: 850 Interface Module parallel port (e.g., Atari 825)
        P3: 1025 Printer
        P4: 1020 Color Plotter
        P5: 1027 Printer
        P6: 1029 Printer
        P7: XMM801 Printer
        P8: XDM121 Printer
      Tomasz Krasuski contributes (May 2011):
        This feature is buggy in XL OS Rev.A/Rev.B/Rev.1.  Behavior was
        fixed to reliable operation as of XL OS Rev.2.
- Diskette Handler, Resident
    - Not a full device handler; not CIO-compatible
    - Except for Atari DOS I, normally only used to load a full File
      Management System from disk
Nonresident Handlers can be added to the system environment in several ways:
- Loaded from diskette or cassette
- Loaded from the ROM of an SIO device (850 interface, 1030 modem).  May be
   loaded at system startup without disk drive ("bootstrap without disk
   drive"), may be loaded as part of a Disk Boot ("bootstrap with disk
   drive"), or may be loaded afterward.
- XL OS Rev.1+: Loaded from a New Device attached via PBI or Cartridge+ECI

Carries communications between higher-level device handlers and lower-level
Serial I/O (SIO).  There is a single DCB only.
- Also used by the OS-resident Diskette Handler

SERIAL I/O (SIO) utility/routine
Low-level communication with serial bus peripherals
- Control of all Serial bus I/O, conforming to the bus protocol
- Bus operation retries on errors
- Return of unified error statuses on error conditions
- Used by the OS-resident P: handler
- Not used by the OS-resident K: S: and E: handlers (non-SIO devices)
- While the OS-resident C: handler uses the SIO bus hardware, it does not use
   the SIO utility/routine.

Any lower level (lower than CIO) access to a device by a user program involves
the direct reading and writing of the hardware registers associated with the
About Us - Contact - Credits - Powered with Webdev - © Atarimania 2003-2018