mod frame_buffer;
mod io;
pub use core::time::Duration;
pub use frame_buffer::{FrameBuffer, FrameBufferSource};
pub use io::{BufferCursor, DataRecorder, LoadableAsset, SeekFrom, SeekableAsset};
pub trait Stopwatch {
fn new() -> Self;
fn measure(&self) -> Duration;
}
pub enum Snapshot<LoadableAssetImpl: LoadableAsset> {
Sna(LoadableAssetImpl),
}
pub enum SnapshotRecorder<DataRecorderImpl: DataRecorder> {
Sna(DataRecorderImpl),
}
pub enum Tape<LoadableAssetImpl: LoadableAsset> {
Tap(LoadableAssetImpl),
}
pub enum Screen<LoadableAssetImpl: LoadableAsset> {
Scr(LoadableAssetImpl),
}
pub enum RomFormat {
Binary16KPages,
}
pub trait RomSet {
type Asset: LoadableAsset;
fn format(&self) -> RomFormat;
fn next_asset(&mut self) -> Option<Self::Asset>;
}
pub trait HostContext<H: Host + ?Sized>: Sized {
fn frame_buffer_context(&self) -> <H::FrameBuffer as FrameBuffer>::Context;
}
pub trait ScreenAsset: LoadableAsset + SeekableAsset {}
impl<T> ScreenAsset for T where T: LoadableAsset + SeekableAsset {}
pub trait SnapshotAsset: LoadableAsset + SeekableAsset {}
impl<T> SnapshotAsset for T where T: LoadableAsset + SeekableAsset {}
pub trait IoExtender {
fn write(&mut self, port: u16, data: u8);
fn read(&mut self, port: u16) -> u8;
fn extends_port(&self, port: u16) -> bool;
}
pub struct StubIoExtender;
impl IoExtender for StubIoExtender {
fn write(&mut self, _: u16, _: u8) {}
fn read(&mut self, _: u16) -> u8 {
0
}
fn extends_port(&self, _: u16) -> bool {
false
}
}
pub trait DebugInterface {
fn check_pc_breakpoint(&mut self, addr: u16) -> bool;
}
pub struct StubDebugInterface;
impl DebugInterface for StubDebugInterface {
fn check_pc_breakpoint(&mut self, _addr: u16) -> bool {
false
}
}
pub trait Host {
type Context: HostContext<Self>;
type TapeAsset: LoadableAsset + SeekableAsset;
type FrameBuffer: FrameBuffer;
type EmulationStopwatch: Stopwatch;
type IoExtender: IoExtender;
type DebugInterface: DebugInterface;
}