crsp_base::processor

Struct Processor

Source
pub struct Processor { /* private fields */ }

Implementations§

Source§

impl Processor

Source

pub const MAX_USABLE_MEMORY_LEN: usize = 65_536usize

The maximum length of memory that can be addressed with CHIP-8 instructions, u16::MAX+1.

See also Self::MAX_ADDRESS

Source

pub const MAX_ADDRESS: u16 = 65_535u16

The maximum address that can be represented with CHIP-8 instructions, u16::MAX+1.

Instruction::StoreRegisterValues and Instruction::LoadRegisterValues don’t allow access outside of this and will cause a runtime error when run with the sum of the address in special address register I and the number of the last_register greater than this. The same goes for Instruction::DrawSprite and the sprite_byte_len.

Source

pub const SCREEN_WIDTH_BYTES: u8 = 8u8

Screen width in bytes.

Source

pub const SCREEN_WIDTH: u8 = 64u8

Screen width in pixels.

Source

pub const SCREEN_HEIGHT: u8 = 32u8

Screen height in pixels.

Source

pub fn builder() -> ProcessorBuilder

Source

pub fn start( self, ) -> (Sender<ControlEvent>, Receiver<ProcessorEvent>, JoinHandle<Result<Processor, ProcessorError>>)

Source

pub const fn get_key_state(&self, key: Key) -> KeyState

Get the state of a key.

Source

pub fn set_key_state(&mut self, key: Key, state: KeyState)

Set the state of a key.

Source

pub const fn screen(&self) -> &[u8; 256]

Source

pub fn step(&mut self) -> Result<StepOutcome, ProcessorError>

Trait Implementations§

Source§

impl Debug for Processor

Source§

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

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

impl Default for Processor

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for Processor

Source§

fn eq(&self, other: &Processor) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for Processor

Source§

impl StructuralPartialEq for Processor

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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, 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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more