From 49a6fc0377c3d5adf6deae344f5662db92bb8816 Mon Sep 17 00:00:00 2001 From: John Breaux Date: Sat, 25 Mar 2023 17:45:22 -0500 Subject: [PATCH] dump.rs: Does not spark joy (remove dump.rs) --- src/cpu.rs | 2 -- src/dump.rs | 63 ----------------------------------------------------- src/lib.rs | 2 -- 3 files changed, 67 deletions(-) delete mode 100644 src/dump.rs diff --git a/src/cpu.rs b/src/cpu.rs index d711c14..d6888bc 100644 --- a/src/cpu.rs +++ b/src/cpu.rs @@ -389,8 +389,6 @@ impl CPU { *byte = 0; } } - //use dump::BinDumpable; - //bus.bin_dump(self.screen as usize..self.screen as usize + 0x100); } /// 00ee: Returns from subroutine #[inline] diff --git a/src/dump.rs b/src/dump.rs deleted file mode 100644 index 6a26200..0000000 --- a/src/dump.rs +++ /dev/null @@ -1,63 +0,0 @@ -//! Dumps data to stdout -use std::ops::Range; - -/// Prints a hexdump of a range within the `Dumpable` -/// -/// # Examples -/// ```rust -/// # use chumpulator::prelude::*; -/// let mem = Mem::new(0x50); -/// // Dumps the first 0x10 bytes -/// mem.dump(0x00..0x10); -/// ``` -pub trait Dumpable { - /// Prints a hexdump of a range within the object - fn dump(&self, range: Range); -} - -/// Prints a binary dump of a range within the `Dumpable` -/// -/// # Examples -/// ```rust -/// # use chumpulator::prelude::*; -/// let mem = bus! { -/// "mem" [0..0x10] = Mem::new(0x10) -/// }; -/// // Dumps the first 0x10 bytes -/// mem.bin_dump(0x00..0x10); -/// ``` -pub trait BinDumpable { - /// Prints a binary dump of a range within the object - fn bin_dump(&self, _range: Range) {} -} - -pub fn as_hexdump(index: usize, byte: u8) { - use owo_colors::OwoColorize; - let term: owo_colors::Style = owo_colors::Style::new().bold().green().on_black(); - - if index % 2 == 0 { - print!(" ") - } - if index % 8 == 0 { - print!(" ") - } - if index % 16 == 0 { - print!("{:>03x}{} ", index.style(term), ":".style(term)); - } - print!("{byte:02x}"); - if index % 16 == 0xf { - println!() - } -} - -pub fn as_bindump(index: usize, byte: u8) { - use owo_colors::OwoColorize; - let term: owo_colors::Style = owo_colors::Style::new().bold().green().on_black(); - if index % 8 == 0 { - print!("{:>03x}{} ", index.style(term), ":".style(term)); - } - print!("{byte:08b} "); - if index % 8 == 7 { - println!() - } -} diff --git a/src/lib.rs b/src/lib.rs index eaf9868..5077800 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,14 +12,12 @@ pub mod cpu; pub mod error; pub mod io; -pub mod dump; /// Common imports for chumpulator pub mod prelude { use super::*; pub use crate::bus; pub use cpu::{disassemble::Disassemble, CPU}; - pub use dump::{BinDumpable, Dumpable}; pub use io::{*, WindowBuilder}; pub use bus::{Bus, Read, Region::*, Write}; }