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::BasicUnaryArithmetic(const Instruction & instruction,
    std::function<UInt16(UInt16)> ins)
{
    UInt16 val = mCPU.DumpRegister(instruction.GetSecondOperand());

    mErrorCode = mCPU.SetRegister(instruction.GetFirstOperand(), ins(val));
    mCPU.SetSignZeroFlag(mCPU.DumpRegister(instruction.GetFirstOperand()));
}
Esempio n. 3
0
void Interpreter::IndirectLDM(const Instruction & instruction)
{
    UInt8 addrX = instruction.GetFirstOperand();
    UInt8 addrY = instruction.GetSecondOperand();
    UInt16 val;
    mErrorCode = mCPU.Load(mCPU.DumpRegister(addrY), val);
    mErrorCode = mCPU.SetRegister(addrX, val);
}
Esempio n. 4
0
void Interpreter::DiscardBinaryArithmetic(const Instruction & instruction,
                                    std::function<UInt16(UInt16,UInt16)> ins, 
                                    std::function<void(UInt16,UInt16)> frh)
{
    UInt16 xVal = mCPU.DumpRegister(instruction.GetFirstOperand());
    UInt16 yVal = mCPU.DumpRegister(instruction.GetSecondOperand());
    
    if (frh)
        frh(xVal, yVal);

    UInt16 result = ins(xVal, yVal);
    mCPU.SetSignZeroFlag(result);
}
Esempio n. 5
0
void Interpreter::InplaceBinaryArithmetic(const Instruction & instruction,
                                    std::function<UInt16(UInt16,UInt16)> ins, 
                                    std::function<void(UInt16,UInt16)> frh)
{
    UInt8 xReg = instruction.GetFirstOperand();
    UInt16 xVal = mCPU.DumpRegister(xReg);
    UInt16 yVal = mCPU.DumpRegister(instruction.GetSecondOperand());
    
    if (frh)
        frh(xVal, yVal);

    mErrorCode = mCPU.SetRegister(xReg, ins(xVal, yVal));
    mCPU.SetSignZeroFlag(mCPU.DumpRegister(xReg));
}
Esempio n. 6
0
void Interpreter::IndirectSTM(const Instruction & instruction)
{
    UInt16 xVal = mCPU.DumpRegister(instruction.GetFirstOperand());
    UInt16 yVal = mCPU.DumpRegister(instruction.GetSecondOperand());
    mErrorCode = mCPU.Store(yVal, xVal);
}
Esempio n. 7
0
void Interpreter::RegisterSAR(const Instruction & instruction)
{
    UInt8 addr = instruction.GetFirstOperand();
    mErrorCode = mCPU.SetRegister(addr, ArithmeticRightShift()(mCPU.DumpRegister(addr), mCPU.DumpRegister(instruction.GetSecondOperand())));
    mCPU.SetSignZeroFlag(mCPU.DumpRegister(addr));
}
Esempio n. 8
0
void Interpreter::MOV(const Instruction & instruction)
{
    UInt8 addrX = instruction.GetFirstOperand();
    UInt16 yVal = mCPU.DumpRegister(instruction.GetSecondOperand()); 
    mErrorCode = mCPU.SetRegister(addrX, yVal);
}