new ui, control panel kinda works, display works, framebuffer works, serial write works. widget for registers works. next is serial input and the editor

This commit is contained in:
2026-03-13 04:30:32 +00:00
parent 6da473c272
commit e1705efe7c
46 changed files with 1470 additions and 1613 deletions
+25 -21
View File
@@ -23,38 +23,46 @@ pub enum Register {
Rgf = 15,
// special purpose
Zero = 16,
Acc = 17,
Spr = 18,
Bpr = 19,
Ret = 20,
Idr = 21,
Mmr = 22,
Acc = 16,
Spr = 17,
Bpr = 18,
Ret = 19,
Idr = 20,
Mmr = 21,
// system - read only
Mar = 23,
Mdr = 24,
Sts = 25,
Cir = 26,
Pcx = 27,
Zero = 22,
Sts = 23,
Cir = 24,
Pcx = 25,
#[default]
Null = 28,
Null = 26,
}
impl Register {
/// Total number of registers, not counting Null as it's not a real register.
/// reading or writing to Null is undefined behaviour.
pub const COUNT: u8 = Self::Null as u8;
/// # Safety
/// the caller must ensure that the index is always within the range 0..COUNT, failing to do so will result in undefined behaviour.
#[must_use]
#[inline]
pub unsafe fn from_u8_unchecked(idx: u8) -> Self {
debug_assert!(idx <= Self::Null as u8);
debug_assert!(
idx < Self::COUNT,
"Tried to access a null register using the unchecked method. undefined behaviour alert!"
);
unsafe { std::mem::transmute(idx) }
}
#[inline]
pub fn from_u8(idx: u8) -> Result<Self, ()> {
if idx > 28 {
if idx >= Self::COUNT {
return Err(());
}
Ok(unsafe { Self::from_u8_unchecked(idx) })
}
}
@@ -84,7 +92,6 @@ impl fmt::Display for Register {
Self::Rgf => "Rgf",
// special purpose
Self::Zero => "Zero",
Self::Acc => "Acc",
Self::Spr => "Spr",
Self::Bpr => "Bpr",
@@ -93,8 +100,7 @@ impl fmt::Display for Register {
Self::Mmr => "Mmr",
// system - read only
Self::Mar => "Mar",
Self::Mdr => "Mdr",
Self::Zero => "Zero",
Self::Sts => "Sts",
Self::Cir => "Cir",
Self::Pcx => "Pcx",
@@ -129,7 +135,6 @@ impl std::str::FromStr for Register {
"rgf" => Ok(Self::Rgf),
// special purpose
"zero" => Ok(Self::Zero),
"acc" => Ok(Self::Acc),
"spr" => Ok(Self::Spr),
"bpr" => Ok(Self::Bpr),
@@ -138,8 +143,7 @@ impl std::str::FromStr for Register {
"mmr" => Ok(Self::Mmr),
// system - read only
"mar" => Ok(Self::Mar),
"mdr" => Ok(Self::Mdr),
"zero" => Ok(Self::Zero),
"sts" => Ok(Self::Sts),
"cir" => Ok(Self::Cir),
"pcx" => Ok(Self::Pcx),