| @@ -20,7 +20,7 @@ fn main() { |
| 20 | 20 | | // b = 2 |
| 21 | 21 | | mem.write(0x0003, Instruction::MOV as u8); |
| 22 | 22 | | mem.write(0x0004, 1); |
| 23 | | − | mem.write(0x0005, 5); |
| 23 | + | mem.write(0x0005, 3); |
| 24 | 24 | | |
| 25 | 25 | | // a = a + b |
| 26 | 26 | | mem.write(0x0006, Instruction::SUB as u8); |
| @@ -28,7 +28,7 @@ fn main() { |
| 28 | 28 | | mem.write(0x0008, 1); |
| 29 | 29 | | |
| 30 | 30 | | // JMP to halt |
| 31 | | − | mem.write(0x0009, Instruction::JZ as u8); |
| 31 | + | mem.write(0x0009, Instruction::JNZ as u8); |
| 32 | 32 | | mem.write(0x000a, 0x0f); // Low |
| 33 | 33 | | mem.write(0x000b, 0x00); // High |
| 34 | 34 | | |
| @@ -50,6 +50,7 @@ fn main() { |
| 50 | 50 | | x if x == Instruction::SUB as u8 => cpu.sub(&mut mem), |
| 51 | 51 | | x if x == Instruction::JMP as u8 => cpu.jmp(&mut mem), |
| 52 | 52 | | x if x == Instruction::JZ as u8 => cpu.jz(&mut mem), |
| 53 | + | x if x == Instruction::JNZ as u8 => cpu.jnz(&mut mem), |
| 53 | 54 | | x if x == Instruction::HLT as u8 => cpu.halt(), |
| 54 | 55 | | _ => panic!("Unknown opcode {:02X}", opcode), |
| 55 | 56 | | } |