start laying down the memory. Need to try and load a game now
This commit is contained in:
+20
-1
@@ -1,11 +1,30 @@
|
|||||||
|
use utils::error::Error;
|
||||||
|
|
||||||
|
use crate::core::{cpu::Cpu, interpreter::Interpreter, mem::Memory};
|
||||||
|
|
||||||
pub mod cpu;
|
pub mod cpu;
|
||||||
pub mod interpreter;
|
pub mod interpreter;
|
||||||
pub mod mem;
|
pub mod mem;
|
||||||
pub mod registers;
|
pub mod registers;
|
||||||
|
|
||||||
pub struct Core {}
|
pub struct Core {
|
||||||
|
cpu: Interpreter,
|
||||||
|
mem: Memory,
|
||||||
|
}
|
||||||
|
|
||||||
impl Core {
|
impl Core {
|
||||||
|
pub fn new() -> Self {
|
||||||
|
Self {
|
||||||
|
cpu: Interpreter::new(),
|
||||||
|
mem: Memory::new(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn stop(&mut self) {}
|
pub fn stop(&mut self) {}
|
||||||
pub fn reset(&mut self) {}
|
pub fn reset(&mut self) {}
|
||||||
|
pub fn run(&mut self) -> Result<u32, Error> {
|
||||||
|
loop {
|
||||||
|
let _ = self.cpu.step(&mut self.mem)?;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-1
@@ -1 +1,13 @@
|
|||||||
pub struct Memory {}
|
use crate::core::mem::mmio::mmio::MMIO;
|
||||||
|
|
||||||
|
pub mod mmio;
|
||||||
|
|
||||||
|
pub struct Memory {
|
||||||
|
mmio: MMIO,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Memory {
|
||||||
|
pub fn new() -> Self {
|
||||||
|
Self { mmio: MMIO::new() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
use crate::core::mem::mmio::ri::RDRAMInterface;
|
||||||
|
|
||||||
|
pub struct MMIO {
|
||||||
|
ri: RDRAMInterface,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl MMIO {
|
||||||
|
pub fn new() -> Self {
|
||||||
|
Self {
|
||||||
|
ri: RDRAMInterface::new(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
pub mod mmio;
|
||||||
|
pub mod ri;
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
pub struct RDRAMInterface {
|
||||||
|
rdram: Vec<u8>,
|
||||||
|
cmd_buf: Vec<u8>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl RDRAMInterface {
|
||||||
|
pub fn new() -> Self {
|
||||||
|
Self {
|
||||||
|
rdram: Vec::with_capacity(0x800000),
|
||||||
|
cmd_buf: Vec::with_capacity(0xFFFFF),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn reset(&mut self) {
|
||||||
|
self.rdram.fill(0);
|
||||||
|
self.cmd_buf.fill(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user