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 2021-10-19 13:13:59 +01:00
parent bb7de9d3e1
commit 0ef06ebbb2
3 changed files with 21 additions and 3 deletions

View File

@ -1,8 +1,6 @@
#include "stdafx.h"
#include "TestRunner.h"
#include <Disassembly.h>
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

View File

@ -8,6 +8,8 @@
#include <Bus.h>
#include <Ram.h>
#include <mos6502.h>
#include <Disassembly.h>
#include <Symbols.h>
#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;

View File

@ -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<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;
}