Re: [hatari-devel] Strange behaviour with ROL.B ?

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


OK, I've fixed $30 and it seems more consistent.

But I still don't have the explanation of why 1 instead of 0 for $10 :

The register.b = 9 %00001001

The rol value is $10 (16) ;)

So, it rols 16 times and returns to the initial state (and carry = 1 because the last bit is a 1)

When the rol value is $40 (64), it should rol 4 times and returns to the initial state (and carry = 1 because the last bit is a 1)

With the 64 modulo, it does a "zero rol" ? Is it the explanation ?

regards and sorry to disturb.

Laurent



Le 28/06/2020 à 10:19, Laurent a écrit :

I agree.

But under Hatari, it's often set instead of clear.

Laurent

Le 28/06/2020 à 10:14, Thorsten Otto a écrit :

On Sonntag, 28. Juni 2020 10:04:04 CEST Laurent wrote:

> rol.b d0 by $40 (if carry bit is set, add 2 to d7)

 

From the manual:

 

2. Register—The rotate count is the value in the data register specified in the instruction, modulo 64.

 

and:

 

C — Set according to the last bit rotated out of the operand; cleared when the rotate count is zero.

 

So in your example, rol by $40 will actually use a count of zero, and the carry flag should always be cleared.

 

 



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/