[−][src]Struct nescore::Nes
Representation of the NES system
Implementations
impl Nes
[src]
pub fn new() -> Self
[src]
Instantiate a NES emulator instance
let nes = Nes::new();
pub fn entry(self, entry_addr: u16) -> Self
[src]
Directly set the CPU entry point
let nes = Nes::default().entry(0xC000);
pub fn with_cart(self, cart: Cartridge) -> Self
[src]
Builder function to allow inserting the cartridge
pub fn debug_mode(self, debug: bool) -> Self
[src]
Builder function to set debug mode
let nes = Nes::default().debug_mode(true);
pub fn emulate_frame(&mut self) -> ([u8; 184320], Vec<Sample>)
[src]
Run the emulator for a single frame
let mut nes = Nes::from(cart); let (videobuffer, audiobuffer) = nes.emulate_frame();
videobuffer
- A RGB8 frame bufferaudiobuffer
- Raw APU output (This must be down sampled to host playback rate)
pub fn run_audio(&mut self, buffer_size: usize) -> Vec<f32>
[src]
Run the NES emulator until it fills an audio buffer to the specified size
let samplebuffer = nes.run_audio(4096);
pub fn input(&mut self, btn: Button, pressed: bool)
[src]
Apply a button input into the emulator
nes.input(Button::A, true);
pub fn controller_input(
&mut self,
controller: Controller,
btn: Button,
pressed: bool
)
[src]
&mut self,
controller: Controller,
btn: Button,
pressed: bool
)
Apply a button input to the emulator from the specified controller
// Send an `A` button press to input 1 nes.controller_input(Controller::Input1, Button::A, true); // Send an `A` button press to input 2 nes.controller_input(Controller::Input2, Button::A, true);
pub fn run_until(&mut self, addr: u16)
[src]
Run until the CPU's PC is at address addr
pub fn is_holding(&self) -> bool
[src]
Check if the CPU is in an infinite loop state
pub fn insert(&mut self, cart: Cartridge)
[src]
Load a cartridge
pub fn eject(self) -> Vec<u8>
[src]
Eject the cartridge, returning the save state
let nes = Nes::default(); // This consumes the nes instance let battery_ram = nes.eject();
pub fn get_program_counter(&self) -> u16
[src]
Get the CPU's program counter
pub fn read_cpu_ram(&self, addr: u16) -> u8
[src]
Read the byte, at the specified address, from CPU's internal RAM
pub fn read_ppu_memory(&self, addr: u16) -> u8
[src]
Read directly from VRAM
pub fn read_tile(&self, nametable: u16, x: usize, y: usize) -> u8
[src]
Read a tile from the current nametable
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Nes
impl !Send for Nes
impl !Sync for Nes
impl Unpin for Nes
impl !UnwindSafe for Nes
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,