mirror of
https://github.com/kirjavascript/trueLMAO.git
synced 2024-05-09 16:33:36 -04:00
add ascii output
This commit is contained in:
parent
5be8e11dbc
commit
fc9a54122b
|
@ -22,6 +22,10 @@ impl ROM {
|
|||
((self.read_word(addr) as u32) << 16) | self.read_word(addr + 2) as u32
|
||||
}
|
||||
|
||||
pub fn size(&self) -> usize {
|
||||
self.bytes.len()
|
||||
}
|
||||
|
||||
pub fn read_string(&self, range: std::ops::Range<usize>) -> String {
|
||||
if range.end >= self.bytes.len() {
|
||||
return format!("end {} >= length {}", range.end, self.bytes.len())
|
||||
|
|
|
@ -36,7 +36,7 @@ impl App {
|
|||
|
||||
// fonts
|
||||
// .families
|
||||
// .entry(egui::FontFamily::Monospace)
|
||||
// .entry(egui::FontFamily::Proportional)
|
||||
// .or_default()
|
||||
// .push("Hack".to_string());
|
||||
|
||||
|
|
|
@ -22,12 +22,20 @@ impl Debug {
|
|||
palette::palette_window(&ctx, &emu);
|
||||
self.vram.render(&ctx, &emu);
|
||||
|
||||
const ASCII: &str = r##"................................ !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~................................. ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþ"##;
|
||||
|
||||
egui::Window::new("memory")
|
||||
.show(ctx, |ui| {
|
||||
|
||||
// TODO: difference accessors
|
||||
|
||||
// let tabs = [
|
||||
// (0xFFFF, &emu.core.mem.ram),
|
||||
// ];
|
||||
|
||||
// emu.core.mem.ram
|
||||
let bytes_row = 16;
|
||||
let total_bytes = 0x10000;
|
||||
let total_bytes = 0xFFFF;
|
||||
let rows = total_bytes / bytes_row;
|
||||
|
||||
egui::ScrollArea::vertical()
|
||||
|
@ -38,11 +46,15 @@ impl Debug {
|
|||
let bytes = (offset..offset+bytes_row)
|
||||
.enumerate()
|
||||
.map(|(idx, offset)| {
|
||||
format!(" {:02x}", emu.core.mem.ram[idx + offset])
|
||||
format!(" {:02X}", emu.core.mem.ram[idx + offset])
|
||||
}).collect::<String>();
|
||||
|
||||
|
||||
ui.label(format!("{:02x} {}", i, bytes));
|
||||
let ascii = (offset..offset+bytes_row)
|
||||
.enumerate()
|
||||
.map(|(idx, offset)| {
|
||||
format!("{}", ASCII.chars().nth(emu.core.mem.ram[idx + offset] as _).unwrap_or('.'))
|
||||
}).collect::<String>();
|
||||
ui.monospace(format!("{:04X} {} {}", i, bytes, ascii));
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue