Chip8

Struct Chip8 

Source
pub struct Chip8 {
    pub display: Display,
    /* private fields */
}

Fields§

§display: Display

Implementations§

Source§

impl Chip8

Source

pub fn new<T, G>( key_wait_handler: &'static (dyn Fn() -> u8 + Send + Sync + 'static), key_state_handler: &'static (dyn Fn(u8) -> bool + Send + Sync + 'static), ) -> Chip8

Source

pub fn to_state(&self) -> Chip8State

Source

pub fn set_handlers( &mut self, key_wait_handler: &'static (dyn Fn() -> u8 + Send + Sync + 'static), key_state_handler: &'static (dyn Fn(u8) -> bool + Send + Sync + 'static), )

Source

pub fn get_regs(&self) -> [u8; 16]

Source

pub fn get_i(&self) -> usize

Source

pub fn get_sound_timer(&self) -> u8

Source

pub fn get_delay_timer(&self) -> u8

Source

pub fn is_sound_playing(&self) -> bool

Source

pub fn get_memory(&self, addr: usize) -> u8

Source

pub fn get_opcode(&self, addr: usize) -> u16

Source

pub fn get_pc(&self) -> usize

Source

pub fn load(&mut self, at: usize, program: &[u8], font: Option<[u8; 240]>)

The at parameter should almost always be 0x200. It’s here for compatability with ETI 660 programs (starting with 0x600). Panics if at is less than 240, where the default font lies.

Source

pub fn timers_tick(&mut self)

Source

pub fn cpu_tick(&mut self) -> Result<(), &'static str>

Auto Trait Implementations§

§

impl Freeze for Chip8

§

impl !RefUnwindSafe for Chip8

§

impl Send for Chip8

§

impl Sync for Chip8

§

impl Unpin for Chip8

§

impl !UnwindSafe for Chip8

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, 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