Author: aandrejevic Date: Sun Sep 1 17:54:51 2013 New Revision: 59952
URL: http://svn.reactos.org/svn/reactos?rev=59952&view=rev Log: [SOFT386] Implement the "MOV reg8, imm8" instruction.
Modified: branches/ntvdm/lib/soft386/opcodes.c branches/ntvdm/lib/soft386/opcodes.h
Modified: branches/ntvdm/lib/soft386/opcodes.c URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/lib/soft386/opcodes.c?rev=... ============================================================================== --- branches/ntvdm/lib/soft386/opcodes.c [iso-8859-1] (original) +++ branches/ntvdm/lib/soft386/opcodes.c [iso-8859-1] Sun Sep 1 17:54:51 2013 @@ -200,14 +200,14 @@ NULL, // TODO: OPCODE 0xAD NOT SUPPORTED NULL, // TODO: OPCODE 0xAE NOT SUPPORTED NULL, // TODO: OPCODE 0xAF NOT SUPPORTED - NULL, // TODO: OPCODE 0xB0 NOT SUPPORTED - NULL, // TODO: OPCODE 0xB1 NOT SUPPORTED - NULL, // TODO: OPCODE 0xB2 NOT SUPPORTED - NULL, // TODO: OPCODE 0xB3 NOT SUPPORTED - NULL, // TODO: OPCODE 0xB4 NOT SUPPORTED - NULL, // TODO: OPCODE 0xB5 NOT SUPPORTED - NULL, // TODO: OPCODE 0xB6 NOT SUPPORTED - NULL, // TODO: OPCODE 0xB7 NOT SUPPORTED + Soft386OpcodeMovByteRegImm, + Soft386OpcodeMovByteRegImm, + Soft386OpcodeMovByteRegImm, + Soft386OpcodeMovByteRegImm, + Soft386OpcodeMovByteRegImm, + Soft386OpcodeMovByteRegImm, + Soft386OpcodeMovByteRegImm, + Soft386OpcodeMovByteRegImm, Soft386OpcodeMovRegImm, Soft386OpcodeMovRegImm, Soft386OpcodeMovRegImm, @@ -1221,3 +1221,40 @@
return TRUE; } + +BOOLEAN +FASTCALL +Soft386OpcodeMovByteRegImm(PSOFT386_STATE State, UCHAR Opcode) +{ + UCHAR Value; + + /* Make sure this is the right instruction */ + ASSERT((Opcode & 0xF8) == 0xB0); + + if (State->PrefixFlags != 0) + { + /* Invalid prefix */ + Soft386Exception(State, SOFT386_EXCEPTION_UD); + return FALSE; + } + + /* Fetch the byte */ + if (!Soft386FetchByte(State, &Value)) + { + /* Exception occurred */ + return FALSE; + } + + if (Opcode & 0x04) + { + /* AH, CH, DH or BH */ + State->GeneralRegs[Opcode & 0x03].HighByte = Value; + } + else + { + /* AL, CL, DL or BL */ + State->GeneralRegs[Opcode & 0x03].LowByte = Value; + } + + return TRUE; +}
Modified: branches/ntvdm/lib/soft386/opcodes.h URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/lib/soft386/opcodes.h?rev=... ============================================================================== --- branches/ntvdm/lib/soft386/opcodes.h [iso-8859-1] (original) +++ branches/ntvdm/lib/soft386/opcodes.h [iso-8859-1] Sun Sep 1 17:54:51 2013 @@ -199,4 +199,12 @@ UCHAR Opcode );
+BOOLEAN +FASTCALL +Soft386OpcodeMovByteRegImm +( + PSOFT386_STATE State, + UCHAR Opcode +); + #endif // _OPCODES_H_