From aeb1bdd6d4422c20997b34083021538141ff3098 Mon Sep 17 00:00:00 2001 From: pjht Date: Thu, 2 Nov 2023 14:10:35 -0500 Subject: [PATCH] Clean up MMU card display --- src/card.rs | 1 - src/mmu.rs | 22 +++++++++------------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/card.rs b/src/card.rs index d58b100..e7dd331 100644 --- a/src/card.rs +++ b/src/card.rs @@ -149,7 +149,6 @@ pub trait Mmu: Debug { ) -> NullableResult; } - #[allow(dead_code)] pub const fn u64_set_be_byte(val: u64, idx: u8, byte: u8) -> u64 { let mut bytes = val.to_be_bytes(); diff --git a/src/mmu.rs b/src/mmu.rs index 481e5ea..36e7867 100644 --- a/src/mmu.rs +++ b/src/mmu.rs @@ -143,32 +143,28 @@ impl Card for MmuCard { impl Display for MmuCard { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { let q1 = if self.map_frames_enabled[0] { - Some(self.map_frames[0]) + format!("{:#x}", self.map_frames[0]) } else { - None + "disabled".to_string() }; let q2 = if self.map_frames_enabled[1] { - Some(self.map_frames[1]) + format!("{:#x}", self.map_frames[1]) } else { - None + "disabled".to_string() }; let q3 = if self.map_frames_enabled[2] { - Some(self.map_frames[2]) + format!("{:#x}", self.map_frames[2]) } else { - None + "disabled".to_string() }; let q4 = if self.map_frames_enabled[3] { - Some(self.map_frames[3]) + format!("{:#x}", self.map_frames[3]) } else { - None + "disabled".to_string() }; f.write_fmt(format_args!( - "MMU card, {} (Q1: {:?}, Q2: {:?}, Q3: {:?}, Q4: {:?})", + "MMU card, {} (Q1: {q1}, Q2: {q2}, Q3: {q3}, Q4: {q4})", if self.enabled { "enabled" } else { "disabled" }, - q1, - q2, - q3, - q4 )) } }