2019-05-06 11:02:20 +01:00
|
|
|
|
// <copyright file="BhiTests.cs" company="Adrian Conlon">
|
|
|
|
|
// Copyright (c) Adrian Conlon. All rights reserved.
|
|
|
|
|
// </copyright>
|
|
|
|
|
|
|
|
|
|
namespace EightBit
|
2019-04-21 04:47:36 +01:00
|
|
|
|
{
|
|
|
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
|
|
|
|
|
|
|
|
[TestClass]
|
|
|
|
|
public class BhiTests
|
|
|
|
|
{
|
|
|
|
|
private readonly Board board = new Board();
|
2019-04-21 16:51:08 +01:00
|
|
|
|
private readonly MC6809 cpu;
|
2019-04-21 04:47:36 +01:00
|
|
|
|
|
|
|
|
|
public BhiTests()
|
|
|
|
|
{
|
|
|
|
|
this.cpu = this.board.CPU;
|
|
|
|
|
|
|
|
|
|
this.board.Poke(0, 0x22); // BHI
|
|
|
|
|
this.board.Poke(1, 0x03);
|
2019-05-06 11:02:20 +01:00
|
|
|
|
this.board.Poke(2, 0x86); // LDA #1
|
2019-04-21 04:47:36 +01:00
|
|
|
|
this.board.Poke(3, 0x01);
|
|
|
|
|
this.board.Poke(4, 0x12); // NOP
|
2019-05-06 11:02:20 +01:00
|
|
|
|
this.board.Poke(5, 0x86); // LDA #2
|
2019-04-21 04:47:36 +01:00
|
|
|
|
this.board.Poke(6, 0x02);
|
2019-05-06 11:02:20 +01:00
|
|
|
|
this.board.Poke(7, 0x12); // NOP
|
2019-04-21 04:47:36 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestInitialize]
|
|
|
|
|
public void Initialise()
|
|
|
|
|
{
|
|
|
|
|
this.board.RaisePOWER();
|
|
|
|
|
this.cpu.Step();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestCleanup]
|
|
|
|
|
public void Cleanup() => this.board.LowerPOWER();
|
|
|
|
|
|
|
|
|
|
[TestMethod]
|
|
|
|
|
public void TestBHI1()
|
|
|
|
|
{
|
|
|
|
|
this.cpu.A = 0;
|
|
|
|
|
this.cpu.CC = (byte)StatusBits.ZF;
|
|
|
|
|
this.cpu.Step();
|
|
|
|
|
this.cpu.Step();
|
|
|
|
|
Assert.AreEqual(1, this.cpu.A);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|