From 7ecbd634712bcd135594a6fa8da67d11bb425385 Mon Sep 17 00:00:00 2001 From: Aleksandar Andrejevic Date: Thu, 29 Aug 2013 22:18:28 +0000 Subject: [PATCH] [SOFT386] Implement CMC instruction. svn path=/branches/ntvdm/; revision=59892 --- lib/soft386/opcodes.c | 21 ++++++++++++++++++++- lib/soft386/opcodes.h | 8 ++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/lib/soft386/opcodes.c b/lib/soft386/opcodes.c index d104ce78125..c74dc359e04 100644 --- a/lib/soft386/opcodes.c +++ b/lib/soft386/opcodes.c @@ -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) diff --git a/lib/soft386/opcodes.h b/lib/soft386/opcodes.h index a767bcd17f0..1cd5df47567 100644 --- a/lib/soft386/opcodes.h +++ b/lib/soft386/opcodes.h @@ -103,6 +103,14 @@ Soft386OpcodeSetCarry UCHAR Opcode ); +BOOLEAN +FASTCALL +Soft386OpcodeComplCarry +( + PSOFT386_STATE State, + UCHAR Opcode +); + BOOLEAN FASTCALL Soft386OpcodeClearInt