Files
schwert_und_magie_on_pebble/SchwertUndMagieOnPebbleCompanionApp
ml 463c85e62f Fix snapshot save/load: route both through CPU trap to sync registers
machine_write_snapshot reads maincpu_regs.pc to record the current
  program counter. When called directly from video_canvas_refresh,
  maincpu_regs is stale — the CPU loop keeps registers as stack-local
  variables and only syncs them to maincpu_regs inside DO_INTERRUPT via
  EXPORT_REGISTERS(). The snapshot therefore recorded the wrong PC.

  On restore (already trap-based), the wrong PC was faithfully written
  back into reg_pc via IMPORT_REGISTERS(), causing the CPU to resume at
  a bad address. The game screen looked correct (memory/VIC/SID state
  all restored) but the CPU never reached the input-polling code, so
  button presses had no effect.

  Fix: route machine_write_snapshot through interrupt_maincpu_trigger_trap
  so DO_INTERRUPT(IK_TRAP) calls EXPORT_REGISTERS() before the trap
  function, capturing the true current PC before the snapshot is written.
2026-06-17 20:50:51 +02:00
..
2026-06-01 16:31:29 +02:00