Skip to main content

System

Struct System 

Source
pub struct System {
    pub cpu: Cpu,
    pub bus: Bus,
    /* private fields */
}
Expand description

Owns the run loop and the lockstep timebase.

Fields§

§cpu: Cpu

The 6507 CPU.

§bus: Bus

The Bus — owns the TIA, RIOT, cart-via-board, controllers, open bus.

Implementations§

Source§

impl System

Source

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).

Source

pub fn reset(&mut self)

Resets the CPU using the currently installed cartridge/bus, applying the seeded power-on phase offset first.

Source

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.

Source

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.

Source

pub const fn color_clocks(&self) -> u64

Total color clocks since power-on (for tracing / the golden-log differ).

Trait Implementations§

Source§

impl Clone for System

Source§

fn clone(&self) -> System

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for System

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for System

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for System

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,