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-09-15 13:35:59 +00:00
|
|
|
virtual EightBit::MemoryMapping mapping(uint16_t address) final {
|
2018-11-01 23:43:29 +00:00
|
|
|
return { m_ram, 0x0000, 0xffff, EightBit::MemoryMapping::ReadWrite };
|
2017-09-07 00:15:28 +00:00
|
|
|
}
|
|
|
|
|
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; }
|
|
|
|
};
|
|
|
|
}
|