dump.rs: Does not spark joy (remove dump.rs)
This commit is contained in:
parent
4ab7dcbe6a
commit
49a6fc0377
@ -389,8 +389,6 @@ impl CPU {
|
|||||||
*byte = 0;
|
*byte = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//use dump::BinDumpable;
|
|
||||||
//bus.bin_dump(self.screen as usize..self.screen as usize + 0x100);
|
|
||||||
}
|
}
|
||||||
/// 00ee: Returns from subroutine
|
/// 00ee: Returns from subroutine
|
||||||
#[inline]
|
#[inline]
|
||||||
|
63
src/dump.rs
63
src/dump.rs
@ -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<usize>);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 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<usize>) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
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!()
|
|
||||||
}
|
|
||||||
}
|
|
@ -12,14 +12,12 @@ pub mod cpu;
|
|||||||
pub mod error;
|
pub mod error;
|
||||||
pub mod io;
|
pub mod io;
|
||||||
|
|
||||||
pub mod dump;
|
|
||||||
|
|
||||||
/// Common imports for chumpulator
|
/// Common imports for chumpulator
|
||||||
pub mod prelude {
|
pub mod prelude {
|
||||||
use super::*;
|
use super::*;
|
||||||
pub use crate::bus;
|
pub use crate::bus;
|
||||||
pub use cpu::{disassemble::Disassemble, CPU};
|
pub use cpu::{disassemble::Disassemble, CPU};
|
||||||
pub use dump::{BinDumpable, Dumpable};
|
|
||||||
pub use io::{*, WindowBuilder};
|
pub use io::{*, WindowBuilder};
|
||||||
pub use bus::{Bus, Read, Region::*, Write};
|
pub use bus::{Bus, Read, Region::*, Write};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user