finished refactor of emulator - started on loader (needs significant changes before functional in the way that I would like)

This commit is contained in:
2025-06-23 23:45:47 +01:00
parent bc5ddef311
commit 76197fac8f
15 changed files with 604 additions and 289 deletions
+11 -5
View File
@@ -3,6 +3,8 @@ use crate::{instructions::encode::Encode, prelude::*};
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum Interrupt {
Software(u8),
Breakpoint,
HardFault,
}
pub type Address = u32;
@@ -10,6 +12,8 @@ pub type Address = u32;
impl Interrupt {
const fn as_u8(self) -> u8 {
match self {
Self::Breakpoint => 0,
Self::HardFault => 1,
Self::Software(code) => code,
}
}
@@ -19,10 +23,11 @@ impl Interrupt {
impl From<u8> for Interrupt {
#[allow(unreachable_code)]
fn from(code: u8) -> Self {
return Self::Software(code);
todo!("Implement this once a hardware interrupt convention is established.");
// Self::Software(_code)
match code {
0 => Self::Breakpoint,
1 => Self::HardFault,
_ => Self::Software(code),
}
}
}
@@ -73,7 +78,8 @@ pub enum Register {
}
impl Register {
#[must_use]
// this is here so clippy shuts up about the must_use tag.
#[allow(clippy::must_use_candidate)]
pub fn general() -> Vec<Self> {
vec![
Self::Rg0,