start laying down the memory. Need to try and load a game now

This commit is contained in:
2026-08-20 15:40:20 +02:00
parent 81590e5f83
commit ce364e8724
5 changed files with 66 additions and 2 deletions
+20 -1
View File
@@ -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
View File
@@ -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() }
}
}
+13
View File
@@ -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(),
}
}
}
+2
View File
@@ -0,0 +1,2 @@
pub mod mmio;
pub mod ri;
+18
View File
@@ -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);
}
}