From 15781b3d5a57c37f9d7872c3b4c5e27704f0185c Mon Sep 17 00:00:00 2001 From: Rekai Musuka Date: Fri, 26 Mar 2021 20:19:48 -0500 Subject: [PATCH] fix(instructions): correct the flags being set in ADD HL, r16 --- src/instruction.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/instruction.rs b/src/instruction.rs index 16ec1bf..eee0cff 100644 --- a/src/instruction.rs +++ b/src/instruction.rs @@ -1504,12 +1504,10 @@ impl Instruction { fn add_u16s(left: u16, right: u16, flags: &mut Flags) -> u16 { let (sum, did_overflow) = left.overflowing_add(right); - flags.update( - false, - Self::add_u16_half_carry(left, right), - flags.h(), - did_overflow, - ); + flags.set_n(false); + flags.set_h(Self::add_u16_half_carry(left, right)); + flags.set_c(did_overflow); + sum }