rdram definition

This commit is contained in:
2022-01-09 13:12:35 -05:00
parent ba0394b107
commit f67a74120b
2 changed files with 29 additions and 0 deletions

View File

@@ -1,3 +1,4 @@
pub mod registers;
pub mod cpu;
pub mod mmu;
pub mod rdram;

28
src/rdram.rs Normal file
View File

@@ -0,0 +1,28 @@
#[derive(Copy, Clone)]
struct Byte {
data: u16,
}
impl Byte {
pub fn read(&self) -> u16 {
self.data & 0x1FF
}
pub fn write(&mut self, data: u16) {
self.data = data & 0x1FF;
}
}
struct RDRAM {
data: [Byte; 0x400000],
}
impl RDRAM {
pub fn read(&self, address: i64) -> u16 {
self.data[address as usize].read()
}
pub fn write(&mut self, address: i64, data: u16) {
self.data[address as usize].write(data);
}
}