Commit Diff


commit - 188a4b42e70bce44d0e2caf07da2462c0bc40d20
commit + 830b524dd8e1b18caf0e5e3237a6b04e8a5be715
blob - afab9ce677416cc1b6b310459f62d5967d24d897
blob + 229bc8bfa94c4c29a2ab62e2404f861703ad7a4b
--- src/chip8.rs
+++ src/chip8.rs
@@ -52,6 +52,7 @@ impl Chip8 {
                 // CLS
                 0x0E0 => {
                     self.video_driver.clear();
+                    self.pc += 2;
                 },
                 // RET
                 0x0EE => {
@@ -72,7 +73,7 @@ impl Chip8 {
             },
             // CALL
             0x2 => {
-                self.stack.push(self.pc + 1);
+                self.stack.push(self.pc + 2);
                 self.pc = nnn;
             },
             // SE
@@ -82,7 +83,7 @@ impl Chip8 {
 
                 // skip next instruction if Vx == byte
                 if self.regs[reg as usize] == byte {
-                    self.pc = self.pc + 2;
+                    self.pc = self.pc + 4;
                 }
             },
             _ => {
@@ -99,7 +100,6 @@ impl Chip8 {
         let ins: u16 = (hi << 8) | lo;
 
         self.execute(ins)?;
-        self.pc = self.pc + 2;
 
         Ok(())
     }