use crate::{NumberNonZeroUnsigned, Span};
#[derive(Clone, Debug)]
pub struct Space {
pub src: Span,
pub space_type: SpaceType,
pub wordsize: NumberNonZeroUnsigned,
pub addr_bytes: NumberNonZeroUnsigned,
}
impl Space {
pub fn can_write(&self) -> bool {
self.space_type.can_write()
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
pub enum SpaceType {
Ram,
Rom,
Register,
}
impl SpaceType {
pub fn can_write(&self) -> bool {
match self {
SpaceType::Rom => false,
SpaceType::Ram | SpaceType::Register => true,
}
}
}