Пример #1
0
        private static void JumpOnPlusAction(
            CpuRegister r, Word operand, CpuRegisterSet registerSet, Memory memory)
        {
            FlagRegister fr        = registerSet.FR;
            Boolean      condition = (!fr.SF && !fr.ZF);

            DoJump(condition, operand, registerSet.PR);
        }
Пример #2
0
        private static void DoOperation(
            Alu.OperationMethod operationMethod, CpuRegister r, Word operand, FlagRegister fr, Memory memory)
        {
            Boolean overflowFlag;

            r.Value = operationMethod(r.Value, operand, out overflowFlag);
            fr.SetFlags(r, overflowFlag);
        }
Пример #3
0
        /// <summary>
        /// <see cref="CpuRegisterSet"/> のインスタンスを初期化します。
        /// </summary>
        internal CpuRegisterSet()
        {
            m_generalRegisters = new GeneralRegisters();
            m_stackPointer     = new CpuRegister(RegisterDef.SP);
            m_programRegister  = new CpuRegister(RegisterDef.PR);
            m_flagRegister     = new FlagRegister();

            Reset();
        }
Пример #4
0
        private static void DoShift(
            Alu.ShiftMethod shiftMethod, CpuRegister r, Word operand, FlagRegister fr)
        {
            UInt16 lastShiftedOutBit;

            r.Value = shiftMethod(r.Value, operand, out lastShiftedOutBit);
            Boolean overflowFlag = (lastShiftedOutBit != 0);

            fr.SetFlags(r, overflowFlag);
        }
Пример #5
0
        private static void DoCompare(
            Alu.CompareMethod compareMethod, CpuRegister r, Word operand, FlagRegister fr)
        {
            Boolean signFlag;
            Boolean zeroFlag;

            compareMethod(r.Value, operand, out signFlag, out zeroFlag);
            const Boolean OverflowFlag = false;

            fr.SetFlags(OverflowFlag, signFlag, zeroFlag);
        }
Пример #6
0
        private static void DoLogic(
            Alu.OperationMethod operationMethod, CpuRegister r, Word operand, FlagRegister fr, Memory memory)
        {
            Boolean notUsed;

            r.Value = operationMethod(r.Value, operand, out notUsed);

            const Boolean OverflowFlag = false;

            fr.SetFlags(r, OverflowFlag);
        }