Finally find (& fix) bug in BIT instructions
Some checks failed
Cargo Build & Test / Rust project - latest (stable) (push) Failing after 26s
Some checks failed
Cargo Build & Test / Rust project - latest (stable) (push) Failing after 26s
- BIT not longer ANDs the A register - I now a pretty good debug view for debugging the CPU - I wrote a number_input element for iced - I upgraded to iced 0.14 - I added images for play and pause - The debug log now displays in the debug view
This commit is contained in:
46
src/debug.rs
46
src/debug.rs
@@ -18,31 +18,49 @@ impl DebugLog {
|
||||
}
|
||||
|
||||
pub fn rotate(&mut self) {
|
||||
let rot = std::mem::take(&mut self.current);
|
||||
if let Some(max) = self.max_history {
|
||||
if self.history.len() < max.into() {
|
||||
self.history.push(rot);
|
||||
} else {
|
||||
self.history[self.pos] = rot;
|
||||
self.pos = (self.pos + 1) % max.get();
|
||||
}
|
||||
} else {
|
||||
self.history.push(rot);
|
||||
}
|
||||
// if self.current.len() > 500 {
|
||||
let mut rot = std::mem::take(&mut self.current);
|
||||
self.current = rot.split_off(rot.rfind('\n').unwrap_or(rot.len()));
|
||||
// if let Some(max) = self.max_history {
|
||||
// if self.history.len() < max.into() {
|
||||
// self.history.extend(rot.lines().map(|s| s.to_owned()));
|
||||
// } else {
|
||||
// self.history[self.pos] = rot;
|
||||
// self.pos = (self.pos + 1) % max.get();
|
||||
// }
|
||||
// } else {
|
||||
// self.history.push(rot);
|
||||
self.history.extend(rot.lines().map(|s| s.to_owned()));
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
// pub fn current(&self) -> &str {
|
||||
// &self.current
|
||||
// }
|
||||
|
||||
pub fn history(&self) -> &[String] {
|
||||
&self.history[self.history.len().saturating_sub(100)..]
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Write for DebugLog {
|
||||
fn write_str(&mut self, s: &str) -> std::fmt::Result {
|
||||
self.current.write_str(s)
|
||||
let tmp = self.current.write_str(s);
|
||||
self.rotate();
|
||||
tmp
|
||||
}
|
||||
|
||||
fn write_char(&mut self, c: char) -> std::fmt::Result {
|
||||
self.current.write_char(c)
|
||||
let tmp = self.current.write_char(c);
|
||||
self.rotate();
|
||||
tmp
|
||||
}
|
||||
|
||||
fn write_fmt(&mut self, args: std::fmt::Arguments<'_>) -> std::fmt::Result {
|
||||
self.current.write_fmt(args)
|
||||
let tmp = self.current.write_fmt(args);
|
||||
self.rotate();
|
||||
tmp
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user