cpu/cpu - Fix carry and halfcarry in aluop8

Found by Gameboy Doctor
This commit is contained in:
madmaurice 2023-09-01 23:19:31 +02:00
parent c52aa91f26
commit 899cebb698

View file

@ -219,7 +219,7 @@ void Cpu::aluop8(AluOp op, u8 lhs, u8 rhs, u8& out, bool update_carry)
break;
}
state.halfcarry = (res16 & 0x10 != 0) || op == AND;
state.halfcarry = ((res16 & 0x10) != 0) || op == AND;
state.subtract = (op == SUB) || (op == SBC) || (op == CP);
switch(op)
@ -247,7 +247,7 @@ void Cpu::aluop8(AluOp op, u8 lhs, u8 rhs, u8& out, bool update_carry)
res = (u8)(res16 & 0xFF);
if(update_carry)
state.carry = (res16 & 0x100 != 0);
state.carry = ((res16 & 0x100) != 0);
state.zero = (res == 0);