From 890bb16145d55a72c30135572ad93660b28f10d9 Mon Sep 17 00:00:00 2001 From: n loewen Date: Tue, 25 Jul 2023 18:57:35 +0100 Subject: [PATCH] Fix bug in addition --- simulator-sketch.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simulator-sketch.js b/simulator-sketch.js index dd8ff70..931a89e 100644 --- a/simulator-sketch.js +++ b/simulator-sketch.js @@ -58,7 +58,7 @@ function CPU(mem) { add_addr: (addr) => { console.log("ADD addr"); if ( (this.acc + this.memory[addr]) > 15 ) { this.carryFlag = 1; } - this.acc = (this.acc + this.memory[addr] % 15); + this.acc = ((this.acc + this.memory[addr]) % 15); this.instructionPointer = this.instructionPointer += 1; },