Author: aandrejevic
Date: Fri Nov 22 02:02:05 2013
New Revision: 61069
URL:
http://svn.reactos.org/svn/reactos?rev=61069&view=rev
Log:
[FAST486]
DAA, DAS: Update the flags.
AAA, AAS: Subtract from AX instead of AL. The specification says AL, but
so far in all known CPUs and emulators, AX is subtracted.
AAD: Clear AH.
Modified:
branches/ntvdm/lib/fast486/opcodes.c
Modified: branches/ntvdm/lib/fast486/opcodes.c
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/lib/fast486/opcodes.c?rev…
==============================================================================
--- branches/ntvdm/lib/fast486/opcodes.c [iso-8859-1] (original)
+++ branches/ntvdm/lib/fast486/opcodes.c [iso-8859-1] Fri Nov 22 02:02:05 2013
@@ -3042,6 +3042,13 @@
State->Flags.Cf = TRUE;
}
+ Value = State->GeneralRegs[FAST486_REG_EAX].LowByte;
+
+ /* Update the flags */
+ State->Flags.Sf = (Value & SIGN_FLAG_BYTE) != 0;
+ State->Flags.Zf = (Value == 0);
+ State->Flags.Pf = Fast486CalculateParity(Value);
+
return TRUE;
}
@@ -3374,6 +3381,13 @@
State->Flags.Cf = TRUE;
}
+ Value = State->GeneralRegs[FAST486_REG_EAX].LowByte;
+
+ /* Update the flags */
+ State->Flags.Sf = (Value & SIGN_FLAG_BYTE) != 0;
+ State->Flags.Zf = (Value == 0);
+ State->Flags.Pf = Fast486CalculateParity(Value);
+
return TRUE;
}
@@ -3388,7 +3402,7 @@
if (((Value & 0x0F) > 9) || State->Flags.Af)
{
/* Correct it */
- State->GeneralRegs[FAST486_REG_EAX].LowByte += 0x06;
+ State->GeneralRegs[FAST486_REG_EAX].LowWord += 0x06;
State->GeneralRegs[FAST486_REG_EAX].HighByte++;
/* Set CF and AF */
@@ -3417,7 +3431,7 @@
if (((Value & 0x0F) > 9) || State->Flags.Af)
{
/* Correct it */
- State->GeneralRegs[FAST486_REG_EAX].LowByte -= 0x06;
+ State->GeneralRegs[FAST486_REG_EAX].LowWord -= 0x06;
State->GeneralRegs[FAST486_REG_EAX].HighByte--;
/* Set CF and AF */
@@ -4876,6 +4890,7 @@
State->GeneralRegs[FAST486_REG_EAX].LowByte = Value %= Base;
/* Update flags */
+ State->Flags.Af = FALSE;
State->Flags.Zf = (Value == 0);
State->Flags.Sf = ((Value & SIGN_FLAG_BYTE) != 0);
State->Flags.Pf = Fast486CalculateParity(Value);
@@ -4899,9 +4914,10 @@
/* Adjust */
Value += State->GeneralRegs[FAST486_REG_EAX].HighByte * Base;
- State->GeneralRegs[FAST486_REG_EAX].LowByte = Value;
+ State->GeneralRegs[FAST486_REG_EAX].LowWord = Value;
/* Update flags */
+ State->Flags.Af = FALSE;
State->Flags.Zf = (Value == 0);
State->Flags.Sf = ((Value & SIGN_FLAG_BYTE) != 0);
State->Flags.Pf = Fast486CalculateParity(Value);