示例#1
0
void Interpreter::JME(const Instruction & instruction)
{
    UInt16 xVal = mCPU.DumpRegister(instruction.GetFirstOperand());
    UInt16 yVal = mCPU.DumpRegister(instruction.GetSecondOperand());
    if(xVal == yVal)
        mErrorCode = mCPU.SetProgramCounter(instruction.GetImmediateValue());
}
示例#2
0
void Interpreter::DirectLDM(const Instruction & instruction)
{
    UInt8 addr = instruction.GetFirstOperand();
    UInt16 iVal = instruction.GetImmediateValue();
    UInt16 val;
    mErrorCode = mCPU.Load(iVal, val);
    mErrorCode |= mCPU.SetRegister(addr, val);
}
示例#3
0
void Interpreter::ImmediateUnaryArithmetic(const Instruction & instruction,
    std::function<UInt16(UInt16)> ins)
{
    UInt8 reg = instruction.GetFirstOperand();
    UInt16 iVal = instruction.GetImmediateValue();

    mErrorCode = mCPU.SetRegister(reg, ins(iVal));
    mCPU.SetSignZeroFlag(mCPU.DumpRegister(reg));
}
示例#4
0
void Interpreter::RND(const Instruction & instruction)
{
    UInt8 addr = instruction.GetFirstOperand();
    UInt16 maxVal = instruction.GetImmediateValue();
    UInt16 randVal = mDist(mRandEngine);
    while(randVal > maxVal)
        randVal= mDist(mRandEngine);
    mErrorCode = mCPU.SetRegister(addr, randVal);
}
示例#5
0
void Interpreter::Cx(const Instruction & instruction)
{
    UInt8 condCode = instruction.GetFirstOperand();
    if(InterpretConditions(condCode))
    {
        mErrorCode = mCPU.PushPC();
        mErrorCode |= mCPU.SetProgramCounter(instruction.GetImmediateValue());
    }
}
示例#6
0
void Interpreter::DiscardImmediateBinaryArithmetic(const Instruction & instruction,
                                             std::function<UInt16(UInt16,UInt16)> ins, 
                                             std::function<void(UInt16,UInt16)> frh)
{
    UInt16 xVal = mCPU.DumpRegister(instruction.GetFirstOperand());
    UInt16 iVal = instruction.GetImmediateValue();

    if (frh)
        frh(xVal, iVal);

    UInt16 result = ins(xVal, iVal);
    mCPU.SetSignZeroFlag(result);
}
示例#7
0
void Interpreter::DirectSTM(const Instruction & instruction)
{
    UInt8 regAddr = instruction.GetFirstOperand();
    UInt16 memAddr = instruction.GetImmediateValue();
    mErrorCode = mCPU.Store(memAddr, mCPU.DumpRegister(regAddr));
}
示例#8
0
void Interpreter::StackLDI(const Instruction & instruction)
{
    mErrorCode = mCPU.SetStackPointer(instruction.GetImmediateValue());
}
示例#9
0
void Interpreter::RegisterLDI(const Instruction & instruction)
{
    mErrorCode = mCPU.SetRegister(instruction.GetFirstOperand(), instruction.GetImmediateValue());
}
示例#10
0
void Interpreter::DirectCALL(const Instruction & instruction)
{
    mErrorCode = mCPU.PushPC();
    mErrorCode |= mCPU.SetProgramCounter(instruction.GetImmediateValue());
}
示例#11
0
void Interpreter::Jx(const Instruction & instruction)
{
    UInt8 condCode = instruction.GetFirstOperand();
    if(InterpretConditions(condCode))
        mCPU.SetProgramCounter(instruction.GetImmediateValue());
}
示例#12
0
void Interpreter::JMC(const Instruction & instruction)
{
    if (mCPU.DumpFlagRegister() & CPU::UNSIGNED_CARRY_FLAG)
        mErrorCode = mCPU.SetProgramCounter(instruction.GetImmediateValue());
}
示例#13
0
void Interpreter::DirectJMP(const Instruction & instruction)
{
    mErrorCode = mCPU.SetProgramCounter(instruction.GetImmediateValue());
}