Compare commits
2 Commits
410c54c2f8
...
56fcfb5230
| Author | SHA1 | Date | |
|---|---|---|---|
| 56fcfb5230 | |||
| a43277c159 |
@@ -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;
|
||||||
|
|||||||
@@ -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)
|
||||||
";
|
";
|
||||||
|
|||||||
Reference in New Issue
Block a user