Remove remaining Z80 -> LR35902 test translation code.

Signed-off-by: Adrian.Conlon <adrian.conlon@gmail.com>
This commit is contained in:
Adrian.Conlon 2017-08-12 14:29:12 +01:00
parent e7001b2425
commit 78e5451f93
19 changed files with 6 additions and 28228 deletions

View File

@ -45,18 +45,4 @@ void Fuse::ExpectedTestResult::read(std::ifstream& file) {
memoryData.push_back(datum);
}
} while (!line.empty());
}
void Fuse::ExpectedTestResult::write(std::ofstream& file) {
file << description << std::endl;
events.write(file);
registerState.write(file);
file << std::endl;
for (auto memoryDatum : memoryData) {
memoryDatum.write(file);
}
}

View File

@ -23,6 +23,5 @@ namespace Fuse {
: finish(false) {}
void read(std::ifstream& file);
void write(std::ofstream& file);
};
}

View File

@ -12,23 +12,9 @@ void Fuse::ExpectedTestResults::read(std::ifstream& file) {
}
}
void Fuse::ExpectedTestResults::write(std::ofstream& file) {
for (auto result : results) {
result.second.write(file);
file << std::endl << std::endl;
}
}
void Fuse::ExpectedTestResults::read(std::string path) {
std::ifstream file;
file >> std::hex;
file.open(path);
read(file);
}
void Fuse::ExpectedTestResults::write(std::string path) {
std::ofstream file;
file << std::hex;
file.open(path);
write(file);
}
}

View File

@ -12,11 +12,9 @@ namespace Fuse {
std::map<std::string, ExpectedTestResult> results;
void read(std::ifstream& file);
void write(std::ofstream& file);
public:
void read(std::string path);
void write(std::string path);
const std::map<std::string, ExpectedTestResult>& container() const {
return results;
}

View File

@ -17,16 +17,4 @@ void Fuse::MemoryDatum::read(std::ifstream& file) {
if (!completed)
bytes.push_back(byte);
} while (!completed);
}
void Fuse::MemoryDatum::write(std::ofstream& file) {
file
<< std::hex
<< std::setfill('0');
file << std::setw(4) << address << " ";
for (auto byte : bytes) {
file << std::setw(2) << (int)byte << " ";
}
file << std::dec << -1;
}

View File

@ -19,6 +19,5 @@ namespace Fuse {
bool finished() const { return finish; }
void read(std::ifstream& file);
void write(std::ofstream& file);
};
}

View File

@ -27,11 +27,6 @@ void Fuse::RegisterState::readInternal(std::ifstream& file) {
file >> std::hex;
}
void Fuse::RegisterState::write(std::ofstream& file) {
writeExternal(file);
writeInternal(file);
}
std::string Fuse::RegisterState::hex(int value) {
std::ostringstream output;
output << std::hex
@ -39,49 +34,4 @@ std::string Fuse::RegisterState::hex(int value) {
<< std::setfill('0')
<< value;
return output.str();
}
void Fuse::RegisterState::writeExternal(std::ofstream& file) {
const auto z80_af = registers[AF];
const auto z80_a = z80_af.high;
const auto z80_f = z80_af.low;
EightBit::register16_t lr35902_af;
auto& lr35902_a = lr35902_af.high;
auto& lr35902_f = lr35902_af.low;
lr35902_a = z80_a;
lr35902_f = 0;
if (z80_f & EightBit::Processor::Bit6) // ZF
lr35902_f |= EightBit::Processor::Bit7;
if (z80_f & EightBit::Processor::Bit1) // NF
lr35902_f |= EightBit::Processor::Bit6;
if (z80_f & EightBit::Processor::Bit4) // HC
lr35902_f |= EightBit::Processor::Bit5;
if (z80_f & EightBit::Processor::Bit0) // CF
lr35902_f |= EightBit::Processor::Bit4;
file << hex(lr35902_af.word) << " ";
file << hex(registers[BC].word) << " ";
file << hex(registers[DE].word) << " ";
file << hex(registers[HL].word) << " ";
file << hex(registers[SP].word) << " ";
file << hex(registers[PC].word) << " ";
file << std::endl;
}
void Fuse::RegisterState::writeInternal(std::ofstream& file) {
file
<< std::hex
<< std::setfill('0');
file << halted << " ";
file << std::dec;
file << tstates;
file << std::hex;
}

View File

@ -20,15 +20,11 @@ namespace Fuse {
RegisterState();
void read(std::ifstream& file);
void write(std::ofstream& file);
private:
void readInternal(std::ifstream& file);
void readExternal(std::ifstream& file);
void writeInternal(std::ofstream& file);
void writeExternal(std::ofstream& file);
static std::string hex(int value);
};
}

View File

@ -22,19 +22,4 @@ void Fuse::Test::read(std::ifstream& file) {
if (!complete)
memoryData.push_back(memoryDatum);
} while (!complete);
}
void Fuse::Test::write(std::ofstream& file) {
file << description << std::endl;
registerState.write(file);
file << std::endl;
for (auto memoryDatum : memoryData) {
memoryDatum.write(file);
file << std::endl;
}
file << -1 << std::endl;
}
}

View File

@ -16,6 +16,5 @@ namespace Fuse {
bool finish = false;
void read(std::ifstream& file);
void write(std::ofstream& file);
};
}

View File

@ -31,22 +31,4 @@ void Fuse::TestEvent::read(std::ifstream& file) {
if (!valid) {
file.seekg(prior);
}
}
void Fuse::TestEvent::write(std::ofstream& file) {
file << std::dec << cycles;
file << " " << specifier << " ";
file << std::hex << std::setfill('0');
if (specifier == "MR" || specifier == "MW") {
file << std::setw(4) << address << " " << std::setw(2) << value;
}
else if (specifier == "MC" || specifier == "PC") {
file << std::setw(4) << address;
}
else if (specifier == "PR" || specifier == "PW") {
file << std::setw(4) << address << " " << std::setw(2) << value;
}
}

View File

@ -16,6 +16,5 @@ namespace Fuse {
}
void read(std::ifstream& file);
void write(std::ofstream& file);
};
}

View File

@ -10,11 +10,4 @@ void Fuse::TestEvents::read(std::ifstream& file) {
if (!complete)
events.push_back(event);
} while (!complete);
}
void Fuse::TestEvents::write(std::ofstream& file) {
for (auto event : events) {
event.write(file);
file << std::endl;
}
}
}

View File

@ -9,6 +9,5 @@ namespace Fuse {
std::vector<TestEvent> events;
void read(std::ifstream& file);
void write(std::ofstream& file);
};
}

View File

@ -12,22 +12,9 @@ void Fuse::Tests::read(std::ifstream& file) {
}
}
void Fuse::Tests::write(std::ofstream& file) {
for (auto test : tests) {
test.second.write(file);
file << std::endl;
}
}
void Fuse::Tests::read(std::string path) {
std::ifstream file;
file >> std::hex;
file.open(path);
read(file);
}
void Fuse::Tests::write(std::string path) {
std::ofstream file;
file.open(path);
write(file);
}
}

View File

@ -12,11 +12,9 @@ namespace Fuse {
std::map<std::string, Test> tests;
void read(std::ifstream& file);
void write(std::ofstream& file);
public:
void read(std::string path);
void write(std::string path);
const std::map<std::string, Test>& container() const { return tests; }
};
}

View File

@ -7,8 +7,8 @@ tests.in
Each test has the format:
<arbitrary test description>
AF BC DE HL AF' BC' DE' HL' IX IY SP PC MEMPTR
I R IFF1 IFF2 IM <halted> <tstates>
AF BC DE HL SP PC
<halted> <tstates>
<halted> specifies whether the Z80 is halted.
<tstates> specifies the number of tstates to run the test for, in

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff