GB: Halt bug emulation

This commit is contained in:
Sour 2020-06-09 22:17:52 -04:00
parent c47f0d642f
commit f75ca7c5d0

View file

@ -731,8 +731,15 @@ void GbCpu::STOP()
void GbCpu::HALT()
{
//TODO: HALT BUG emulation
_state.Halted = true;
if(_state.IME || _memoryManager->ProcessIrqRequests() == 0) {
_state.Halted = true;
} else {
//HALT bug, execution continues, but PC isn't incremented for the first byte
HalfCycle();
uint8_t opCode = _memoryManager->Read<MemoryOperationType::ExecOpCode>(_state.PC);
HalfCycle();
ExecOpCode(opCode);
}
}
// cpl 2F 4 -11- A = A xor FF