private void CheckFetch(UInt16 expectedContents, UInt16 expectedPr, String message) { Word word = Fetcher.Fetch(m_pr, m_memory); WordTest.Check(word, expectedContents, "Contents: " + message); CpuRegisterTest.Check(m_pr, expectedPr, "PR: " + message); }
private void CheckJump( CpuInstruction instruction, Boolean overflowFlag, Boolean signFlag, Boolean zeroFlag, Boolean jump, String message) { m_registerSet.FR.SetFlags(overflowFlag, signFlag, zeroFlag); ExecuteEaContentsInstruction(instruction, DontCareUInt16, DontCareUInt16); UInt16 expected = jump ? EffectiveAddress : NextAddressPlusOne; CpuRegisterTest.Check(m_registerSet.PR, 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 Pop() { const UInt16 PopValue = 0xbcde; SP.Value = SpValue; m_memory.Write(SpValue, PopValue); ExecuteRegisterInstruction(CpuInstruction.Pop, DontCareUInt16, DontCareUInt16); CpuRegisterTest.Check( m_registerSet.GR[R1], PopValue, "SP の指すアドレスの値がレジスタに読み込まれる"); CpuRegisterTest.Check( SP, SpValuePlusOne, "SP の値が 1 増える"); }
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 にオペランドの値が設定される"); }
public void ReturnFromSubroutine_Cancel() { const UInt16 PrValue = 0xcdef; PR.Value = PrValue; SP.Value = SpValue; m_cancelRet = true; Operate(Operator.ReturnFromSubroutine, DontCareUInt16, DontCareUInt16); CpuRegisterTest.Check(PR, PrValue, "PR の値はそのまま"); CpuRegisterTest.Check(SP, SpValue, "SP の値はそのまま"); String expectedLog = TestLogger.ExpectedLog("OnReturningFromSubroutine: 'SP: 9320 (0x2468)'"); String actualLog = m_logger.Log; Assert.AreEqual(expectedLog, actualLog, "ReturningFromSubroutine イベントが発生する"); }
public void ReturnFromSubroutine_NotCancel() { const UInt16 MemValue = 0xace0; SP.Value = SpValue; m_memory.Write(SpValue, MemValue); m_cancelRet = false; Operate(Operator.ReturnFromSubroutine, DontCareUInt16, DontCareUInt16); CpuRegisterTest.Check(PR, MemValue, "PR に SP の指すアドレスの値が設定される"); CpuRegisterTest.Check(SP, SpValuePlusOne, "SP の値が 1 増える"); String expectedLog = TestLogger.ExpectedLog("OnReturningFromSubroutine: 'SP: 9320 (0x2468)'"); String actualLog = m_logger.Log; Assert.AreEqual(expectedLog, actualLog, "ReturningFromSubroutine イベントが発生する"); }
public void ReturnFromSubroutine() { const UInt16 MemValue = 0x9876; SP.Value = SpValue; m_memory.Write(SpValue, MemValue); ExecuteRegisterInstruction(CpuInstruction.ReturnFromSubroutine, DontCareUInt16, DontCareUInt16); CpuRegisterTest.Check( PR, MemValue, "SP の指すアドレスの値が PR に読み込まれる"); CpuRegisterTest.Check( SP, SpValuePlusOne, "SP の値が 1 増える"); String expectedLog = TestLogger.ExpectedLog("OnReturningFromSubroutine: 'SP: 30874 (0x789a)'"); String actualLog = m_logger.Log; Assert.AreEqual(expectedLog, actualLog, "ReturningFromSubroutine イベントが発生する"); }
private void CheckRegisterRegister( CpuInstruction instruction, UInt16 reg1Value, UInt16 reg2Value, UInt16 expected, String message) { ExecuteRegisterInstruction(instruction, reg1Value, reg2Value); CpuRegisterTest.Check(m_registerSet.GR[R1], expected, message); }
private void CheckEaContentsRegister( CpuInstruction instruction, UInt16 regValue, UInt16 eaContents, UInt16 expected, String message) { ExecuteEaContentsInstruction(instruction, regValue, eaContents); CpuRegisterTest.Check(m_registerSet.GR[R], expected, message); }
private void CheckRegister(CpuRegister reg, UInt16 expected, String message) { CpuRegisterTest.Check(reg, expected, message); }