21 lines
550 B
Rust
21 lines
550 B
Rust
use log::debug;
|
|
use crate::constants::constants_system::SIZE_32KB;
|
|
use crate::periph::hm62256::Hm62256;
|
|
use crate::traits::memory_chip::MemoryChip;
|
|
use crate::traits::rom_chip::RomChip;
|
|
|
|
impl MemoryChip for Hm62256 {
|
|
fn read(&self, offset: &u16) -> u8 {
|
|
// loops memory around past 32k
|
|
let effective = *offset as i32 % SIZE_32KB as i32;
|
|
self.data[effective as usize]
|
|
}
|
|
}
|
|
|
|
impl RomChip for Hm62256 {
|
|
fn program(_: &[u8]) -> Box<Self> {
|
|
debug!("Dont program ram.");
|
|
Hm62256::default().into()
|
|
}
|
|
}
|