PeterLemon / N64

N64 Bare Metal Mips Assembly Programming
294 stars 42 forks source link

Timing tests reliable? #17

Open Zapeth opened 5 years ago

Zapeth commented 5 years ago

I'm wondering how reliable the results of the timing tests are, do they always pass on real hardware or is there a count mismatch sometimes? (it would be ideal to test with multiple consoles/monitors, unfortunately I don't own a console myself so I can't test)

If so then it might be better to check against a const +/- delta value that is appropriately sized (depending on how much the result can vary).

bryanperris commented 5 years ago

I think this test should 100% pass everytime on the real hardware since its using the video interface as a timer. As for emulators, mine completely failed it, but also there isn't a screenshot to compare the values to to see how far off I was, and as for other emulators no doubt they will fail it due to lack of support for an accurate video interface but cen64 could be an exception due to its cycle accurate goal. Also these timings only apply to NTSC.

Zapeth commented 5 years ago

I think this test should 100% pass everytime on the real hardware since its using the video interface as a timer.

Not necessarily, for one the vi timer might not be (and probably isn't) synchronized to the instructions that get tested. Other than that, one timing test consists of multiple different instructions which could cause varying results depending on how much time each of those instructions take (I'm not even sure if instructions like SYNC have a fixed timing).

I might be wrong of course, but thats why I wanted to have a verification of at least 2-3 test runs that were executed on real hardware.

Actually, there was someone who reported varying timing results on his hardware -> https://github.com/mupen64plus/mupen64plus-core/issues/554#issuecomment-383182556 Granted those are different timing tests roms but they seem to be based on the roms here, so I think it at least justifies a double check.

bryanperris commented 5 years ago

Sounds like instead the core clock needs to be tracked before and after each instruction. I wish I had the n64 drive to test this a few times. Can the TV itself affect the scanline timing? I assumed that the video codec chip didn't care since it reads out every line using a fixed a clock source.

Zapeth commented 5 years ago

I assumed that the video codec chip didn't care since it reads out every line using a fixed a clock source.

Thats what I'm assuming too, but again it would be nice to have it tested, just to be on the safe side. I have a few ideas on how to do the timing tests in a different way, though I'm by no means an expert on the matter and don't know if any of them are any good, especially compared to the current implementation.

So I'll hold off with any further discussion/speculation until someone posts the results of 2-3 runs of these tests that were conducted real hardware (preferably with screenshots), I could be wrong with my original assumption after all (hence the question mark in the title).