From 7719c8e875704d5eb01f7b954f4e20d69af6b16f Mon Sep 17 00:00:00 2001 From: Adrian Conlon Date: Sun, 7 Oct 2018 10:08:12 +0100 Subject: [PATCH] Add test for ANDA immediate Signed-off-by: Adrian Conlon --- MC6809/unittest/mc6809_tests.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/MC6809/unittest/mc6809_tests.cpp b/MC6809/unittest/mc6809_tests.cpp index 13f6813..dd5c8e1 100644 --- a/MC6809/unittest/mc6809_tests.cpp +++ b/MC6809/unittest/mc6809_tests.cpp @@ -54,7 +54,6 @@ TEST_CASE("Add Memory to Accumulator A", "[ADD][ADDA]") { SECTION("Immediate (byte)") { board.poke(0, 0x8b); board.poke(1, 0x8b); - EightBit::Chip::setFlag(cpu.CC(), EightBit::mc6809::CF); cpu.A() = 0x24; cpu.step(); REQUIRE(cpu.A() == 0xaf); @@ -66,3 +65,23 @@ TEST_CASE("Add Memory to Accumulator A", "[ADD][ADDA]") { REQUIRE(cpu.cycles() == 2); } } + +TEST_CASE("Logical AND Accumulator", "[AND][ANDA]") { + + Board board; + board.initialise(); + auto& cpu = board.CPU(); + cpu.step(); // Step over the reset + + SECTION("Immediate (byte)") { + board.poke(0, 0x84); + board.poke(1, 0x13); + cpu.A() = 0xfc; + cpu.step(); + REQUIRE(cpu.A() == 0x10); + REQUIRE((cpu.CC() & EightBit::mc6809::ZF) == 0); + REQUIRE((cpu.CC() & EightBit::mc6809::VF) == 0); + REQUIRE((cpu.CC() & EightBit::mc6809::NF) == 0); + REQUIRE(cpu.cycles() == 2); + } +}