EASy68K
http://www.easy68k.com/EASy68Kforum/

ROR setting C flag incorrectly
http://www.easy68k.com/EASy68Kforum/viewtopic.php?f=8&t=1482
Page 1 of 1

Author:  Fowler [ Fri May 01, 2015 2:54 pm ]
Post subject:  ROR setting C flag incorrectly

I think I've come across a bug in 5.15.02 (If I'm reading my Motorola 68000 PRM correctly) when ROR is used in an admittedly strange way.
Code:
moveq  #$FF,d0
ror.b  d0, d0
rol.b  d0, d0


The C flag is NOT set after the ROR, but it IS set after the ROL. From my reading of the docs, the ROR should be setting the C flag too.

According to the PRM on page 4-161 "(C is ) set according to the last bit rotated out of the operand; cleared when the rotate count is zero". Also, later on on the same page "Bits rotated out of the low-order bit go to the carry bit and also back into the high-order bit.""

The rotate count is $FFFFFFFF % 64 which is 63 so the "cleared when the rotate count is 0" exception doesn't apply. All bits in the operand are 1 so the last bit out of the operand can never be 0 and hence C can never be 0 either. Am I missing something obvious here? Thanks!

Author:  profkelly [ Tue May 05, 2015 2:05 pm ]
Post subject:  Re: ROR setting C flag incorrectly

Confirmed. I'll take a look at the code.

Author:  profkelly [ Thu May 21, 2015 3:42 pm ]
Post subject:  Re: ROR setting C flag incorrectly

Corrected in EASy68K V5.15.03 May-21-2015

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/