Commit Graph
3 Commits
Author SHA1 Message Date
Stefan ArentzandClaude Fable 5 7ef065e9e9 Switch machine reset from Cmd-Esc to Cmd-R (#205)
Cmd-Esc never reaches the emulator on macOS: AppKit offers every
Cmd-combo around as a key equivalent before it can become a keyDown,
and Escape is claimed by Cocoa's cancelOperation: handling — the event
dies before SDL's queue exists. Confirmed with the new --debug key
logging: plain Esc arrives (keycode 27, NOMOD), Cmd-Return arrives
(LGUIMOD), Cmd-Esc produces nothing. The C had the same binding on the
same SDL and was equally broken on macOS.

Reset is now Cmd-R in both frontends; Cmd-letter combos are reliably
delivered (Cmd-I and Cmd-P already depend on that). Plain Escape still
reaches the machine as $1B. The --debug flag now also logs KeyDown
events (keycode/scancode/keymod), which is how this was diagnosed.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-05 23:00:41 -04:00
Stefan ArentzandClaude Fable 5 e2a681185b Fix speaker clicks: model the AC-coupled speaker (#204)
The speaker clicked during game loading with zero $C030 activity (a
20-second Total Replay boot probe showed toggles only during the
power-on beep). Cause: snd.c's synthesis, ported 1:1, held the output
at a DC rail (±8000 forever after the last toggle), so any queue
underrun — a late frame during loading — snapped the output to silence
and back, an artifact real AC-coupled hardware cannot make. It also
dropped whole frames on backpressure and popped at startup.

The synthesis is now a pure, SDL-free Wave: a toggle jumps the level to
a rail (a single toggle still clicks, like real hardware) and the level
decays toward zero with a ~4ms time constant, like the cone relaxing to
rest. Silence is actually silence, so underruns during silence are
inaudible. The queue is primed with 64ms of zeros at startup, all-silent
frames are skipped when the queue is comfortably full, and frames
carrying signal are never dropped.

Five unit tests cover the waveform (idle silence, click-then-decay,
beep-then-silence — the regression test — sample pacing, square-wave
rails). Documented as a deliberate divergence from snd.c in
notes/REWRITE.md; also fixes the README links to REWRITE.md's new
location under notes/.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-05 22:28:11 -04:00
Stefan Arentz 3cf0f87959 Add a notes directory 2026-07-05 22:08:31 -04:00