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
@ -46,17 +46,3 @@ void Fuse::ExpectedTestResult::read(std::ifstream& file) {
|
||||
}
|
||||
} 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) {}
|
||||
|
||||
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) {
|
||||
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);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -18,15 +18,3 @@ void Fuse::MemoryDatum::read(std::ifstream& file) {
|
||||
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;
|
||||
}
|
@ -19,6 +19,5 @@ namespace Fuse {
|
||||
|
||||
bool finished() const { return finish; }
|
||||
void read(std::ifstream& file);
|
||||
void write(std::ofstream& 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
|
||||
@ -40,48 +35,3 @@ std::string Fuse::RegisterState::hex(int value) {
|
||||
<< 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;
|
||||
}
|
@ -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);
|
||||
};
|
||||
}
|
@ -23,18 +23,3 @@ void Fuse::Test::read(std::ifstream& file) {
|
||||
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;
|
||||
}
|
||||
|
@ -16,6 +16,5 @@ namespace Fuse {
|
||||
bool finish = false;
|
||||
|
||||
void read(std::ifstream& file);
|
||||
void write(std::ofstream& file);
|
||||
};
|
||||
}
|
@ -32,21 +32,3 @@ void Fuse::TestEvent::read(std::ifstream& file) {
|
||||
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 write(std::ofstream& file);
|
||||
};
|
||||
}
|
@ -11,10 +11,3 @@ void Fuse::TestEvents::read(std::ifstream& file) {
|
||||
events.push_back(event);
|
||||
} 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;
|
||||
|
||||
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) {
|
||||
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);
|
||||
}
|
||||
|
@ -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; }
|
||||
};
|
||||
}
|
||||
|
@ -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
Loading…
Reference in New Issue
Block a user