2017-06-05 22:24:08 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "FuseTest.h"
|
|
|
|
#include "FuseExpectedTestResult.h"
|
|
|
|
|
2017-09-07 00:04:09 +00:00
|
|
|
#include <Ram.h>
|
|
|
|
#include <Bus.h>
|
|
|
|
#include <InputOutput.h>
|
|
|
|
#include <Z80.h>
|
2017-06-05 22:24:08 +00:00
|
|
|
|
|
|
|
namespace Fuse {
|
2017-09-07 00:04:09 +00:00
|
|
|
class TestRunner : public EightBit::Bus {
|
2017-06-05 22:24:08 +00:00
|
|
|
private:
|
|
|
|
const Test& m_test;
|
|
|
|
const ExpectedTestResult& m_expected;
|
|
|
|
|
2017-12-10 21:41:48 +00:00
|
|
|
bool m_failed = false;
|
|
|
|
bool m_unimplemented = false;
|
2017-06-05 22:24:08 +00:00
|
|
|
|
2017-12-10 21:41:48 +00:00
|
|
|
EightBit::Ram m_ram = 0x10000;
|
2017-06-05 22:24:08 +00:00
|
|
|
EightBit::InputOutput m_ports;
|
|
|
|
EightBit::Z80 m_cpu;
|
|
|
|
|
|
|
|
void initialise();
|
|
|
|
void initialiseRegisters();
|
|
|
|
void initialiseMemory();
|
|
|
|
|
|
|
|
void check();
|
|
|
|
void checkregisters();
|
|
|
|
void checkMemory();
|
|
|
|
|
|
|
|
void dumpDifference(const std::string& description, uint8_t high, uint8_t low) const;
|
|
|
|
void dumpDifference(
|
|
|
|
const std::string& highDescription,
|
|
|
|
const std::string& lowDescription,
|
|
|
|
EightBit::register16_t actual, EightBit::register16_t expected) const;
|
|
|
|
|
2017-09-07 00:04:09 +00:00
|
|
|
protected:
|
2018-09-15 13:35:59 +00:00
|
|
|
virtual EightBit::MemoryMapping mapping(uint16_t address) final {
|
|
|
|
return { m_ram, 0x0000, EightBit::MemoryMapping::ReadWrite };
|
2017-09-07 00:04:09 +00:00
|
|
|
}
|
|
|
|
|
2017-06-05 22:24:08 +00:00
|
|
|
public:
|
|
|
|
TestRunner(const Test& test, const ExpectedTestResult& expected);
|
|
|
|
|
|
|
|
void run();
|
|
|
|
bool failed() const { return m_failed; }
|
|
|
|
bool unimplemented() const { return m_unimplemented; }
|
|
|
|
};
|
|
|
|
}
|