[SOFT386]
authorAleksandar Andrejevic <aandrejevic@reactos.org>
Thu, 29 Aug 2013 22:18:28 +0000 (22:18 +0000)
committerAleksandar Andrejevic <aandrejevic@reactos.org>
Thu, 29 Aug 2013 22:18:28 +0000 (22:18 +0000)
Implement CMC instruction.

svn path=/branches/ntvdm/; revision=59892

lib/soft386/opcodes.c
lib/soft386/opcodes.h

index d104ce7..c74dc35 100644 (file)
@@ -269,7 +269,7 @@ Soft386OpcodeHandlers[SOFT386_NUM_OPCODE_HANDLERS] =
     Soft386OpcodePrefix,
     Soft386OpcodePrefix,
     Soft386OpcodeHalt,
-    NULL, // TODO: OPCODE 0xF5 NOT SUPPORTED
+    Soft386OpcodeComplCarry,
     NULL, // TODO: OPCODE 0xF6 NOT SUPPORTED
     NULL, // TODO: OPCODE 0xF7 NOT SUPPORTED
     Soft386OpcodeClearCarry,
@@ -780,6 +780,25 @@ Soft386OpcodeSetCarry(PSOFT386_STATE State, UCHAR Opcode)
     return TRUE;
 }
 
+BOOLEAN
+FASTCALL
+Soft386OpcodeComplCarry(PSOFT386_STATE State, UCHAR Opcode)
+{
+    /* Make sure this is the right instruction */
+    ASSERT(Opcode == 0xF5);
+
+    /* No prefixes allowed */
+    if (State->PrefixFlags)
+    {
+        Soft386Exception(State, SOFT386_EXCEPTION_UD);
+        return FALSE;
+    }
+
+    /* Toggle CF and return success */
+    State->Flags.Cf = !State->Flags.Cf;
+    return TRUE;
+}
+
 BOOLEAN
 FASTCALL
 Soft386OpcodeClearInt(PSOFT386_STATE State, UCHAR Opcode)
index a767bcd..1cd5df4 100644 (file)
@@ -103,6 +103,14 @@ Soft386OpcodeSetCarry
     UCHAR Opcode
 );
 
+BOOLEAN
+FASTCALL
+Soft386OpcodeComplCarry
+(
+    PSOFT386_STATE State,
+    UCHAR Opcode
+);
+
 BOOLEAN
 FASTCALL
 Soft386OpcodeClearInt