mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2026-04-26 06:17:47 +00:00
simplify 6502 hartetest checker code
This commit is contained in:
@@ -102,9 +102,9 @@ void checker_t::initialiseState(const test_t test) {
|
|||||||
cpu.Y() = initial.y();
|
cpu.Y() = initial.y();
|
||||||
cpu.P() = initial.p();
|
cpu.P() = initial.p();
|
||||||
for (const auto entry : initial.ram()) {
|
for (const auto entry : initial.ram()) {
|
||||||
auto data = entry.begin();
|
const byte_t byte{ entry };
|
||||||
const auto address = uint16_t(int64_t(*data));
|
const auto address = byte.address();
|
||||||
const auto value = uint8_t(int64_t(*++data));
|
const auto value = byte.value();
|
||||||
ram.poke(address, value);
|
ram.poke(address, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -141,18 +141,18 @@ bool checker_t::checkState(test_t test) {
|
|||||||
return false; // more expected cycles than actual
|
return false; // more expected cycles than actual
|
||||||
}
|
}
|
||||||
|
|
||||||
auto expected_data = expected_cycle.begin();
|
const cycle_t expected{ expected_cycle };
|
||||||
const auto& actual = actual_cycles[actual_idx++];
|
const auto& actual = actual_cycles[actual_idx++];
|
||||||
|
|
||||||
const auto expected_address = uint16_t(int64_t(*expected_data));
|
const auto expected_address = expected.address();
|
||||||
const auto actual_address = std::get<0>(actual);
|
const auto actual_address = std::get<0>(actual);
|
||||||
check("Cycle address", expected_address, actual_address);
|
check("Cycle address", expected_address, actual_address);
|
||||||
|
|
||||||
const auto expected_value = uint8_t(int64_t(*++expected_data));
|
const auto expected_value = expected.value();
|
||||||
const auto actual_value = std::get<1>(actual);
|
const auto actual_value = std::get<1>(actual);
|
||||||
check("Cycle value", expected_value, actual_value);
|
check("Cycle value", expected_value, actual_value);
|
||||||
|
|
||||||
const auto expected_action = (*++expected_data).get_string();
|
const auto expected_action = expected.action();
|
||||||
const auto actual_action = std::get<2>(actual);
|
const auto actual_action = std::get<2>(actual);
|
||||||
check("Cycle action", expected_action.value_unsafe(), actual_action);
|
check("Cycle action", expected_action.value_unsafe(), actual_action);
|
||||||
}
|
}
|
||||||
@@ -175,12 +175,13 @@ bool checker_t::checkState(test_t test) {
|
|||||||
|
|
||||||
bool ram_problem = false;
|
bool ram_problem = false;
|
||||||
for (const auto entry : final.ram()) {
|
for (const auto entry : final.ram()) {
|
||||||
auto data = entry.begin();
|
const auto byte = byte_t{ entry };
|
||||||
const auto address = uint16_t(int64_t(*data));
|
const auto address = byte.address();
|
||||||
const auto value = uint8_t(int64_t(*++data));
|
const auto value = byte.value();
|
||||||
const auto ram_good = check("RAM", address, value, ram.peek(address));
|
if (!check("RAM", address, value, ram.peek(address))) {
|
||||||
if (!ram_good && !ram_problem)
|
ram_problem = true;
|
||||||
ram_problem = true;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user