gb/src/high_ram.rs

23 lines
403 B
Rust
Raw Normal View History

2021-01-18 03:13:59 +00:00
#[derive(Debug, Clone)]
pub struct HighRAM {
buf: Box<[u8]>,
}
impl Default for HighRAM {
fn default() -> Self {
Self {
2021-01-19 04:54:38 +00:00
buf: vec![0u8; 128].into_boxed_slice(),
2021-01-18 03:13:59 +00:00
}
}
}
impl HighRAM {
pub fn write_byte(&mut self, index: usize, byte: u8) {
self.buf[index] = byte;
}
pub fn read_byte(&self, index: usize) -> u8 {
self.buf[index]
}
}