Skip to content

Both Disk ][ drives share one head position #135

Description

@relmer

What happens

Both Disk ][ drives share one head position. Seek drive 1 to track 20, select drive 2, and drive 2's head is dragged to track 20 regardless of where it actually was.

Why

Disk2Controller::m_quarterTrack is a single member for the whole card. UpdateEngineSelection() runs on every drive select and pushes it into the newly selected engine, never pulling the outgoing drive's position back:

void Disk2Controller::UpdateEngineSelection()
{
    int   other = m_activeDrive ^ 1;

    m_engine[other].SetMotorOn (false);
    m_engine[m_activeDrive].SetMotorOn (m_motorOn);
    m_engine[m_activeDrive].SetCurrentTrack (m_quarterTrack);   // push, no pull
    ...
}

Each Disk2NibbleEngine already has its own m_currentTrack, so the storage for per-drive position exists. It is overwritten on every select.

Hardware

The stepper coils and the head carriage are in the drive, not on the card. The card has the four phase latches at $C0E0-$C0E7, and drive select decides which drive's magnets they reach. A deselected drive keeps its head where it was left.

Why it is not louder

DOS 3.3 recalibrates to track 0 when it switches drives, so the wrong starting position is corrected before it is read from. Software that seeks, switches, switches back and expects the head to still be there sees the fault.

Fix

Short term: pull the outgoing drive's position back into m_quarterTrack on select, or read the incoming drive's position instead of pushing. Wants a regression test that seeks drive 1, selects drive 2 and back, and asserts drive 1's position survived.

Longer term this dissolves into the Disk2Drive decomposition (separate issue): once the drive owns its own detent and position there is nothing to push.

Related

The same shape applies to m_phase, m_motorSpinupRemaining and m_motorSpindownCycles, all single members on the card for per-drive mechanical facts.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingimpact: engineeringInternal only: testability, architecture, maintainabilitypriority: mediumReal value, niche or polish (end-user-value triage)

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions