Esempio n. 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());
}
Esempio n. 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);
}
Esempio n. 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));
}
Esempio n. 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);
}
Esempio n. 5
0
void Interpreter::Cx(const Instruction & instruction)
{
    UInt8 condCode = instruction.GetFirstOperand();
    if(InterpretConditions(condCode))
    {
        mErrorCode = mCPU.PushPC();
        mErrorCode |= mCPU.SetProgramCounter(instruction.GetImmediateValue());
    }
}
Esempio n. 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);
}
Esempio n. 7
0
void Interpreter::DirectSTM(const Instruction & instruction)
{
    UInt8 regAddr = instruction.GetFirstOperand();
    UInt16 memAddr = instruction.GetImmediateValue();
    mErrorCode = mCPU.Store(memAddr, mCPU.DumpRegister(regAddr));
}
Esempio n. 8
0
void Interpreter::StackLDI(const Instruction & instruction)
{
    mErrorCode = mCPU.SetStackPointer(instruction.GetImmediateValue());
}
Esempio n. 9
0
void Interpreter::RegisterLDI(const Instruction & instruction)
{
    mErrorCode = mCPU.SetRegister(instruction.GetFirstOperand(), instruction.GetImmediateValue());
}
Esempio n. 10
0
void Interpreter::DirectCALL(const Instruction & instruction)
{
    mErrorCode = mCPU.PushPC();
    mErrorCode |= mCPU.SetProgramCounter(instruction.GetImmediateValue());
}
Esempio n. 11
0
void Interpreter::Jx(const Instruction & instruction)
{
    UInt8 condCode = instruction.GetFirstOperand();
    if(InterpretConditions(condCode))
        mCPU.SetProgramCounter(instruction.GetImmediateValue());
}
Esempio n. 12
0
void Interpreter::JMC(const Instruction & instruction)
{
    if (mCPU.DumpFlagRegister() & CPU::UNSIGNED_CARRY_FLAG)
        mErrorCode = mCPU.SetProgramCounter(instruction.GetImmediateValue());
}
Esempio n. 13
0
void Interpreter::DirectJMP(const Instruction & instruction)
{
    mErrorCode = mCPU.SetProgramCounter(instruction.GetImmediateValue());
}