2021-10-10 20:26:30 +00:00
|
|
|
#pragma once
|
|
|
|
|
2021-10-24 10:42:43 +00:00
|
|
|
#include <cstdint>
|
2021-10-27 08:53:58 +00:00
|
|
|
#include <string_view>
|
2021-10-18 10:54:01 +00:00
|
|
|
|
2021-10-20 20:44:43 +00:00
|
|
|
#include "simdjson/simdjson.h"
|
2021-10-11 18:13:05 +00:00
|
|
|
|
2021-10-22 12:10:23 +00:00
|
|
|
#include "element_t.h"
|
2021-10-18 12:12:22 +00:00
|
|
|
#include "ram_t.h"
|
|
|
|
|
2021-10-22 12:10:23 +00:00
|
|
|
class state_t final : public element_t {
|
2021-10-10 20:26:30 +00:00
|
|
|
public:
|
2021-10-21 21:43:16 +00:00
|
|
|
state_t(simdjson::dom::element input) noexcept;
|
2021-10-11 18:13:05 +00:00
|
|
|
|
2021-10-28 15:56:54 +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-21 21:03:07 +00: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 20:26:30 +00:00
|
|
|
};
|