bootrom mostly works, refactoring and all opcodes added

This commit is contained in:
2024-03-25 01:34:44 -07:00
parent 64e2e197fd
commit 7854862850
11 changed files with 4091 additions and 214 deletions

12
src/timing.cpp Normal file
View 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;
}
}