-
Notifications
You must be signed in to change notification settings - Fork 33
Part 08 Timer
Go Home
The timer is a hardware device in the Gameboy that essentially keeps track of time. It has two separate registers that increment at different frequencies. One register (0xFF04) is the divider register and it increments at a rate of 16384Hz, or 256 clock cycles. If the game wants to reset this timer to zero, it can write any value to this address. When the register overflows, it resets to 0x00.
The second register (0xFF05) is more flexible and can run at 4 different frequencies (4096Hz [1024 cycles], 16384Hz [256 cycles], 65536Hz [64 cycles], and 262144Hz [16 cycles]). This rate is controlled by 0xFF07. This timer can be stopped and started with the same address. When it overflows, it resets to the value of 0xFF06. Whenever this timer overflows it will fire the 0x50 interrupt if it has been enabled.