LR35902: Whoops: correct broken timer (when it begins at zero!)

Signed-off-by: Adrian Conlon <adrian.conlon@gmail.com>
This commit is contained in:
Adrian Conlon 2020-11-13 14:50:12 +00:00
parent fa7e1480d3
commit eb761bc62f
2 changed files with 2 additions and 1 deletions

View File

@ -153,7 +153,7 @@ void EightBit::GameBoy::IoRegisters::incrementTimers() {
void EightBit::GameBoy::IoRegisters::incrementTimer() {
if (timerEnabled()) {
if (--m_timerCounter == 0) {
if (--m_timerCounter <= 0) {
m_timerCounter += m_timerRate;
incrementTIMA();
}

View File

@ -340,6 +340,7 @@ int EightBit::GameBoy::LR35902::step() {
}
}
ExecutedInstruction.fire(*this);
assert(cycles() % 4 == 0);
return cycles();
}