# The disk interface: VL-1772-02 and the slot-in drives ## On the SAM Coupé (DOC: TECH p11-12) - Each drive is a self-contained slot-in unit carrying its own controller: "Both the internal drives and the SDI use the VL-1772-02 disk controller chip manufactured by VLSI" (a second-source WD1772-02). Up to two drives; drive 1 on the left, drive 2 on the right. The external drive interface (SDI) drives Shugart 5.25" or 3.5" units with the same chip. - Drives: Citizen slimline 3.5" double density, 1 Mb unformatted, 780K formatted (SAMDOS's 80 tracks x 2 sides x 10 sectors x 512 bytes = 800K: the 780K figure is the usable space, HYPOTHESIS until a DOS document is read). - Ports: drive 1 at E0-E7, drive 2 at F0-F7. Offset bit 2 selects the disk **side** (so the side line is driven by A2, not by a separate latch): 0/4 status (read) or command (write), 1/5 track, 2/6 sector, 3/7 data. "Offsets 4-7 can be ignored for single sided disk drives." - Each drive connector carries D0-D7, A0-A2, WR, RST, an 8 MHz clock and its select line (TECH p11 pin list). No interrupt (INTRQ) or DRQ line appears on that list, so the ROM and DOS poll the status register (HYPOTHESIS from the pin list, U12). - The ROM boots from drive 1 (the "BOOT" key, F9). MAME runs a WD1772 at 8.00 MHz in each drive (OBSERVED, `-listdevices samcoupe`). ## The chip (DOC: WD177X, WD86) The WD1772 is the WD1770 with faster step rates: commands Restore, Seek, Step, Step-in, Step-out (type I), Read/Write Sector (II), Read Address, Read Track, Write Track (III), Force Interrupt (IV); an on-chip data separator and write precompensation; motor-on control; 8 MHz clock. The -02 differs from the -00 in its settling time (WD86: 15 ms on the -02). The step rates conflict between the preliminary and production sheets (atarist-python C3: WD177X 2/3/5/6 ms vs WD86 6/12/2/3 ms): follow WD86, the production sheet. ## Image formats (to be confirmed from documents before M5) `.mgt` (raw 819,200 bytes: 80 x 2 x 10 x 512, the format SAM DOS and MasterDOS use, also the +D/DISCiPLE's), `.sad` (SAM Disk, with a header), `.dsk`/EDSK (Amstrad-style, used by SAMdisk for copy-protected disks), `.td0`. The board starts with `.mgt` (a sector image) and models the drive at sector level; EDSK and flux-level images wait for copy-protected titles. Simon Owen's SAMdisk and mgtdisklib (both MIT: code OK with notice) document these formats in code; nothing is taken from them yet. ## Reuse: the wd177x discussion Four Phase 0 boards before this one met the same chip family and proposed a shared core: | Board | Part | Its recommendation | | --- | --- | --- | | atarist-python | WD1772 | `wd177x-python` with WD1770, WD1772 (-00, -02), WD1773 and FD179x/WD279x rows, the drive included, image formats excluded; extract when the second of ST, BBC, MSX is built (decision 6) | | bbcmicro-python | WD1770 (B+, Master) | board; extract on a second user (decision 7) | | coco-python | WD1793 / WD2797 | `wd179x-python`, extracted by the first board that needs it at command level (decision 5) | | oric-python | WD1793 (Microdisc), WD177x (Jasmin) | board now; a shared core when a second board reaches its disk row (decision 6) | | msx-python, ti99-python | WD2793, FD1771 | noted as users in the others' tables | | **samcoupe-python** | **VL-1772-02** (WD1772-02) | **join the shared core; do not write a second model** | The SAM adds one requirement: **two controllers at once** (one per drive, each with its own registers and state), and the side select on A2. A shared core must therefore be an instantiable chip with the drive attached, not a module-level singleton, which is what atarist-python's proposal already describes ("the drive included"). **Recommendation (open decision 4):** whichever of ST, BBC, CoCo, Oric or SAM reaches its disk milestone first writes the WD177x/179x model inside its board behind a pin-shaped interface (`read(offset)`, `write(offset, value)`, `tick(cycles)`, `intrq`, `drq`, a drive object with `step`, `side`, `index`, sector or track access) and the second extracts it to `wd177x-python` with history (chip rule). The SAM's disk is milestone M5 here, so it is unlikely to be first; if it is, the same rule applies.