Skip to content

feat(disk2): quarter-track pipeline boots protected games#73

Merged
relmer merged 6 commits into
masterfrom
feat/disk2-copy-protection
May 30, 2026
Merged

feat(disk2): quarter-track pipeline boots protected games#73
relmer merged 6 commits into
masterfrom
feat/disk2-copy-protection

Conversation

@relmer
Copy link
Copy Markdown
Owner

@relmer relmer commented May 30, 2026

Promotes the Disk II read pipeline to quarter-track resolution so half-track copy-protected games boot from their original WOZ images.

What's here

  • feat(disk2): quarter-track read pipeline + apple2js PHASE_DELTA stepper. Reads resolve at quarter-track (0-159) via a TMAP-derived slot map; the head stepper always rests on a valid detent. Choplifter, Karateka, and Lode Runner now boot (previously stalled in the protected region ~track 12).
  • fix(disk2): boot recalibrate audio renders as the realistic slow machine-gun ratchet instead of a continuous buzz (audio-layer only).
  • docs(disk2): spec 012 debug-telemetry groundwork + suppressed-audio identification note.
  • test(disk2): raised Karateka/Lode Runner boot thresholds; new LSS framing + odd-quarter-track guard tests.

Validation

  • Code analysis: 0 warnings / 0 errors
  • Unit tests: 1608 / 1608
  • Klaus Dormann functional test: SUCCESS
  • Tom Harte SingleStepTests: SUCCESS

Issues

relmer and others added 6 commits May 30, 2026 10:50
…tics

Captures four deferred Disk II Debug window enhancements that would have

surfaced the half-track truncation bug early: a Severity column flagging

commanded-vs-resolved head discrepancies as errors, resolved-track/TMAP

telemetry with active mount-time half-track-data-loss diagnosis, a

ReadStall event for prologue-less spins, and a non-perturbing nibble peek.

Dialog-side work is gated behind spec 011; CassoEmuCore event plumbing may

proceed independently.

Refs #67, #69

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…d disks

Promote the disk read pipeline to quarter-track (0-159) resolution and
replace the head stepper with the apple2js PHASE_DELTA model so half-track
formatted copy-protected disks boot. Choplifter now sweeps the entire disk
into its protected region (previously stalled at track 12).

Quarter-track pipeline:
- DiskImage indexes bitstreams by quarter-track via a TMAP-derived slot map
  (ResolveQuarterTrack); FF/unformatted quarters resolve to no flux.
- WozLoader loads every distinct TMAP entry instead of dropping qt%4!=0.
- Disk2NibbleEngine resolves its slot on demand per quarter-track.
- Disk2Controller passes the full quarter-track (not /4) to the engine.

Stepper fix:
- HandlePhase previously derived the magnet index from position
  ((m_quarterTrack / 2) & 3), which could not distinguish qt N from qt N+1
  and could leave the head marooned on an odd quarter-track between detents,
  serving unformatted noise on narrow-band protected tracks and stalling the
  loader. The apple2js model tracks the last-energized phase and moves an
  even number of quarter-tracks per energize, so an odd resting position is
  unreachable and whole-track seeks land on qt mod 4 == 0.

Tests:
- PhaseSeekAlwaysRestsOnEvenQuarterTrack: red->green guard for the odd-rest bug.
- SelfSyncStreamFramesAsFFWithoutDrift, LssReSyncsAfterLongZeroGap: LSS framing.
- Choplifter boot bar raised 10 -> 20 (now reaches the protected region).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… buzz

The PHASE_DELTA stepper model correctly pins the head at the track-0 stop during a DOS boot recalibrate, so the controller emits a steady ~52 Hz stream of identical HeadStop thunks (~19,690 cycles apart). Restarting the same thunk every 19 ms smeared into a continuous fast buzz instead of the realistic slow machine-gun ratchet a real Disk II makes.

Fix is audio-layer only (Disk2AudioSource::OnHeadBump): a rapid run of consecutive bumps is cycled through a 4-slot ratchet pattern [thunk, silent pause, click, click], reproducing the old onset stream (2 clicks : 1 thunk : 1 silent, ~38 Hz grouped). An isolated bump stays a firm thunk; a real step re-arms the pattern. The stepper position fix that got Choplifter booting is untouched.

Adds 3 unit tests covering the ratchet onset sequence, isolated-bump-stays-thunk, and step-re-arms-ratchet. Disk2AudioSource 37/37, full suite 1608/1608.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The boot-recalibrate ratchet intentionally suppresses audio on its silent slot, so the debug window shows a bare Head bump row with no audio event -- indistinguishable from a dropped event. Capture FR-013 (deferred) to surface an Info-severity suppressed-audio marker.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… boot

The quarter-track pipeline + apple2js stepper (30c4a66) unblocked Karateka
and Lode Runner along with Choplifter. A full-budget boot now sweeps the
disk and turns the motor off (load complete): Karateka reaches ~14 distinct
tracks (max 32), Lode Runner ~21 (max 33). Raise the smoke-test thresholds
from the old protection-stall points (3 and 4) to 10 and 15, and rewrite the
stale 'stalls in protection' comments to reflect the successful boot.

Closes #68
Closes #70

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Consolidated release entry for the quarter-track read pipeline and boot recalibrate audio fix. Mark #67/#68/#70 done in the roadmap; #69 stays open pending joystick/button input (#72). Bump Version.h to 1288.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@relmer relmer merged commit 986990e into master May 30, 2026
4 checks passed
@relmer relmer deleted the feat/disk2-copy-protection branch May 31, 2026 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(disk): boot Lode Runner from its WOZ image (copy protection) feat(disk): boot Karateka from its WOZ image (RWTS18 copy protection)

1 participant