Skip to content

Acorn Electron (DFS): runtime disk insertion only mounts drive index 0 #1859

Description

@ibitato

Scope

Acorn Electron only, with DFS enabled (has_dfs → 1770 DFS ROM + Electron::Plus3 WD1770 controller).

This report is based on:

  • observed behaviour in CLK 26.06.06 (macOS, bundle id TH.Clock-Signal), and
  • source review at commit f0d7068 (2026-06-06 release line).

Problem

The Electron disk controller exposes two emulated drives, but insert_media always attaches the first (or only) disk image to drive index 0. Drive index 1 is never populated by insertion, so MOS commands targeting drive 1 fail with Disc fault 18 when no disc is present there.

The MOS command *DRIVE 1 selects the default drive for subsequent DFS operations; it does not influence where CLK attaches an inserted image. Insertion is handled entirely inside CLK and is hard-coded to drive index 0.

Steps to reproduce

  1. Open/create an Acorn Electron machine with With Disk Filing System (DFS) enabled.

  2. Insert a DFS .ssd (drag-and-drop onto the window, or Insert Media…).

  3. At the > prompt:

    *DRIVE 0
    *CAT
    

    The inserted catalogue is shown.

  4. Then:

    *DRIVE 1
    *CAT
    

    Result: Disc fault 18 at :1 00/00.

  5. With *DRIVE 1 still selected, insert a second .ssd via drag-and-drop or Insert Media…, then:

    *CAT
    

    Drive 1 still reports disc fault 18. The newly inserted image is attached to drive index 0, not drive 1 (verify with *DRIVE 0*CAT).

Expected behaviour

Software that uses two physical/logical drives (master + data disc) expects a disc image in both drive index 0 and drive index 1. After inserting two .ssd images, *DRIVE 0 / *DRIVE 1 followed by *CAT should show a catalogue on each drive that has media inserted.

Alternatively, runtime insertion could target a user-selected drive; today there is no drive parameter on the insert path.

Root cause (source)

When DFS/ADFS/Pres ADFS is enabled, Electron constructs a Plus3 controller with two drives:

// Machines/Acorn/Electron/Plus3.cpp
Plus3::Plus3() : WD1770(P1770) {
    emplace_drives(2, 8000000, 300, 2);
}

Activity observers name them "Drive 1" and "Drive 2" (index + 1 in Plus3::set_activity_observer).

However, Electron::ConcreteMachine::insert_media only ever calls set_disk for index 0:

// Machines/Acorn/Electron/Electron.cpp
if(!media.disks.empty() && plus3_) {
    plus3_->set_disk(media.disks.front(), 0);
}

This runs:

  • at machine construction (insert_media(target.media)), and
  • on runtime insertion (macOS: MachineDocument.insertFileCSMachine.applyMediainsert_media; each inserted file is a single-disk Media).

Plus3::set_disk already accepts a drive index:

void Plus3::set_disk(std::shared_ptr<Storage::Disk::Disk> disk, const size_t drive);

So the hardware model supports two drives; only the Electron insert_media implementation uses index 0.

Note: On SDL startup, multiple file arguments are merged into one Media object (OSBindings/SDL/main.cpp), but Electron still reads only media.disks.front() for drive 0. Any additional entries in media.disks are ignored for drive 1.

Workaround

Use a single drive only (*DRIVE 0), keep one .ssd mounted, or swap the image on drive 0 when prompted. Dual-drive setups are not supported by current insertion logic.

Environment

Item Value
CLK 26.06.06 (macOS)
Machine Acorn Electron + DFS
Media tested DFS .ssd (80-track)
Source tree TomHarte/CLK @ f0d7068

Happy to re-test on a fixed build.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions