summaryrefslogtreecommitdiff
path: root/src/chip8.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/chip8.rs')
-rw-r--r--src/chip8.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/chip8.rs b/src/chip8.rs
index 22c8570..8dca81e 100644
--- a/src/chip8.rs
+++ b/src/chip8.rs
@@ -122,6 +122,14 @@ impl Chip8 {
eprintln!("XOR V{}, V{}", x, y);
self.v[x] = self.v[x] ^ self.v[y];
}
+ 0x0004 => {
+ eprintln!("ADD V{}, V{}", x, y);
+ let vx = self.v[x] as u16;
+ let vy = self.v[y] as u16;
+ let v = vx + vy;
+ self.v[0xF] = if v > 255 { 1 } else { 0 };
+ self.v[x] = v as u8;
+ }
_ => unknown_opcode(opcode),
},
0x9000 => {