nba-emu / NanoBoyAdvance

A cycle-accurate Nintendo Game Boy Advance emulator.
GNU General Public License v3.0
971 stars 56 forks source link

Mutli-Component Test Fail #334

Open alyosha-tas opened 11 months ago

alyosha-tas commented 11 months ago

I have a new test here that currently doesn't work on NanoboyAdvacnce:

https://github.com/alyosha-tas/gba-tests/blob/master/timer/timer_reset.gba

It's named timer_reset because it is supposed to read from timer one cycle after writing to timer enable. It does this by using DMA 1 to start the timer, then DMA 0 to read the timer. DMA's are started with consecutive writes, so DMA 0 should take over exactly when DMA 1 has finished writing to the timer reg.

NanoboyAdvance currently fails one of the tests, but I can't tell why. Works on GBP though.

fleroviux commented 11 months ago

Oh, I think this relates to that after enabling the timer it can tick right away but it takes a cycle to load the reload value into the counter. So far I accounted for the case specifically where this would cause a timer overflow, but I didn't handle the case where a counter read would happen right after enabling the timer correctly yet.