Summary
Tighten Disk II emulation to support copy-protected software. The current controller is faithful enough for standard DOS 3.3 / ProDOS disks and runs every test in the bootable test suite, but a handful of analog-timing and bit-stream behaviors that copy protection schemes exploit are still simplified or missing.
Successor to #61: that issue's core deliverables (WOZ v1/v2 support, quarter-track stepping, motor-gated reads, auto-flush on eject) shipped with the //e fidelity work. This one isolates the protection-fidelity remainder.
Outstanding behaviors
1. Motor spin-up delay
Real hardware takes ~1 revolution (~70 ms at 300 RPM) to reach reading speed after the motor is energized. Reads attempted during spin-up return garbage. Some protection schemes deliberately read during the spin-up window and check for the absence of valid sync.
Currently Casso's motor reaches speed instantly: a read 1 cycle after \ returns the same data as a read 10 ms later.
2. Cycle-accurate rotational position
The disk spins continuously; the read head sees whatever bit is currently under it. If the CPU is busy doing something else, the bits keep going by -- when the CPU comes back, the next read picks up wherever the disk is now, not the next sequential bit.
Currently Casso returns the next sequential nibble regardless of how much time elapsed between reads. Protection schemes that read, do timing-sensitive work, then read again rely on the position having advanced.
Implementation: track a rotationalPosition field on the active drive, advance it by (currentCycle - lastReadCycle) bits-per-cycle on each read, modulo track length.
3. Bit-level write path
Casso's write support today is sector-level (WriteSector). Real hardware writes bit by bit through the Q6/Q7 state machine and the data latch; protection schemes use this to write non-standard sync patterns, weak bits, and partial sectors.
Implementation: full Q6/Q7 state machine with the data register, writing into the WOZ bit stream byte by byte, and write-back to .woz on flush. .dsk write-back can re-nibblize on the way out (with a warning when the bit stream contains non-standard sync that .dsk cannot represent).
Acceptance criteria
References
- WOZ Disk Image Reference -- analog metadata in WOZ 2 covers exactly the protection-fidelity gap
- AppleWin Disk II implementation -- known to support ~99% copy-protection fidelity (GPL-2 reference)
- Beneath Apple DOS / Beneath Apple ProDOS / Understanding the Apple //e -- canonical hardware-level references
Summary
Tighten Disk II emulation to support copy-protected software. The current controller is faithful enough for standard DOS 3.3 / ProDOS disks and runs every test in the bootable test suite, but a handful of analog-timing and bit-stream behaviors that copy protection schemes exploit are still simplified or missing.
Successor to #61: that issue's core deliverables (WOZ v1/v2 support, quarter-track stepping, motor-gated reads, auto-flush on eject) shipped with the //e fidelity work. This one isolates the protection-fidelity remainder.
Outstanding behaviors
1. Motor spin-up delay
Real hardware takes ~1 revolution (~70 ms at 300 RPM) to reach reading speed after the motor is energized. Reads attempted during spin-up return garbage. Some protection schemes deliberately read during the spin-up window and check for the absence of valid sync.
Currently Casso's motor reaches speed instantly: a read 1 cycle after \ returns the same data as a read 10 ms later.
2. Cycle-accurate rotational position
The disk spins continuously; the read head sees whatever bit is currently under it. If the CPU is busy doing something else, the bits keep going by -- when the CPU comes back, the next read picks up wherever the disk is now, not the next sequential bit.
Currently Casso returns the next sequential nibble regardless of how much time elapsed between reads. Protection schemes that read, do timing-sensitive work, then read again rely on the position having advanced.
Implementation: track a
rotationalPositionfield on the active drive, advance it by(currentCycle - lastReadCycle) bits-per-cycleon each read, modulo track length.3. Bit-level write path
Casso's write support today is sector-level (
WriteSector). Real hardware writes bit by bit through the Q6/Q7 state machine and the data latch; protection schemes use this to write non-standard sync patterns, weak bits, and partial sectors.Implementation: full Q6/Q7 state machine with the data register, writing into the WOZ bit stream byte by byte, and write-back to
.wozon flush..dskwrite-back can re-nibblize on the way out (with a warning when the bit stream contains non-standard sync that.dskcannot represent).Acceptance criteria
.dskcontinue to work (regression check via existing test suite)References