2021-10-10 21:26:30 +01:00
|
|
|
#pragma once
|
|
|
|
|
2021-10-24 11:42:43 +01:00
|
|
|
#include <cstdint>
|
2021-10-27 09:53:58 +01:00
|
|
|
#include <string_view>
|
2021-10-18 11:54:01 +01:00
|
|
|
|
2021-10-20 21:44:43 +01:00
|
|
|
#include "simdjson/simdjson.h"
|
2021-10-11 19:13:05 +01:00
|
|
|
|
2021-10-22 13:10:23 +01:00
|
|
|
#include "element_t.h"
|
2021-10-18 13:12:22 +01:00
|
|
|
#include "ram_t.h"
|
|
|
|
|
2021-10-22 13:10:23 +01:00
|
|
|
class state_t final : public element_t {
|
2021-10-10 21:26:30 +01:00
|
|
|
public:
|
2024-01-10 14:41:37 +00:00
|
|
|
state_t(const simdjson::dom::element input) noexcept
|
|
|
|
: element_t(input) {}
|
2021-10-11 19:13:05 +01:00
|
|
|
|
2024-01-01 23:25:32 +00:00
|
|
|
[[nodiscard]] auto address_at(std::string_view key) const noexcept { return uint16_t(integer_at(key)); }
|
|
|
|
[[nodiscard]] auto byte_at(std::string_view key) const noexcept { return uint8_t(integer_at(key)); }
|
2021-10-28 16:56:54 +01:00
|
|
|
|
2021-10-21 22:03:07 +01:00
|
|
|
[[nodiscard]] auto pc() const noexcept { return address_at("pc"); }
|
|
|
|
[[nodiscard]] auto s() const noexcept { return byte_at("s"); }
|
|
|
|
[[nodiscard]] auto a() const noexcept { return byte_at("a"); }
|
|
|
|
[[nodiscard]] auto x() const noexcept { return byte_at("x"); }
|
|
|
|
[[nodiscard]] auto y() const noexcept { return byte_at("y"); }
|
|
|
|
[[nodiscard]] auto p() const noexcept { return byte_at("p"); }
|
|
|
|
[[nodiscard]] auto ram() const noexcept { return ram_t(array_at("ram")); }
|
2021-10-10 21:26:30 +01:00
|
|
|
};
|