Branch Timing Test ROMs

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Branch Timing Test ROMs
by on (#12202)
I had some branch timing test ROMs mostly written and the recent thread prompted me to finish them. They test branch timing and the edge cases for page crossings that an emulator might get wrong. I also wrote a concise summary of timing (below).

branch_timing_tests.zip

An untaken branch takes 2 clocks. A taken branch takes 3 clocks. A taken branch that crosses a page takes 4 clocks. Page crossing occurs when the high byte of the branch target address is different than the high byte of the address of the next instruction:

Code:
branch_target:
    ...
    bne   branch_target
next_instruction:
    nop
    ...
branch_target:

by on (#12208)
sweet !! thanks blargg.

i took a break from my ppu to work on timing and do not have nmi timing down yet. ill have to work on that. do these test depend on the odd from ppu tick being dropped ? i assume that they do. or if all the test are run with the ppu off first then turn it on. but then i suppose the nmi isnt set with the ppu off ?

thanks.

matt

by on (#12209)
It's OK here. ^_^;;..

by on (#12212)
I don't think I depend on any exotic PPU behavior, just the NMI occuring every ~29780 CPU clocks. There would be no reason to rely on anything more than that. At reset it just enables NMI and then runs sequences and uses the NMI to time them. I made them fairly loose so your NMI can probably be inaccurate by a few clocks.

What happens when you run the first test ROM?

by on (#12215)
ok, all 3 test pass.

i was thinking about the nmi... i just ran my cpu for 29780 cycles since the nmi is predictable.

an interesting test would be to catch the invalid and dummy reads. i recall you tested this before and determined that repeated reads do effect the ppu. perhaps test the repeated reads, invalid reads.

ill have to think of a way to test that. not sure you would be interested.

matt

by on (#12222)
Is just me or... you ALL are using "timestamps" !? o.O

by on (#12225)
i am using cpu is 15/16 ntsc/pal and ppu is 5. run the cpu and have the ppu catch up. but i am still working on my timing.

matt