1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
//! High-Level Emulation (HLE) for classic Macintosh applications.
//!
//! `systemless` runs Mac OS Toolbox apps without a real ROM by intercepting
//! 68k A-line trap instructions (`$A000`–`$AFFF`) and dispatching them
//! to native Rust handlers. QuickDraw, the Window Manager, the Resource
//! Manager, the Sound Manager, SANE, and the rest of the supported Toolbox
//! surface are reimplemented in Rust. The [`m68k`] crate executes guest CPU
//! instructions and models generation-specific architectural state.
//!
//! # Execution model
//!
//! [`FixtureRunner`](runner::FixtureRunner) owns the CPU, guest memory, and
//! Toolbox dispatcher. Precise single-instruction work uses
//! [`m68k::CpuCore::step`]. Budgeted execution uses
//! [`m68k::CpuCore::run_batch`], with FastMem for ordinary guest RAM and
//! Cranelift-compiled hot traces on native targets. WebAssembly uses m68k's
//! portable trace executor; the guest-visible CPU and HLE contracts are the
//! same in both modes.
//!
//! The library exposes the full [`m68k::CpuCore`] through
//! [`M68kCpu::core`](cpu::M68kCpu::core) for diagnostics and specialized
//! embedding, while [`cpu::CpuOps`] is the narrower register interface used by
//! Toolbox handlers.
//!
//! # Quick start
//!
//! ```no_run
//! use systemless::runner::{FixtureRunner, FixtureRunnerConfig};
//!
//! // Allocate an 8 MiB guest, default config (kiosk mode — Mac menu
//! // bar suppressed; arrow keys not remapped to numpad).
//! let config = FixtureRunnerConfig::default();
//! let mut runner = FixtureRunner::new(8 * 1024 * 1024, config);
//!
//! // Load a Mac executable (StuffIt archive, MacBinary, or raw
//! // resource fork — the loader auto-detects the format).
//! let bytes = std::fs::read("MyGame.sit").unwrap();
//! let _app = systemless::game::load_game(&mut runner, &bytes).unwrap();
//!
//! // Step the guest until it halts or the budget runs out.
//! // The bool is `still_running` — false means the CPU halted.
//! let (steps_taken, still_running) = runner.run_steps(100_000, None);
//! println!("ran {} steps, still_running = {}", steps_taken, still_running);
//! ```
//!
//! [`m68k`]: https://crates.io/crates/m68k
/// Deterministic trap-interaction replays. This is internal test
/// scaffolding, not part of the runtime API, so it is gated behind the
/// off-by-default `test-support` feature and is absent from normal builds
/// and docs.
pub use ;