2021-10-10 20:26:30 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <cstdint>
|
2021-10-18 10:54:01 +00:00
|
|
|
|
|
|
|
#ifdef USE_SIMDJSON_JSON
|
|
|
|
# include "simdjson/simdjson.h"
|
|
|
|
#endif
|
2021-10-11 13:59:23 +00:00
|
|
|
|
|
|
|
#ifdef USE_BOOST_JSON
|
|
|
|
# include <boost/json.hpp>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef USE_NLOHMANN_JSON
|
|
|
|
# include "nlohmann/json.hpp"
|
|
|
|
#endif
|
2021-10-10 20:26:30 +00:00
|
|
|
|
2021-10-11 18:13:05 +00:00
|
|
|
#ifdef USE_JSONCPP_JSON
|
|
|
|
# include <json/json.h>
|
|
|
|
#endif
|
|
|
|
|
2021-10-18 12:12:22 +00:00
|
|
|
#include "ram_t.h"
|
|
|
|
|
2021-10-13 22:33:08 +00:00
|
|
|
class state_t final {
|
2021-10-10 20:26:30 +00:00
|
|
|
private:
|
|
|
|
uint16_t m_pc = 0xffff;
|
|
|
|
uint8_t m_s = 0xff;
|
|
|
|
uint8_t m_a = 0xff;
|
|
|
|
uint8_t m_x = 0xff;
|
|
|
|
uint8_t m_y = 0xff;
|
|
|
|
uint8_t m_p = 0xff;
|
2021-10-18 12:12:22 +00:00
|
|
|
ram_t m_ram;
|
2021-10-11 18:13:05 +00:00
|
|
|
|
2021-10-10 20:26:30 +00:00
|
|
|
public:
|
2021-10-18 10:54:01 +00:00
|
|
|
#ifdef USE_SIMDJSON_JSON
|
|
|
|
state_t(simdjson::dom::element serialised);
|
|
|
|
#endif
|
|
|
|
|
2021-10-11 13:59:23 +00:00
|
|
|
#ifdef USE_BOOST_JSON
|
2021-10-10 20:26:30 +00:00
|
|
|
state_t(const boost::json::object& serialised);
|
|
|
|
state_t(const boost::json::value& serialised);
|
2021-10-11 13:59:23 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef USE_NLOHMANN_JSON
|
|
|
|
state_t(const nlohmann::json& serialised);
|
|
|
|
#endif
|
2021-10-10 20:26:30 +00:00
|
|
|
|
2021-10-11 18:13:05 +00:00
|
|
|
#ifdef USE_JSONCPP_JSON
|
|
|
|
state_t(const Json::Value& serialised);
|
|
|
|
#endif
|
|
|
|
|
2021-10-11 09:43:33 +00:00
|
|
|
[[nodiscard]] constexpr auto pc() const noexcept { return m_pc; }
|
|
|
|
[[nodiscard]] constexpr auto s() const noexcept { return m_s; }
|
|
|
|
[[nodiscard]] constexpr auto a() const noexcept { return m_a; }
|
|
|
|
[[nodiscard]] constexpr auto x() const noexcept { return m_x; }
|
|
|
|
[[nodiscard]] constexpr auto y() const noexcept { return m_y; }
|
|
|
|
[[nodiscard]] constexpr auto p() const noexcept { return m_p; }
|
|
|
|
[[nodiscard]] constexpr const auto& ram() const noexcept { return m_ram; }
|
2021-10-10 20:26:30 +00:00
|
|
|
};
|