fix(instructions): correct the flags being set in ADD HL, r16

This commit is contained in:
Rekai Nyangadzayi Musuka 2021-03-26 20:19:48 -05:00
parent a6d5553035
commit 15781b3d5a
1 changed files with 4 additions and 6 deletions

View File

@ -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
}