pub struct System {
pub cpu: Cpu,
pub bus: Bus,
/* private fields */
}Expand description
Owns the run loop and the lockstep timebase.
Fields§
§cpu: CpuThe 6507 CPU.
bus: BusThe Bus — owns the TIA, RIOT, cart-via-board, controllers, open bus.
Implementations§
Source§impl System
impl System
Sourcepub fn new(seed: u64) -> Self
pub fn new(seed: u64) -> Self
Power on with a determinism seed (drives the phase alignment AND the power-on RAM/register randomization, ADR 0006 — real hardware powers up with indeterminate RAM/register contents, but “indeterminate” must still be a deterministic function of the seed, never the OS RNG, per ADR 0004).
Sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Resets the CPU using the currently installed cartridge/bus, applying the seeded power-on phase offset first.
Sourcepub fn step_instruction(&mut self) -> u8
pub fn step_instruction(&mut self) -> u8
Run exactly one 6507 instruction to completion and return its cycle
count. This is the scheduler’s sole driving primitive: every cycle the
instruction consumes advances the TIA/RIOT/cart in lockstep via
[CpuView::tick_cycle] as it goes (see the module doc comment) — by the
time this returns, the whole system (not just the CPU) has caught up to
the instruction’s true elapsed time.
Sourcepub fn tick_one_color_clock(&mut self)
pub fn tick_one_color_clock(&mut self)
Advance the TIA alone by exactly one color clock, with no CPU
involvement. Useful for tests / tooling that want to observe raw TIA
timing without running a program. Does NOT drive the CPU — pair with
Self::step_instruction for that.
Sourcepub const fn color_clocks(&self) -> u64
pub const fn color_clocks(&self) -> u64
Total color clocks since power-on (for tracing / the golden-log differ).