bootrom mostly works, refactoring and all opcodes added
This commit is contained in:
12
src/timing.cpp
Normal file
12
src/timing.cpp
Normal file
@@ -0,0 +1,12 @@
|
||||
#include "gameboy.hpp"
|
||||
|
||||
//handles most of the behavoir as described here: https://gbdev.io/pandocs/Timer_and_Divider_Registers.html#ff04--div-divider-register
|
||||
void GameBoy::timingHandler() {
|
||||
if (cycles - lastDivUpdate >= DIVIDER_REGISTER_FREQ) {
|
||||
const uint8_t increments = (cycles - lastDivUpdate) / DIVIDER_REGISTER_FREQ;
|
||||
|
||||
(*DIV) += increments;
|
||||
|
||||
lastDivUpdate += increments * DIVIDER_REGISTER_FREQ;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user