2017-08-10 19:34:17 +00:00
|
|
|
#pragma once
|
|
|
|
|
2017-09-07 00:15:28 +00:00
|
|
|
#include <Bus.h>
|
|
|
|
#include <LR35902.h>
|
|
|
|
|
2017-08-10 19:34:17 +00:00
|
|
|
#include "FuseTest.h"
|
|
|
|
#include "FuseExpectedTestResult.h"
|
|
|
|
|
2017-09-07 00:15:28 +00:00
|
|
|
#include <LR35902.h>
|
|
|
|
#include <GameBoyBus.h>
|
|
|
|
#include <Ram.h>
|
2017-08-10 19:34:17 +00:00
|
|
|
|
|
|
|
namespace Fuse {
|
2017-09-07 00:15:28 +00:00
|
|
|
class TestRunner : public EightBit::GameBoy::Bus {
|
2017-08-10 19:34:17 +00:00
|
|
|
private:
|
|
|
|
const Test& m_test;
|
|
|
|
const ExpectedTestResult& m_expected;
|
|
|
|
|
|
|
|
bool m_failed;
|
|
|
|
bool m_unimplemented;
|
|
|
|
|
2017-09-07 00:15:28 +00:00
|
|
|
EightBit::Ram m_ram;
|
|
|
|
EightBit::GameBoy::LR35902 m_cpu;
|
2017-08-10 19:34:17 +00:00
|
|
|
|
|
|
|
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:15:28 +00:00
|
|
|
protected:
|
2018-06-10 21:00:52 +00:00
|
|
|
virtual uint8_t& reference(uint16_t address) {
|
2017-09-07 00:15:28 +00:00
|
|
|
return m_ram.reference(address);
|
|
|
|
}
|
|
|
|
|
2017-08-10 19:34:17 +00:00
|
|
|
public:
|
|
|
|
TestRunner(const Test& test, const ExpectedTestResult& expected);
|
|
|
|
|
|
|
|
void run();
|
|
|
|
bool failed() const { return m_failed; }
|
|
|
|
bool unimplemented() const { return m_unimplemented; }
|
|
|
|
};
|
|
|
|
}
|