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;
|
|
|
|
|
2018-11-11 16:48:44 +00:00
|
|
|
bool m_failed = false;
|
|
|
|
bool m_unimplemented = false;
|
2017-08-10 19:34:17 +00:00
|
|
|
|
2018-11-11 16:48:44 +00:00
|
|
|
EightBit::Ram m_ram = 0x10000;
|
2017-08-10 19:34:17 +00:00
|
|
|
|
|
|
|
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-12-01 15:24:29 +00:00
|
|
|
return { m_ram, 0x0000, 0xffff, EightBit::MemoryMapping::AccessLevel::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; }
|
2018-11-11 16:48:44 +00:00
|
|
|
|
2019-01-14 02:10:17 +00:00
|
|
|
virtual void raisePOWER() final;
|
|
|
|
virtual void lowerPOWER() final;
|
|
|
|
|
|
|
|
void initialise();
|
2017-08-10 19:34:17 +00:00
|
|
|
};
|
|
|
|
}
|