BasicCPUMemory

Struct BasicCPUMemory 

Source
pub struct BasicCPUMemory { /* private fields */ }
Expand description

Memory is one contiguous 64KB buffer with no mapping or mirroring.

Implementations§

Source§

impl BasicCPUMemory

Source

pub fn from_file(path: &String, offset: u16) -> Result<Self, Error>

For creating a memory buffer from a file. Specify an offset if you would like your data to be loaded in from a specific start point; if you set this to 0, it will begin loading data at 0x0.

Trait Implementations§

Source§

impl CPUMemory for BasicCPUMemory

Source§

fn read(&self, address: u16) -> u8

Reading from an address.
Source§

fn write(&mut self, address: u16, data: u8)

Writing from an address.
Source§

impl Default for BasicCPUMemory

Source§

fn default() -> Self

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

impl TryFrom<Vec<u8>> for BasicCPUMemory

Source§

fn try_from(value: Vec<u8>) -> Result<Self, Self::Error>

If you already have an existing Vec and would like to use it for your CPU memory. If your Vec is too large this will error. If your Vec is too small it will upsize your vector and fill in the unused memory with 0.

Source§

type Error = ()

The type returned in the event of a conversion error.

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