gb-emu/src/processor/memory/rom/mbcs.rs

35 lines
643 B
Rust
Raw Normal View History

2023-02-07 10:08:34 +11:00
use crate::processor::memory::Address;
pub(super) trait MBC {
fn get(&self, address: Address) -> u8;
fn set(&mut self, address: Address, data: u8);
}
pub(super) struct NONE {
pub(super) data: Vec<u8>,
}
impl MBC for NONE {
fn get(&self, address: Address) -> u8 {
self.data[address as usize]
}
fn set(&mut self, address: Address, data: u8) {
return;
}
}
pub(super) struct MBC1 {
pub(super) data: Vec<u8>,
}
impl MBC for MBC1 {
fn get(&self, address: Address) -> u8 {
self.data[address as usize]
}
fn set(&mut self, address: Address, data: u8) {
return;
}
}