- Control register 0 is CR0: use FAST486_REG_CR0 instead of 0, as it is done in the rest of the code.
- Improve a if/else if control.
- Don't halt the processor in the middle of prefixes processing.
svn path=/trunk/; revision=64851
}
/* Check for protected mode */
- if (State->ControlRegisters[0] & FAST486_CR0_PE)
+ if (State->ControlRegisters[FAST486_REG_CR0] & FAST486_CR0_PE)
{
/* Privilege checks */
}
/* Check for protected mode */
- if (State->ControlRegisters[0] & FAST486_CR0_PE)
+ if (State->ControlRegisters[FAST486_REG_CR0] & FAST486_CR0_PE)
{
/* Privilege checks */
ModRegRm->Register = (ModRmByte >> 3) & 0x07;
/* Check the mode */
- if ((ModRmByte >> 6) == 3)
+ if (Mode == 3)
{
/* The second operand is also a register */
ModRegRm->Memory = FALSE;
/* [BX + SI] */
ModRegRm->MemoryAddress = State->GeneralRegs[FAST486_REG_EBX].LowWord
+ State->GeneralRegs[FAST486_REG_ESI].LowWord;
-
break;
}
/* [BX + DI] */
ModRegRm->MemoryAddress = State->GeneralRegs[FAST486_REG_EBX].LowWord
+ State->GeneralRegs[FAST486_REG_EDI].LowWord;
-
break;
}
/* SS:[BP + SI] */
ModRegRm->MemoryAddress = State->GeneralRegs[FAST486_REG_EBP].LowWord
+ State->GeneralRegs[FAST486_REG_ESI].LowWord;
-
break;
}
/* SS:[BP + DI] */
ModRegRm->MemoryAddress = State->GeneralRegs[FAST486_REG_EBP].LowWord
+ State->GeneralRegs[FAST486_REG_EDI].LowWord;
-
break;
}
{
/* [SI] */
ModRegRm->MemoryAddress = State->GeneralRegs[FAST486_REG_ESI].LowWord;
-
break;
}
{
/* [DI] */
ModRegRm->MemoryAddress = State->GeneralRegs[FAST486_REG_EDI].LowWord;
-
break;
}
{
/* [BX] */
ModRegRm->MemoryAddress = State->GeneralRegs[FAST486_REG_EBX].LowWord;
-
break;
}
}
{
DbgPrint("\nFast486DumpState -->\n");
DbgPrint("\nCPU currently executing in %s mode at %04X:%08X\n",
- (State->ControlRegisters[0] & FAST486_CR0_PE) ? "protected" : "real",
+ (State->ControlRegisters[FAST486_REG_CR0] & FAST486_CR0_PE) ? "protected" : "real",
State->SegmentRegs[FAST486_REG_CS].Selector,
State->InstPtr.Long);
DbgPrint("\nGeneral purpose registers:\n"
/* Main execution loop */
do
{
-NextInst:
if (!State->Halted)
{
+NextInst:
/* Check if this is a new instruction */
if (State->PrefixFlags == 0) State->SavedInstPtr = State->InstPtr;
/* Additional rule for LOOPNZ */
if (State->Flags.Zf) Condition = FALSE;
}
-
- if (Opcode == 0xE1)
+ else if (Opcode == 0xE1)
{
/* Additional rule for LOOPZ */
if (!State->Flags.Zf) Condition = FALSE;