fix stupid mistake
This commit is contained in:
parent
1108291ad0
commit
ab04bbcdb6
1 changed files with 4 additions and 1 deletions
|
@ -9,6 +9,7 @@ fn main() {
|
||||||
let instructions = fs::read_to_string(&args[1])
|
let instructions = fs::read_to_string(&args[1])
|
||||||
.expect("Instructions could not be read.");
|
.expect("Instructions could not be read.");
|
||||||
let mut i: i32 = 0;
|
let mut i: i32 = 0;
|
||||||
|
let mut ii = 0;
|
||||||
|
|
||||||
if Path::new("registers").exists() {
|
if Path::new("registers").exists() {
|
||||||
let lreg = fs::read_to_string("registers")
|
let lreg = fs::read_to_string("registers")
|
||||||
|
@ -25,6 +26,7 @@ fn main() {
|
||||||
|
|
||||||
let split: Vec<&str> = instructions.split("\n").collect();
|
let split: Vec<&str> = instructions.split("\n").collect();
|
||||||
loop {
|
loop {
|
||||||
|
ii = ii + 1;
|
||||||
let s = split[i as usize];
|
let s = split[i as usize];
|
||||||
if s.contains("inc") {
|
if s.contains("inc") {
|
||||||
let splitinstr: Vec<&str> = s.split("inc ").collect();
|
let splitinstr: Vec<&str> = s.split("inc ").collect();
|
||||||
|
@ -61,7 +63,8 @@ fn main() {
|
||||||
a = a + 1;
|
a = a + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
println!("Program Step: {}", i);
|
println!("Instruction Pointer: {}", i);
|
||||||
|
println!("Program Step: {}", ii);
|
||||||
process::exit(0x0100);
|
process::exit(0x0100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue