ft: initial work in interpreter
This commit is contained in:
28
src/interpreter/computer.rs
Normal file
28
src/interpreter/computer.rs
Normal file
@@ -0,0 +1,28 @@
|
||||
use core::fmt;
|
||||
|
||||
use crate::operands::Byte;
|
||||
|
||||
use super::{flags::Flags, register::Register};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Computer {
|
||||
pub regs: Register,
|
||||
pub flags: Flags,
|
||||
pub memory: [Byte; 65536],
|
||||
}
|
||||
|
||||
impl Computer {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
regs: Register::new(),
|
||||
flags: Flags::new(),
|
||||
memory: [0; 65536],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for Computer {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "{} | {}", self.regs, self.flags)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user