start of rom_only PC
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
mod default;
|
||||
mod rom_chip;
|
||||
pub mod default;
|
||||
pub mod rom_chip;
|
||||
pub mod tick;
|
||||
|
||||
use crate::constants::constants_system::SIZE_32KB;
|
||||
use crate::periph::rom_chip::RomChip;
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
use crate::periph::at28c256::At28C256;
|
||||
use crate::periph::hm62256::Hm62256;
|
||||
|
||||
impl At28C256 {
|
||||
fn tick(&mut self, address_bus: u16, data_bus: u8, read_mode: bool) -> (u16, u8) {
|
||||
if !read_mode {
|
||||
// has to be read mode. its a rom.
|
||||
return (address_bus, data_bus)
|
||||
}
|
||||
(address_bus, self.data[address_bus as usize])
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn smoke() { assert!(true); }
|
||||
|
||||
#[test]
|
||||
fn write_to_memory_read_back_works_at_0() {
|
||||
let mut rom = At28C256::default();
|
||||
|
||||
rom.tick(0x0000, 0xab, false);
|
||||
let (_, new_data) = rom.tick(0x0000, 0x00, true);
|
||||
|
||||
assert_eq!(new_data, 0xab);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user