From 9445e7d1c422786717050e9064302555a03db1f1 Mon Sep 17 00:00:00 2001 From: Adrian Conlon Date: Sun, 7 Oct 2018 11:04:22 +0100 Subject: [PATCH] Add test for CLRA implied Signed-off-by: Adrian Conlon --- MC6809/unittest/mc6809_tests.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/MC6809/unittest/mc6809_tests.cpp b/MC6809/unittest/mc6809_tests.cpp index bb2cbb5..869a77a 100644 --- a/MC6809/unittest/mc6809_tests.cpp +++ b/MC6809/unittest/mc6809_tests.cpp @@ -142,3 +142,23 @@ TEST_CASE("Bit Test", "[BIT][BITA]") { REQUIRE(cpu.cycles() == 2); } } + +TEST_CASE("Clear Accumulator or Memory", "[CLR][CLRA]") { + + Board board; + board.initialise(); + auto& cpu = board.CPU(); + cpu.step(); // Step over the reset + + SECTION("Implied") { + board.poke(0, 0x4f); + cpu.A() = 0x43; + cpu.step(); + REQUIRE(cpu.A() == 0x00); + REQUIRE((cpu.CC() & EightBit::mc6809::CF) == 0); + REQUIRE((cpu.CC() & EightBit::mc6809::ZF) != 0); + REQUIRE((cpu.CC() & EightBit::mc6809::NF) == 0); + REQUIRE((cpu.CC() & EightBit::mc6809::VF) == 0); + REQUIRE(cpu.cycles() == 2); + } +}