diff --git a/M6502/HarteTest_6502/TestRunner.cpp b/M6502/HarteTest_6502/TestRunner.cpp index 6f5555f..e625c0b 100644 --- a/M6502/HarteTest_6502/TestRunner.cpp +++ b/M6502/HarteTest_6502/TestRunner.cpp @@ -1,8 +1,6 @@ #include "stdafx.h" #include "TestRunner.h" -#include - TestRunner::TestRunner(const test_t& test) : m_test(test) {} @@ -176,6 +174,7 @@ bool TestRunner::check() { initialise(); raisePOWER(); initialiseState(); + const auto pc = CPU().PC(); const int cycles = CPU().step(); const auto valid = checkState(); if (m_cycle_count_mismatch) { @@ -183,6 +182,14 @@ bool TestRunner::check() { m_messages.push_back("Unimplemented"); } else { + try { + os() << m_disassembler.disassemble(pc.word); + } catch (const std::domain_error& error) { + os() << "Disassembly problem: " << error.what(); + } + m_messages.push_back(os().str()); + os().str(""); + os() << std::dec << std::setfill(' ') << "Stepped cycles: " << cycles diff --git a/M6502/HarteTest_6502/TestRunner.h b/M6502/HarteTest_6502/TestRunner.h index 22db8f0..4d794a4 100644 --- a/M6502/HarteTest_6502/TestRunner.h +++ b/M6502/HarteTest_6502/TestRunner.h @@ -8,6 +8,8 @@ #include #include #include +#include +#include #include "test_t.h" @@ -15,6 +17,9 @@ class TestRunner final : public EightBit::Bus { private: EightBit::Ram m_ram = 0x10000; EightBit::MOS6502 m_cpu = { *this }; + EightBit::Symbols m_symbols; + EightBit::Disassembly m_disassembler = { *this, m_cpu, m_symbols }; + const test_t& m_test; std::ostringstream m_os; diff --git a/M6502/HarteTest_6502/tests.cpp b/M6502/HarteTest_6502/tests.cpp index 014a5d7..085da1d 100644 --- a/M6502/HarteTest_6502/tests.cpp +++ b/M6502/HarteTest_6502/tests.cpp @@ -14,6 +14,7 @@ int main() { const auto start_time = std::chrono::steady_clock::now(); + int bad_opcode_count = 0; for (const auto& entry : std::filesystem::directory_iterator{ location }) { const auto path = entry.path(); @@ -59,10 +60,15 @@ int main() { } #endif } + if (opcode_bad) + ++bad_opcode_count; } const auto finish_time = std::chrono::steady_clock::now(); const auto elapsed_time = finish_time - start_time; const auto seconds = std::chrono::duration_cast>(elapsed_time).count(); - std::cout << "Elapsed time: " << seconds << " seconds" << std::endl; + std::cout + << "Elapsed time: " << seconds << " seconds" + << ", bad opcode count: " << bad_opcode_count + << std::endl; } \ No newline at end of file