Beispiel #1
0
void Interpreter::BasicBinaryArithmetic(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);
    
    UInt8 zReg = instruction.GetThirdOperand();
    mErrorCode = mCPU.SetRegister(zReg, ins(xVal, yVal));
    mCPU.SetSignZeroFlag(mCPU.DumpRegister(zReg));
}
Beispiel #2
0
void Interpreter::NSAR(const Instruction & instruction)
{
    UInt8 addr = instruction.GetFirstOperand();
    mErrorCode = mCPU.SetRegister(addr, ArithmeticRightShift()(mCPU.DumpRegister(addr), instruction.GetThirdOperand()));
    mCPU.SetSignZeroFlag(mCPU.DumpRegister(addr));
}