rol with register rotate count
Page 1 of 1

Author:  PiCiJi [ Wed Mar 13, 2013 4:01 pm ]
Post subject:  rol with register rotate count

MOVE.L #$ce3dd567, D0
MOVE.L #20, D1
ROL.W D1, D0

The carry flag should be set after rol instruction above (confirmed on real 68020) but it's set with a shift count of 4 only in EASy68K.
If I understand that right a shift count of 20 generate the same result like a shift count of 4 by word size operation.
Sure there should be no reason to use a shift count higher than operation size, because of higher cycle consumption.

Author:  profkelly [ Thu Mar 14, 2013 6:44 pm ]
Post subject:  Re: rol with register rotate count

Thank you for the feedback.

The code that calculates the Carry flag for ROL in EASy68K was incorrect.
Here is the latest code in Sim68K v5.12.27:
      r %= (m+1);               // shift count MOD size
      if(r == 0)
        c_bit = (dest & 1) ? true : false;
        c_bit = ((dest >> (m+1-r)) & 1) ? true : false;
r is the shift count, m is 7 for .B, 15 for .W and 31 for .L instruction size.
c_bit is set to 0 elsewhere if r is 0.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group