Clean up MMU card display

This commit is contained in:
pjht 2023-11-02 14:10:35 -05:00
parent 94684dbc4f
commit aeb1bdd6d4
Signed by: pjht
GPG Key ID: CA239FC6934E6F3A
2 changed files with 9 additions and 14 deletions

View File

@ -149,7 +149,6 @@ pub trait Mmu: Debug {
) -> NullableResult<u32, BusError>;
}
#[allow(dead_code)]
pub const fn u64_set_be_byte(val: u64, idx: u8, byte: u8) -> u64 {
let mut bytes = val.to_be_bytes();

View File

@ -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
))
}
}