mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2024-12-22 09:30:32 +00:00
Remove remaining Z80 -> LR35902 test translation code.
Signed-off-by: Adrian.Conlon <adrian.conlon@gmail.com>
This commit is contained in:
parent
e7001b2425
commit
78e5451f93
@ -45,18 +45,4 @@ void Fuse::ExpectedTestResult::read(std::ifstream& file) {
|
|||||||
memoryData.push_back(datum);
|
memoryData.push_back(datum);
|
||||||
}
|
}
|
||||||
} while (!line.empty());
|
} 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);
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -23,6 +23,5 @@ namespace Fuse {
|
|||||||
: finish(false) {}
|
: finish(false) {}
|
||||||
|
|
||||||
void read(std::ifstream& file);
|
void read(std::ifstream& file);
|
||||||
void write(std::ofstream& 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) {
|
void Fuse::ExpectedTestResults::read(std::string path) {
|
||||||
std::ifstream file;
|
std::ifstream file;
|
||||||
file >> std::hex;
|
file >> std::hex;
|
||||||
file.open(path);
|
file.open(path);
|
||||||
read(file);
|
read(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Fuse::ExpectedTestResults::write(std::string path) {
|
|
||||||
std::ofstream file;
|
|
||||||
file << std::hex;
|
|
||||||
file.open(path);
|
|
||||||
write(file);
|
|
||||||
}
|
|
@ -12,11 +12,9 @@ namespace Fuse {
|
|||||||
std::map<std::string, ExpectedTestResult> results;
|
std::map<std::string, ExpectedTestResult> results;
|
||||||
|
|
||||||
void read(std::ifstream& file);
|
void read(std::ifstream& file);
|
||||||
void write(std::ofstream& file);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void read(std::string path);
|
void read(std::string path);
|
||||||
void write(std::string path);
|
|
||||||
const std::map<std::string, ExpectedTestResult>& container() const {
|
const std::map<std::string, ExpectedTestResult>& container() const {
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
@ -17,16 +17,4 @@ void Fuse::MemoryDatum::read(std::ifstream& file) {
|
|||||||
if (!completed)
|
if (!completed)
|
||||||
bytes.push_back(byte);
|
bytes.push_back(byte);
|
||||||
} while (!completed);
|
} 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;
|
|
||||||
}
|
}
|
@ -19,6 +19,5 @@ namespace Fuse {
|
|||||||
|
|
||||||
bool finished() const { return finish; }
|
bool finished() const { return finish; }
|
||||||
void read(std::ifstream& file);
|
void read(std::ifstream& file);
|
||||||
void write(std::ofstream& file);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
@ -27,11 +27,6 @@ void Fuse::RegisterState::readInternal(std::ifstream& file) {
|
|||||||
file >> std::hex;
|
file >> std::hex;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Fuse::RegisterState::write(std::ofstream& file) {
|
|
||||||
writeExternal(file);
|
|
||||||
writeInternal(file);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string Fuse::RegisterState::hex(int value) {
|
std::string Fuse::RegisterState::hex(int value) {
|
||||||
std::ostringstream output;
|
std::ostringstream output;
|
||||||
output << std::hex
|
output << std::hex
|
||||||
@ -39,49 +34,4 @@ std::string Fuse::RegisterState::hex(int value) {
|
|||||||
<< std::setfill('0')
|
<< std::setfill('0')
|
||||||
<< value;
|
<< value;
|
||||||
return output.str();
|
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;
|
|
||||||
}
|
}
|
@ -20,15 +20,11 @@ namespace Fuse {
|
|||||||
RegisterState();
|
RegisterState();
|
||||||
|
|
||||||
void read(std::ifstream& file);
|
void read(std::ifstream& file);
|
||||||
void write(std::ofstream& file);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void readInternal(std::ifstream& file);
|
void readInternal(std::ifstream& file);
|
||||||
void readExternal(std::ifstream& file);
|
void readExternal(std::ifstream& file);
|
||||||
|
|
||||||
void writeInternal(std::ofstream& file);
|
|
||||||
void writeExternal(std::ofstream& file);
|
|
||||||
|
|
||||||
static std::string hex(int value);
|
static std::string hex(int value);
|
||||||
};
|
};
|
||||||
}
|
}
|
@ -22,19 +22,4 @@ void Fuse::Test::read(std::ifstream& file) {
|
|||||||
if (!complete)
|
if (!complete)
|
||||||
memoryData.push_back(memoryDatum);
|
memoryData.push_back(memoryDatum);
|
||||||
} while (!complete);
|
} 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;
|
|
||||||
}
|
|
@ -16,6 +16,5 @@ namespace Fuse {
|
|||||||
bool finish = false;
|
bool finish = false;
|
||||||
|
|
||||||
void read(std::ifstream& file);
|
void read(std::ifstream& file);
|
||||||
void write(std::ofstream& file);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
@ -31,22 +31,4 @@ void Fuse::TestEvent::read(std::ifstream& file) {
|
|||||||
if (!valid) {
|
if (!valid) {
|
||||||
file.seekg(prior);
|
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -16,6 +16,5 @@ namespace Fuse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void read(std::ifstream& file);
|
void read(std::ifstream& file);
|
||||||
void write(std::ofstream& file);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
@ -10,11 +10,4 @@ void Fuse::TestEvents::read(std::ifstream& file) {
|
|||||||
if (!complete)
|
if (!complete)
|
||||||
events.push_back(event);
|
events.push_back(event);
|
||||||
} while (!complete);
|
} while (!complete);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Fuse::TestEvents::write(std::ofstream& file) {
|
|
||||||
for (auto event : events) {
|
|
||||||
event.write(file);
|
|
||||||
file << std::endl;
|
|
||||||
}
|
|
||||||
}
|
|
@ -9,6 +9,5 @@ namespace Fuse {
|
|||||||
std::vector<TestEvent> events;
|
std::vector<TestEvent> events;
|
||||||
|
|
||||||
void read(std::ifstream& file);
|
void read(std::ifstream& file);
|
||||||
void write(std::ofstream& 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) {
|
void Fuse::Tests::read(std::string path) {
|
||||||
std::ifstream file;
|
std::ifstream file;
|
||||||
file >> std::hex;
|
file >> std::hex;
|
||||||
file.open(path);
|
file.open(path);
|
||||||
read(file);
|
read(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Fuse::Tests::write(std::string path) {
|
|
||||||
std::ofstream file;
|
|
||||||
file.open(path);
|
|
||||||
write(file);
|
|
||||||
}
|
|
@ -12,11 +12,9 @@ namespace Fuse {
|
|||||||
std::map<std::string, Test> tests;
|
std::map<std::string, Test> tests;
|
||||||
|
|
||||||
void read(std::ifstream& file);
|
void read(std::ifstream& file);
|
||||||
void write(std::ofstream& file);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void read(std::string path);
|
void read(std::string path);
|
||||||
void write(std::string path);
|
|
||||||
const std::map<std::string, Test>& container() const { return tests; }
|
const std::map<std::string, Test>& container() const { return tests; }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,8 @@ tests.in
|
|||||||
Each test has the format:
|
Each test has the format:
|
||||||
|
|
||||||
<arbitrary test description>
|
<arbitrary test description>
|
||||||
AF BC DE HL AF' BC' DE' HL' IX IY SP PC MEMPTR
|
AF BC DE HL SP PC
|
||||||
I R IFF1 IFF2 IM <halted> <tstates>
|
<halted> <tstates>
|
||||||
|
|
||||||
<halted> specifies whether the Z80 is halted.
|
<halted> specifies whether the Z80 is halted.
|
||||||
<tstates> specifies the number of tstates to run the test for, in
|
<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
Loading…
Reference in New Issue
Block a user