summaryrefslogtreecommitdiff
path: root/src/status.hh
diff options
context:
space:
mode:
authorHannes Schulze <haschu0103@outlook.de>2025-01-18 00:05:53 +0100
committerHannes Schulze <haschu0103@outlook.de>2025-01-18 00:05:53 +0100
commitd5a52cc491a222f1b7d33fa6789bed617ec6638b (patch)
treea1c849e94620eb2c132fbd1a61898ef51ce167ba /src/status.hh
parent9d80b5b8a61bd8c2336f5032de8b84fea15d685f (diff)
cpu: bugfixes
Diffstat (limited to 'src/status.hh')
-rw-r--r--src/status.hh55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/status.hh b/src/status.hh
new file mode 100644
index 0000000..705ae6e
--- /dev/null
+++ b/src/status.hh
@@ -0,0 +1,55 @@
+#pragma once
+
+#include "nes/util/cycle_count.hh"
+#include <vector>
+#include <cstdint>
+
+namespace test
+{
+ /// System status used for comparison.
+ struct status
+ {
+ explicit status() = default;
+
+ nes::cycle_count cpu_cycle;
+ std::vector<std::uint8_t> ram;
+ std::vector<std::uint8_t> sram;
+ struct
+ {
+ std::uint16_t pc{};
+ std::uint8_t sp{};
+ std::uint8_t a{};
+ std::uint8_t x{};
+ std::uint8_t y{};
+ std::uint8_t p{};
+ bool c{};
+ bool z{};
+ bool i{};
+ bool d{};
+ bool b{};
+ bool v{};
+ bool n{};
+ } registers{};
+
+ static auto equal(status const& a, status const& b) -> bool
+ {
+ if (a.cpu_cycle != b.cpu_cycle) { return false; }
+ if (a.ram != b.ram) { return false; }
+ if (a.sram != b.sram) { return false; }
+ if (a.registers.pc != b.registers.pc) { return false; }
+ if (a.registers.sp != b.registers.sp) { return false; }
+ if (a.registers.a != b.registers.a) { return false; }
+ if (a.registers.x != b.registers.x) { return false; }
+ if (a.registers.y != b.registers.y) { return false; }
+ if (a.registers.p != b.registers.p) { return false; }
+ if (a.registers.c != b.registers.c) { return false; }
+ if (a.registers.z != b.registers.z) { return false; }
+ if (a.registers.i != b.registers.i) { return false; }
+ if (a.registers.d != b.registers.d) { return false; }
+ if (a.registers.b != b.registers.b) { return false; }
+ if (a.registers.v != b.registers.v) { return false; }
+ if (a.registers.n != b.registers.n) { return false; }
+ return true;
+ }
+ };
+} // namespace test \ No newline at end of file