mirror of
https://github.com/MoleskiCoder/EightBitNet.git
synced 2024-12-23 17:31:33 +00:00
0c69c5d8bb
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
47 lines
1.1 KiB
C#
47 lines
1.1 KiB
C#
namespace EightBit
|
|
{
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
|
|
// https://github.com/sorenroug/osnine-java/blob/master/core/src/test/java/org/roug/osnine/BranchAndJumpTest.java
|
|
|
|
[TestClass]
|
|
public class RtsTests
|
|
{
|
|
private readonly Board board = new Board();
|
|
private readonly MC6809 cpu;
|
|
|
|
public RtsTests()
|
|
{
|
|
this.cpu = this.board.CPU;
|
|
|
|
this.board.Poke(0, 0x3a);
|
|
}
|
|
|
|
[TestInitialize]
|
|
public void Initialise()
|
|
{
|
|
this.board.RaisePOWER();
|
|
this.cpu.Step(); // Step over the reset
|
|
}
|
|
|
|
[TestCleanup]
|
|
public void Cleanup() => this.board.LowerPOWER();
|
|
|
|
[TestMethod]
|
|
public void TestRts()
|
|
{
|
|
this.cpu.S.Word = 0x300;
|
|
|
|
this.cpu.PokeWord(0x300, 0x102C); // Write return address
|
|
this.board.Poke(0xB00, 0x39); // RTS
|
|
|
|
this.cpu.PC.Word = 0xB00;
|
|
|
|
this.cpu.Step();
|
|
|
|
Assert.AreEqual(0x102C, this.cpu.PC.Word);
|
|
Assert.AreEqual(0x302, this.cpu.S.Word);
|
|
Assert.AreEqual(5, this.cpu.Cycles);
|
|
}
|
|
}
|
|
} |