commit - 830b524dd8e1b18caf0e5e3237a6b04e8a5be715
commit + 1f507d0a4020fb4e7670371d6f047ca0ee5d09cd
blob - 229bc8bfa94c4c29a2ab62e2404f861703ad7a4b
blob + 317d1913eea524c00014a76d9ebf55b6546cbd7d
--- src/chip8.rs
+++ src/chip8.rs
// skip next instruction if Vx == byte
if self.regs[reg as usize] == byte {
- self.pc = self.pc + 4;
+ self.pc += 4;
+ } else {
+ self.pc += 2;
}
},
+ // SNE
+ 0x4 {
+ let reg = instruction & 0x0F00;
+ let byte = (instruction & 0x00FF) as u8;
+
+ // skip next instruction if Vk != byte
+ if self.regs[reg as usize] != byte {
+ self.pc += 4;
+ } else {
+ self.pc += 2;
+ }
+ }
_ => {
return Err(format!("{:#06x}: not an instruction", instruction));
}