From bac269c9c2166569210f3ff29906a5bf817e479f Mon Sep 17 00:00:00 2001 From: Thiago Auler dos Santos Date: Wed, 22 Nov 2017 19:47:01 -0200 Subject: [PATCH] correcting subtraction --- src/opcodes.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/opcodes.c b/src/opcodes.c index 0f07353..ee3fb74 100644 --- a/src/opcodes.c +++ b/src/opcodes.c @@ -308,21 +308,24 @@ void cmp() { // compare memory with accumulator fetch_operand(); - subtractor(ac, operand); + operand = operand ^ 0xFF; + adder(ac, operand); } void cpx() { // compare memory and index x fetch_operand(); - subtractor(x, operand); + operand = operand ^ 0xFF; + adder(x, operand); } void cpy() { // compare memory and index y fetch_operand(); - subtractor(y, operand); + operand = operand ^ 0xFF; + adder(y, operand); } void dec()