Compare commits

...

2 Commits

Author SHA1 Message Date
Mwa
56fcfb5230 removed debug print 2026-03-16 19:08:02 +01:00
Mwa
a43277c159 improved debuger 2026-03-16 19:02:00 +01:00
2 changed files with 6 additions and 5 deletions

View File

@@ -388,7 +388,6 @@ impl Computer {
while let Some((_, line)) = lines.next() { while let Some((_, line)) = lines.next() {
if let Some([addr, s]) = line.split_ascii_whitespace().collect::<Vec<_>>().as_array() { if let Some([addr, s]) = line.split_ascii_whitespace().collect::<Vec<_>>().as_array() {
if let Ok(i) = u32::from_str_radix(addr, 16) { if let Ok(i) = u32::from_str_radix(addr, 16) {
println!("adding label {s} at addr {i}");
new.book.insert(i, s.to_string()); new.book.insert(i, s.to_string());
} }
} }
@@ -663,7 +662,6 @@ impl Computer {
} }
_ => { /* This is a troubling case but ... well it's ok */ } _ => { /* This is a troubling case but ... well it's ok */ }
} }
println!("returning from interupt");
let ret = self.ram[self.sp]; let ret = self.ram[self.sp];
self.pc = (ret & 0x0FFF_FFFF) as usize; self.pc = (ret & 0x0FFF_FFFF) as usize;
self.sp += 1 as usize; self.sp += 1 as usize;

View File

@@ -416,15 +416,17 @@ fn main() -> Result<(), Error> {
if next.len() >= 2 { if next.len() >= 2 {
match parse_int::parse::<u32>(next[1]) { match parse_int::parse::<u32>(next[1]) {
Ok(v) => { Ok(v) => {
while !simulation.error && simulation.pc != (v as usize/4) { while !simulation.error
&& simulation.pc != (v as usize / 4)
{
simulation.step(); simulation.step();
} }
false false
}, }
Err(e) => { Err(e) => {
println!("{e}"); println!("{e}");
true true
}, }
} }
} else { } else {
println!("{HELP_MSG}"); println!("{HELP_MSG}");
@@ -464,4 +466,5 @@ run - run program until exit / error (alias r)
context - print context (alias c) context - print context (alias c)
print n - print ram content at address n and next 8 (alias p) print n - print ram content at address n and next 8 (alias p)
up - run until the nex ret is reached (alias u) up - run until the nex ret is reached (alias u)
to n - tun until PC = n (alias t)
"; ";