AntOS Library — floppy (reference)

The floppy library's design and native core — flux-level access to real floppy disks through a Greaseweazle, the decode/encode pipeline above it, and the disk tool's operations. The script-facing API is luau_floppy.

What it is

floppy is the device and pipeline library for real floppy disks: enumerate and open a Greaseweazle, read and write flux, detect a disk's format, decode it to sectors, encode back, copy disk to disk, format, verify, and inspect bootblocks. It is the lower of the two levels described in filesystem — the upper level being the auto-mounted drive letter, which is floppy's own mounter presenting a decoded disk to the VFS.

Design notes

  • floppy is a device library, and deliberately not part of fs. fs is metadata, structure and search over volumes that already exist; it has no device surface and gains nothing by acquiring one. The two meet at exactly one point: floppy's mounter hands a decoded disk to the VFS, after which fs sees an ordinary catalogued volume and neither library knows about the other.
  • The stateless codecs live in data, not here. MFM and GCR bit-cell transforms and the disk checksums are pure byte-in/byte-out and belong with the other codecs; floppy calls them. What stays here is everything that is not a pure function of its input — clock recovery, sync hunting, track segmentation, weak-bit and unformatted-area detection — because each of those additionally depends on a recovered clock and a tolerance policy. The dividing line is purity, and it is the same line that keeps data linkable by net, DBFS and firmware without dragging a device driver in behind it.
  • Two levels, one device. Everyday use is a drive letter; anything the auto-mounter cannot or should not hide — an unknown, damaged or copy-protected disk, an explicit format override, a flux-level archive — is a call away on the same open device. Neither level is a fallback for the other.
  • Decode reports per-sector status, always. Every decode returns a status map alongside the data, because a partly-readable disk is the normal case for real media and the tool's error grid is drawn straight from it. A decode that returned only "ok" or "failed" would make the interesting half of the job invisible.
  • Nothing writes to a disk without being asked. Write-protect is checked before an operation that needs it is offered, not partway through; bootblock repair replaces a bootblock rather than zeroing it; and a signature match is reported for the user to act on, never acted on automatically. These are inherited decisions — see floppy for where they come from and why they were right.

Signature data

Bootblock virus signatures are a data table the library loads, not compiled-in constants: a flat list of (offset, u32, name, provenance). Shipping it as data means the set can be corrected or extended without a rebuild, and each entry can carry a note on where it came from — which matters for a corpus this old.

Native core — libantos_floppy

Plain C over the Greaseweazle USB protocol, running on DeMon. It owns the device session, the flux buffers, the decode state machines, and the mounter that publishes a decoded disk to the VFS. Format descriptions are table-driven rather than one function per format, so adding a geometry is data.

Related

Important: The Ant64 family of home computers are at early design/prototype stage, everything you see here is subject to change.