private void CheckEaContentsMemory(
     CpuInstruction instruction, UInt16 regValue, UInt16 eaContents, UInt16 address,
     UInt16 expected, String message)
 {
     ExecuteEaContentsInstruction(instruction, regValue, eaContents);
     MemoryTest.Check(m_memory, address, expected, message);
 }
        public void CallSubroutine()
        {
            SP.Value = SpValue;
            ExecuteEaContentsInstruction(CpuInstruction.CallSubroutine, DontCareUInt16, DontCareUInt16);

            CpuRegisterTest.Check(
                SP, SpValueMinusOne, "SP の値が 1 減る");
            MemoryTest.Check(
                m_memory, SpValueMinusOne, NextAddressPlusOne,   "SP の指すアドレスに PR の値を書き込む");
            CpuRegisterTest.Check(
                PR, EffectiveAddress, "PR に実効アドレスの値が設定される");
        }
        public void Push()
        {
            SP.Value = SpValue;

            ExecuteEaContentsInstruction(CpuInstruction.Push, DontCareUInt16, DontCareUInt16);

            CpuRegisterTest.Check(
                SP, SpValueMinusOne, "SP の値が 1 減る");
            MemoryTest.Check(
                m_memory, SpValueMinusOne, EffectiveAddress,
                "SP の指すアドレスに実効アドレスの値を書き込む");
        }
        public void CallSubroutine()
        {
            const UInt16 PrValue  = 0x1357;
            const UInt16 OprValue = 0x9bdf;

            SP.Value = SpValue;
            PR.Value = PrValue;

            Operate(Operator.CallSubroutine, DontCareUInt16, OprValue);

            CpuRegisterTest.Check(SP, SpValueMinusOne, "SP の値が 1 減る");
            MemoryTest.Check(m_memory, SpValueMinusOne, PrValue, "(SP - 1) に PR の値が書き込まれる");
            CpuRegisterTest.Check(PR, OprValue, "PR にオペランドの値が設定される");
        }
 private void CheckMemory(UInt16 address, UInt16 expected, String message)
 {
     MemoryTest.Check(m_memory, address, expected, message);
 }