From 9296eaf9549faac2b8f8b8f7dc25153535f3dc06 Mon Sep 17 00:00:00 2001 From: Adrian Conlon Date: Sun, 7 Oct 2018 10:55:30 +0100 Subject: [PATCH] Add test for BITA immediate. Signed-off-by: Adrian Conlon --- MC6809/unittest/mc6809_tests.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/MC6809/unittest/mc6809_tests.cpp b/MC6809/unittest/mc6809_tests.cpp index 1567507..bb2cbb5 100644 --- a/MC6809/unittest/mc6809_tests.cpp +++ b/MC6809/unittest/mc6809_tests.cpp @@ -123,3 +123,22 @@ TEST_CASE("Shift Accumulator or Memory Byte Right", "[ASR][ASRA]") { REQUIRE(cpu.cycles() == 2); } } + +TEST_CASE("Bit Test", "[BIT][BITA]") { + + Board board; + board.initialise(); + auto& cpu = board.CPU(); + cpu.step(); // Step over the reset + + SECTION("Immediate (byte)") { + board.poke(0, 0x85); + board.poke(1, 0xe0); + cpu.A() = 0xa6; + cpu.step(); + REQUIRE(cpu.A() == 0xa6); + REQUIRE((cpu.CC() & EightBit::mc6809::ZF) == 0); + REQUIRE((cpu.CC() & EightBit::mc6809::NF) != 0); + REQUIRE(cpu.cycles() == 2); + } +}