pub struct Computer { /* private fields */ }
Expand description
The computer consists of three parts:
- Central Processing Unit (CPU)
- Memory (RAM)
- Instruction Memory (ROM)
This configuration with two separate address space for instructions and data is called Hardware architecture.
The intruction memory out
signal is feed to the instruction
input of the
CPU, which is then executed. This execution may involve reading or writing
data to memory registers. The CPU also figures out the instruction to fetch
next and emits this address through its pc
output. The pc
output is feed
to the address
input of the instruction memory.
Implementations
sourceimpl Computer
impl Computer
sourcepub fn set_instructions(&mut self, instructions: Vec<AsmInstruction>)
pub fn set_instructions(&mut self, instructions: Vec<AsmInstruction>)
Loads instructions into the ROM
pub fn reset(&mut self)
pub fn get_screen(&self) -> &Screen
pub fn get_keyboard_mut(&mut self) -> &mut Keyboard
pub fn get_memory(&self) -> &Memory
pub fn get_memory_mut(&mut self) -> &mut Memory
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Computer
impl Send for Computer
impl Sync for Computer
impl Unpin for Computer
impl UnwindSafe for Computer
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more