Felix icon indicating copy to clipboard operation
Felix copied to clipboard

Suzy - Math timing wrong

Open 42Bastian opened this issue 3 years ago • 8 comments

The timing either SuzyMath or Timers seems to be wrong. Using cycle_check I see that multiplication takes 36 cycles and multiplication with sign and accu 41 cycles.

42Bastian avatar Nov 08 '21 08:11 42Bastian

@42Bastian could you attach some some code testing it? I'll debug it.

laoo avatar Nov 08 '21 10:11 laoo

Here two versions of cycle_check. Signed + Accu and one w/o. Signed/Accu shows 160 the other 154. Both do 1024 multiplications, time in in 64us ticks

cycle_check_sign_accu.zip cycle_check.zip

42Bastian avatar Nov 08 '21 11:11 42Bastian

Sorry, the test was wrong. I'll try something different

laoo avatar Nov 08 '21 12:11 laoo

@42Bastian I was looking into it and it's hard to obtain desired timing without some "magic constants". I'll try to work with some simpler tests before this.

laoo avatar Nov 08 '21 19:11 laoo

Well, I think most important is that timers are correct and math cycles are not more than on hardware. Cycle accurate emulation of the Lynx is hard to achieve esp. when then manual says that you should not rely on exact timing ;-)

42Bastian avatar Nov 08 '21 20:11 42Bastian

@42Bastian I thing that generally top priority have the issues to make Felix correct and stable, especially to run all official games. Achieving cycle-exactness should be next and to that we should devise a set of possible simple tests to check and correct relation between CPU cycles and timers. Hardest part could be to obtain cycle exact sprite blitting.

laoo avatar Nov 09 '21 07:11 laoo

That's what I wanted to say. Even the official docs state, that one should no rely on exact cycles. So yes, first step should be to have the sprite engine work correctly. There are still many flaws (xor sprite, tilt/stretch). I will try to prepare simple tests.

42Bastian avatar Nov 09 '21 07:11 42Bastian

@42Bastian Official docs instruct game developer. We're doing something completely different, as we are here emulator developers and trying to make cycle-exact emulator is perfectly OK ;)

laoo avatar Nov 09 '21 07:11 laoo