Split code into modules, add font stuff
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
#[derive(Debug)]
|
||||
pub enum GeorgeErrorKind {
|
||||
Memory(MemoryError),
|
||||
Execution(ExecutionError),
|
||||
AddrMode(AddressingModeError),
|
||||
}
|
||||
|
||||
impl From<MemoryError> for GeorgeErrorKind {
|
||||
fn from(value: MemoryError) -> Self {
|
||||
Self::Memory(value)
|
||||
}
|
||||
}
|
||||
impl From<AddressingModeError> for GeorgeErrorKind {
|
||||
fn from(value: AddressingModeError) -> Self {
|
||||
Self::AddrMode(value)
|
||||
}
|
||||
}
|
||||
impl From<ExecutionError> for GeorgeErrorKind {
|
||||
fn from(value: ExecutionError) -> Self {
|
||||
Self::Execution(value)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum ExecutionError {
|
||||
InvalidInstruction,
|
||||
InterruptsDisabled,
|
||||
StackOverflow,
|
||||
MemoryError(MemoryError),
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum AddressingModeError {
|
||||
IncompatibleAddrMode,
|
||||
}
|
||||
|
||||
impl From<ExecutionError> for AddressingModeError {
|
||||
fn from(_value: ExecutionError) -> Self {
|
||||
Self::IncompatibleAddrMode
|
||||
}
|
||||
}
|
||||
|
||||
impl From<MemoryError> for ExecutionError {
|
||||
fn from(error: MemoryError) -> Self {
|
||||
ExecutionError::MemoryError(error)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct GeorgeError {
|
||||
pub desc: String,
|
||||
pub kind: GeorgeErrorKind,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum MemoryError {
|
||||
Unmapped,
|
||||
NoDataAtAddress,
|
||||
Unwritable,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum MappingError {
|
||||
RegionOccupied,
|
||||
InvalidPage,
|
||||
}
|
||||
Reference in New Issue
Block a user