mirror of
https://github.com/FranLMSP/rultra64.git
synced 2026-01-01 07:51:34 -05:00
rdram definition
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
pub mod registers;
|
||||
pub mod cpu;
|
||||
pub mod mmu;
|
||||
pub mod rdram;
|
||||
|
||||
28
src/rdram.rs
Normal file
28
src/rdram.rs
Normal 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user