Skip to content

Commit

Permalink
gba: timer 0 count-up bit cannot be set (#1392)
Browse files Browse the repository at this point in the history
The count-up bit for timer 0 cannot be set on hardware ([test
ROM](https://github.com/png183/gba-tests/blob/master/timer/timer_check_count_up_presence.gba)).
This PR implements said behaviour in ares, preventing timer 0 from
incorrectly halting if this bit is written.
  • Loading branch information
png183 authored Feb 14, 2024
1 parent d32b3ff commit 21ca9cf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ares/gba/cpu/io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,10 +309,11 @@ auto CPU::writeIO(n32 address, n8 data) -> void {
bool enable = timer().enable;

timer().frequency = data.bit(0,1);
timer().cascade = data.bit(2);
timer().irq = data.bit(6);
timer().enable = data.bit(7);

if(address != 0x0400'0102) timer().cascade = data.bit(2);

if(!enable && timer().enable) { //0->1 transition
timer().pending = true;
}
Expand Down

0 comments on commit 21ca9cf

Please sign in to comment.