summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Perrouault <samuel.perrouault@gmail.com>2025-03-26 14:01:55 +0100
committerSamuel Perrouault <samuel.perrouault@gmail.com>2025-03-26 14:01:55 +0100
commit42936f4fbbb1d919ddf3ab5fd902e1027b07001a (patch)
tree17bee0ebd352cd5254584e8c29d18a000d6e0a68
parent5d8739ce7eb37d62d4547ea3b0dd38ae52737ecb (diff)
make ADD wrap around
-rw-r--r--src/chip8.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/chip8.rs b/src/chip8.rs
index 9fd1178..7881285 100644
--- a/src/chip8.rs
+++ b/src/chip8.rs
@@ -95,7 +95,7 @@ impl Chip8 {
}
0x7000 => {
eprintln!("ADD V{}, {}", x, nn);
- self.v[x] += nn;
+ self.v[x] = self.v[x].wrapping_add(nn);
}
0xA000 => {
eprintln!("LD I, {}", nnn);