gameboy/mbc/
mbc0.rs

1pub type StrResult<T> = Result<T, &'static str>;
2use crate::mbc::MemoryBankController;
3
4pub struct MBC0 {
5    rom: Vec<u8>,
6}
7
8impl MBC0 {
9    pub fn new(data: Vec<u8>) -> StrResult<MBC0> {
10        Ok(MBC0 { rom: data })
11    }
12}
13
14impl MemoryBankController for MBC0 {
15    fn readrom(&self, a: u16) -> u8 {
16        self.rom[a as usize]
17    }
18    fn readram(&self, _a: u16) -> u8 {
19        0
20    }
21    fn writerom(&mut self, _a: u16, _v: u8) {}
22    fn writeram(&mut self, _a: u16, _v: u8) {}
23}