Back to looking at the failing tests now! Add failure count and disassembly of failed opcodes.

Signed-off-by: Adrian Conlon <adrian.conlon@gmail.com>
This commit is contained in:
Adrian Conlon committed 2021-10-19 13:13:59 +01:00
1 parent bb7de9d3e1
commit 0ef06ebbb2
3 files changed
+21 -3

No files matched your search

+9 -2
View File
@@ -1,8 +1,6 @@
#include "stdafx.h" #include "stdafx.h"
#include "TestRunner.h" #include "TestRunner.h"
#include <Disassembly.h>
TestRunner::TestRunner(const test_t& test) TestRunner::TestRunner(const test_t& test)
: m_test(test) {} : m_test(test) {}
@@ -176,6 +174,7 @@ bool TestRunner::check() {
initialise(); initialise();
raisePOWER(); raisePOWER();
initialiseState(); initialiseState();
const auto pc = CPU().PC();
const int cycles = CPU().step(); const int cycles = CPU().step();
const auto valid = checkState(); const auto valid = checkState();
if (m_cycle_count_mismatch) { if (m_cycle_count_mismatch) {
@@ -183,6 +182,14 @@ bool TestRunner::check() {
m_messages.push_back("Unimplemented"); m_messages.push_back("Unimplemented");
} else { } 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() os()
<< std::dec << std::setfill(' ') << std::dec << std::setfill(' ')
<< "Stepped cycles: " << cycles << "Stepped cycles: " << cycles
+5
View File
@@ -8,6 +8,8 @@
#include <Bus.h> #include <Bus.h>
#include <Ram.h> #include <Ram.h>
#include <mos6502.h> #include <mos6502.h>
#include <Disassembly.h>
#include <Symbols.h>
#include "test_t.h" #include "test_t.h"
@@ -15,6 +17,9 @@ class TestRunner final : public EightBit::Bus {
private: private:
EightBit::Ram m_ram = 0x10000; EightBit::Ram m_ram = 0x10000;
EightBit::MOS6502 m_cpu = { *this }; EightBit::MOS6502 m_cpu = { *this };
EightBit::Symbols m_symbols;
EightBit::Disassembly m_disassembler = { *this, m_cpu, m_symbols };
const test_t& m_test; const test_t& m_test;
std::ostringstream m_os; std::ostringstream m_os;
+7 -1
View File
@@ -14,6 +14,7 @@ int main() {
const auto start_time = std::chrono::steady_clock::now(); const auto start_time = std::chrono::steady_clock::now();
int bad_opcode_count = 0;
for (const auto& entry : std::filesystem::directory_iterator{ location }) { for (const auto& entry : std::filesystem::directory_iterator{ location }) {
const auto path = entry.path(); const auto path = entry.path();
@@ -59,10 +60,15 @@ int main() {
} }
#endif #endif
} }
if (opcode_bad)
++bad_opcode_count;
} }
const auto finish_time = std::chrono::steady_clock::now(); const auto finish_time = std::chrono::steady_clock::now();
const auto elapsed_time = finish_time - start_time; const auto elapsed_time = finish_time - start_time;
const auto seconds = std::chrono::duration_cast<std::chrono::duration<double>>(elapsed_time).count(); const auto seconds = std::chrono::duration_cast<std::chrono::duration<double>>(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;
} }