[SOFT386]
authorAleksandar Andrejevic <aandrejevic@reactos.org>
Tue, 1 Oct 2013 15:02:07 +0000 (15:02 +0000)
committerAleksandar Andrejevic <aandrejevic@reactos.org>
Tue, 1 Oct 2013 15:02:07 +0000 (15:02 +0000)
Implement the (undocumented) opcode SALC.

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

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

index e325133..f78dce8 100644 (file)
@@ -253,7 +253,7 @@ Soft386OpcodeHandlers[SOFT386_NUM_OPCODE_HANDLERS] =
     Soft386OpcodeGroupD3,
     Soft386OpcodeAam,
     Soft386OpcodeAad,
-    NULL, // TODO: OPCODE 0xD6 NOT SUPPORTED
+    Soft386OpcodeSalc,
     Soft386OpcodeXlat,
     NULL, // TODO: OPCODE 0xD8 NOT SUPPORTED
     NULL, // TODO: OPCODE 0xD9 NOT SUPPORTED
@@ -5588,3 +5588,21 @@ SOFT386_OPCODE_HANDLER(Soft386OpcodeMovOffsetEax)
                                   sizeof(USHORT));
     }
 }
+
+SOFT386_OPCODE_HANDLER(Soft386OpcodeSalc)
+{
+    /* Make sure this is the right instruction */
+    ASSERT(Opcode == 0xD6);
+
+    if (State->PrefixFlags & SOFT386_PREFIX_LOCK)
+    {
+        /* Invalid prefix */
+        Soft386Exception(State, SOFT386_EXCEPTION_UD);
+        return FALSE;
+    }
+
+    /* Set all the bits of AL to CF */
+    State->GeneralRegs[SOFT386_REG_EAX].LowByte = State->Flags.Cf ? 0xFF : 0x00;
+
+    return TRUE;
+}
index 02d260f..eb0398b 100644 (file)
@@ -147,5 +147,6 @@ SOFT386_OPCODE_HANDLER(Soft386OpcodeMovAlOffset);
 SOFT386_OPCODE_HANDLER(Soft386OpcodeMovEaxOffset);
 SOFT386_OPCODE_HANDLER(Soft386OpcodeMovOffsetAl);
 SOFT386_OPCODE_HANDLER(Soft386OpcodeMovOffsetEax);
+SOFT386_OPCODE_HANDLER(Soft386OpcodeSalc);
 
 #endif // _OPCODES_H_