Skip to content

armgit / gecko

Public Imported from GitHub
0

A GameCube/Wii emulator and debugger written in Rust.

mmio regs

Layle15d80f966d1d
diff --git a/crates/gekko/src/mmu.rs b/crates/gekko/src/mmu.rs
index 452c5ce..80625a4 100644
--- a/crates/gekko/src/mmu.rs
+++ b/crates/gekko/src/mmu.rs
@@ -7,6 +7,7 @@ use constants::*;
pub struct Mmu {
pub ram: Vec<u8>,
pub efb: Vec<u8>,
+ pub hwr: Vec<u8>,
}
impl Mmu {
@@ -14,6 +15,7 @@ impl Mmu {
Mmu {
ram: vec![0; RAM_SIZE],
efb: vec![0; EFB_SIZE],
+ hwr: vec![0; HW_REG_SIZE],
}
}
@@ -23,9 +25,7 @@ impl Mmu {
match phys {
RAM_BASE..=RAM_END => (&self.ram, phys as usize),
EFB_BASE..=EFB_END => (&self.efb, (phys - EFB_BASE) as usize),
- HW_REG_BASE..=HW_REG_END => {
- panic!("unimplemented HW register read at physical {phys:#010X}")
- }
+ HW_REG_BASE..=HW_REG_END => (&self.hwr, (phys - HW_REG_BASE) as usize),
_ => panic!("unmapped physical read at {phys:#010X}"),
}
}
@@ -37,9 +37,7 @@ impl Mmu {
match phys {
RAM_BASE..=RAM_END => (&mut self.ram, phys as usize),
EFB_BASE..=EFB_END => (&mut self.efb, (phys - EFB_BASE) as usize),
- HW_REG_BASE..=HW_REG_END => {
- panic!("unimplemented HW register write at physical {phys:#010X}")
- }
+ HW_REG_BASE..=HW_REG_END => (&mut self.hwr, (phys - HW_REG_BASE) as usize),
_ => panic!("unmapped physical write at {phys:#010X}"),
}
}
diff --git a/crates/gekko/src/mmu/constants.rs b/crates/gekko/src/mmu/constants.rs
index 3f0a05d..e866f13 100644
--- a/crates/gekko/src/mmu/constants.rs
+++ b/crates/gekko/src/mmu/constants.rs
@@ -7,4 +7,5 @@ pub const EFB_END: u32 = 0x081F_FFFF;
pub const EFB_SIZE: usize = 0x0020_0000; // 2 MB
pub const HW_REG_BASE: u32 = 0x0C00_0000;
-pub const HW_REG_END: u32 = 0x0C7F_FFFF;
\ No newline at end of file
+pub const HW_REG_END: u32 = 0x0C7F_FFFF;
+pub const HW_REG_SIZE: usize = 0x0080_0000; // 8 MB
\ No newline at end of file