2021-10-10 21:26:30 +01:00
|
|
|
#pragma once
|
|
|
|
|
2021-10-24 11:42:43 +01:00
|
|
|
#include <cstdint>
|
2021-10-22 13:10:23 +01:00
|
|
|
#include <string>
|
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
|
|
|
private:
|
2021-10-21 22:03:07 +01:00
|
|
|
[[nodiscard]] auto address_at(std::string key) const noexcept { return (uint16_t)integer_at(key); }
|
|
|
|
[[nodiscard]] auto byte_at(std::string key) const noexcept { return (uint8_t)integer_at(key); }
|
|
|
|
|
2021-10-10 21:26:30 +01:00
|
|
|
public:
|
2021-10-21 22:43:16 +01:00
|
|
|
state_t(simdjson::dom::element input) noexcept;
|
2021-10-11 19:13:05 +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
|
|
|
};
|