Closed emoon closed 8 years ago
I think your interpretation of the cycles are correct, and that Musashi is wrong here. I'll take a look at the PR later! Thanks.
Now that I see the cycle table, I think Musashis interpretation is that ST D0 (Scc where cc = true) is 6 cycles, and SF D0 (Scc where cc = false) is 4 cycles, instead of depending on the outcome of the test. I'll check with EASy68k (which runs just fine on OS X under wine, by the way) on their interpretation.
The EASy68k implementation agrees with your interpretation, but for some reason executing SPL D0 say, in the EASy68k simulator, seems to always consume 8 cycles (the opcodes for reg ops are 0x??C? which should AND to 0).
Ok, I think we've found a bug in EASy68k :)
The comparison should read
if ((inst & 0x0030) == 0)
but without the parens, the precedence rules says it'll be interpreted as:
if (inst & (0x0030 == 0))
which is always false! Nevertheless, I think the intention was to implement it your way :)
That seems wrong. The 68k manual clearly states 6/4 for register and 8+ for memory.
Ah :) Yeah that makes sense. Seems we are finding bugs in our compare implementations quite a bit :)
Indeed, gcc complains "& has lower precedence than ==; == will be evaluated first" when trying to compile a sample to verify this.
And rust has a different precedence, the expected one in this case :+1: so no parens needed.
Reported that bug on the EASy68k forum, it's been a helpful tool so far.
New PR ready. I'm doing 6 cycles on true here and 4 on false (which I think is the correct approach)