This commit is contained in:
2022-11-04 08:29:02 -07:00
parent e88863ed37
commit fd39209ff0
9 changed files with 136 additions and 92 deletions

View File

@@ -36,9 +36,6 @@ public:
Machine();
explicit Machine(std::vector<ValueType> ram);
/// Advance machine until next side effect
auto Step() -> std::variant<Input, Output, Halt>;
/// Access memory at absolute address
/// @param address
/// @return reference to memory at given address
@@ -48,8 +45,14 @@ public:
/// @param offset from base pointer
/// @return reference to memory at given offset
auto Rel(std::size_t offset) -> ValueType &;
auto Next() -> ValueType &;
auto Goto(std::size_t address) -> void;
auto Rebase(std::size_t offset) -> void;
};
auto Step(Machine & m) -> std::variant<Input, Output, Halt>;
struct BadInstruction : public std::runtime_error {
explicit BadInstruction(char const* what);
};