From acccaf3a9090291e0f20cc886eaaf83b65112bc2 Mon Sep 17 00:00:00 2001 From: Aleksandar Andrejevic Date: Wed, 13 Nov 2013 13:32:00 +0000 Subject: [PATCH] [FAST486] Fix a bug in the ROL and ROR instructions. svn path=/branches/ntvdm/; revision=60972 --- lib/fast486/opgroups.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/fast486/opgroups.c b/lib/fast486/opgroups.c index 27950cd3d0f..fd996619415 100644 --- a/lib/fast486/opgroups.c +++ b/lib/fast486/opgroups.c @@ -167,8 +167,7 @@ Fast486RotateOperation(PFAST486_STATE State, /* Normalize the count */ Count &= 0x1F; - if (Operation <= 1) Count %= Bits; - else if (Operation <= 3) Count %= Bits + 1; + if ((Operation == 2) || (Operation == 3)) Count %= Bits + 1; /* If the count is zero, do nothing */ if (Count == 0) return Value; @@ -179,6 +178,7 @@ Fast486RotateOperation(PFAST486_STATE State, /* ROL */ case 0: { + Count %= Bits; Result = (Value << Count) | (Value >> (Bits - Count)); /* Update CF and OF */ @@ -192,6 +192,7 @@ Fast486RotateOperation(PFAST486_STATE State, /* ROR */ case 1: { + Count %= Bits; Result = (Value >> Count) | (Value << (Bits - Count)); /* Update CF and OF */