pub struct VirtualMachine {
pub _window: Rc<RefCell<Window>>,
pub _sink: Rc<RefCell<Sink>>,
pub cpu: Cpu,
pub memory: Rc<RefCell<Memory>>,
pub audio_handler: AudioHandler,
pub keyboard_handler: KeyboardHandler,
pub screen_handler: ScreenHandler,
}
Expand description
VirtualMachine struct encapsulates the components of the BytePusher VM. It includes the CPU, memory, audio handler, keyboard handler, and screen handler.
Fields§
§_window: Rc<RefCell<Window>>
§_sink: Rc<RefCell<Sink>>
§cpu: Cpu
§memory: Rc<RefCell<Memory>>
§audio_handler: AudioHandler
§keyboard_handler: KeyboardHandler
§screen_handler: ScreenHandler
Implementations§
Source§impl VirtualMachine
Implementation of the VirtualMachine
This struct encapsulates the VM’s components and provides methods to load ROMs and process frames.
It includes the CPU, memory, audio handler, keyboard handler, and screen handler.
impl VirtualMachine
Implementation of the VirtualMachine This struct encapsulates the VM’s components and provides methods to load ROMs and process frames. It includes the CPU, memory, audio handler, keyboard handler, and screen handler.
pub fn new(window: Rc<RefCell<Window>>, sink: Rc<RefCell<Sink>>) -> Self
Sourcepub fn load_rom(&mut self, file_path: &str) -> Result<(), Box<dyn Error>>
pub fn load_rom(&mut self, file_path: &str) -> Result<(), Box<dyn Error>>
Load a ROM file into the VM’s memory.
Sourcepub fn process_frame(&mut self) -> Result<(), Box<dyn Error>>
pub fn process_frame(&mut self) -> Result<(), Box<dyn Error>>
Process a single frame of the VM, handling input, CPU ticks, audio, and rendering.
pub fn run(&mut self) -> Result<(), Box<dyn Error>>
Auto Trait Implementations§
impl Freeze for VirtualMachine
impl !RefUnwindSafe for VirtualMachine
impl !Send for VirtualMachine
impl !Sync for VirtualMachine
impl Unpin for VirtualMachine
impl !UnwindSafe for VirtualMachine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more