start of rom_only PC

This commit is contained in:
2025-07-07 07:36:41 -04:00
parent b9242b1943
commit 9c672741ed
23 changed files with 349 additions and 114 deletions
+3 -2
View File
@@ -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;
+31
View File
@@ -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);
}
}