[SOFT386]

Implement opcode groups 0xC6 and 0xC7.


svn path=/branches/ntvdm/; revision=60452
This commit is contained in:
Aleksandar Andrejevic 2013-09-29 16:01:10 +00:00
parent 87a7896249
commit f7a2f36dd0

View file

@ -243,14 +243,106 @@ SOFT386_OPCODE_HANDLER(Soft386OpcodeGroupC1)
SOFT386_OPCODE_HANDLER(Soft386OpcodeGroupC6)
{
UNIMPLEMENTED;
return FALSE; // TODO: NOT IMPLEMENTED
UCHAR Immediate;
SOFT386_MOD_REG_RM ModRegRm;
BOOLEAN AddressSize = State->SegmentRegs[SOFT386_REG_CS].Size;
if (State->PrefixFlags & SOFT386_PREFIX_ADSIZE)
{
/* The ADSIZE prefix toggles the size */
AddressSize = !AddressSize;
}
if (!Soft386ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
return FALSE;
}
if (ModRegRm.Register != 0)
{
/* Invalid */
Soft386Exception(State, SOFT386_EXCEPTION_UD);
return FALSE;
}
/* Get the immediate operand */
if (!Soft386FetchByte(State, &Immediate))
{
/* Exception occurred */
return FALSE;
}
return Soft386WriteModrmByteOperands(State,
&ModRegRm,
FALSE,
Immediate);
}
SOFT386_OPCODE_HANDLER(Soft386OpcodeGroupC7)
{
UNIMPLEMENTED;
return FALSE; // TODO: NOT IMPLEMENTED
SOFT386_MOD_REG_RM ModRegRm;
BOOLEAN OperandSize, AddressSize;
OperandSize = AddressSize = State->SegmentRegs[SOFT386_REG_CS].Size;
if (State->PrefixFlags & SOFT386_PREFIX_OPSIZE)
{
/* The OPSIZE prefix toggles the size */
OperandSize = !OperandSize;
}
if (State->PrefixFlags & SOFT386_PREFIX_ADSIZE)
{
/* The ADSIZE prefix toggles the size */
AddressSize = !AddressSize;
}
if (!Soft386ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
return FALSE;
}
if (ModRegRm.Register != 0)
{
/* Invalid */
Soft386Exception(State, SOFT386_EXCEPTION_UD);
return FALSE;
}
if (OperandSize)
{
ULONG Immediate;
/* Get the immediate operand */
if (!Soft386FetchDword(State, &Immediate))
{
/* Exception occurred */
return FALSE;
}
return Soft386WriteModrmDwordOperands(State,
&ModRegRm,
FALSE,
Immediate);
}
else
{
USHORT Immediate;
/* Get the immediate operand */
if (!Soft386FetchWord(State, &Immediate))
{
/* Exception occurred */
return FALSE;
}
return Soft386WriteModrmWordOperands(State,
&ModRegRm,
FALSE,
Immediate);
}
}
SOFT386_OPCODE_HANDLER(Soft386OpcodeGroupD0)