moa/emulator/peripherals/zilog/src/z8530.rs

43 lines
1.2 KiB
Rust
Raw Normal View History

2024-02-24 21:02:09 +00:00
use femtos::{Instant, Duration};
use moa_core::{System, Error, Address, Addressable, Steppable, Transmutable};
2023-03-06 04:19:49 +00:00
const DEV_NAME: &str = "z8530";
2023-03-06 04:19:49 +00:00
#[derive(Default)]
pub struct Z8530 {}
impl Addressable for Z8530 {
fn size(&self) -> usize {
0x10
}
2024-02-24 21:02:09 +00:00
fn read(&mut self, _clock: Instant, addr: Address, data: &mut [u8]) -> Result<(), Error> {
log::warn!("{}: !!! unhandled read from {:0x}", DEV_NAME, addr);
log::debug!("{}: read from register {:x} of {:?}", DEV_NAME, addr, data);
Ok(())
}
2024-02-24 21:02:09 +00:00
fn write(&mut self, _clock: Instant, addr: Address, data: &[u8]) -> Result<(), Error> {
log::debug!("{}: write to register {:x} with {:x}", DEV_NAME, addr, data[0]);
log::warn!("{}: !!! unhandled write {:0x} to {:0x}", DEV_NAME, data[0], addr);
Ok(())
}
}
2021-12-13 20:00:24 +00:00
impl Steppable for Z8530 {
2024-02-24 21:02:09 +00:00
fn step(&mut self, _system: &System) -> Result<Duration, Error> {
Ok(Duration::from_secs(1))
2021-12-13 20:00:24 +00:00
}
}
impl Transmutable for Z8530 {
fn as_addressable(&mut self) -> Option<&mut dyn Addressable> {
Some(self)
}
2021-12-13 20:00:24 +00:00
fn as_steppable(&mut self) -> Option<&mut dyn Steppable> {
Some(self)
}
}