Bus

Struct Bus 

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

Implementations§

Source§

impl Bus

Source

pub fn new_without_boot_rom(cartridge: Cartridge, config: GameBoyConfig) -> Self

Source

pub fn new_with_boot_rom( cartridge: Cartridge, boot_rom_data: Vec<u8>, config: GameBoyConfig, ) -> Self

Source

pub fn cartridge(&self) -> &Cartridge

Source

pub fn screen_buffer(&self) -> &[u8]

Source

pub fn audio_buffers(&mut self) -> AudioBuffers<'_>

Source

pub fn press_joypad(&mut self, button: JoypadButton)

Source

pub fn release_joypad(&mut self, button: JoypadButton)

Source

pub fn connect_device(&mut self, device: Rc<RefCell<dyn SerialDevice>>)

Source

pub fn disconnect_device(&mut self)

Source

pub fn elapsed_ppu_cycles(&mut self) -> u32

Trait Implementations§

Source§

impl CpuBusProvider for Bus

Source§

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

each time the cpu reads, clock the components on the bus

Source§

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

each time the cpu writes, clock the components on the bus

Source§

fn take_next_interrupt(&mut self) -> Option<InterruptType>

Source§

fn peek_next_interrupt(&mut self) -> Option<InterruptType>

Source§

fn is_hdma_running(&mut self) -> bool

Source§

fn enter_stop_mode(&mut self)

Source§

fn stopped(&self) -> bool

Source§

fn trigger_write_oam_bug(&mut self, addr: u16)

Triggers oam_bug without clock, this is used for inc/dec instructions
Source§

fn trigger_read_write_oam_bug(&mut self, addr: u16)

Triggers oam_bug special case read_write, this happens when an increment/decrement happen in the same cycle as read
Source§

fn read_no_oam_bug(&mut self, addr: u16) -> u8

reads data without triggering oam_bug, this is used in pop
Source§

impl Savable for Bus

Source§

fn save<W: Write>(&self, writer: &mut W) -> Result<()>

Source§

fn load<R: Read>(&mut self, reader: &mut R) -> Result<()>

Source§

fn save_size(&self) -> Result<u64>

The size of the object if saved now, note that this might change, for example due to the length of string objects or data inside the object.

Auto Trait Implementations§

§

impl Freeze for Bus

§

impl !RefUnwindSafe for Bus

§

impl !Send for Bus

§

impl !Sync for Bus

§

impl Unpin for Bus

§

impl !UnwindSafe for Bus

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

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

Source§

type Output = T

Should always be Self
§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.