Compile to bytecode
This commit is contained in:
37
include/execute/argumentvalue.hpp
Normal file
37
include/execute/argumentvalue.hpp
Normal file
@@ -0,0 +1,37 @@
|
||||
#pragma once
|
||||
#include <variant>
|
||||
#include <execute/bytecode.hpp>
|
||||
#include <execute/error.hpp>
|
||||
#include <execute/state.hpp>
|
||||
#include <stdexcept>
|
||||
#include <vector>
|
||||
|
||||
namespace Execute
|
||||
{
|
||||
enum class ArgumentType
|
||||
{
|
||||
Immediate,
|
||||
Register,
|
||||
Memory
|
||||
};
|
||||
|
||||
class ArgumentValue
|
||||
{
|
||||
private:
|
||||
ArgumentType type;
|
||||
ArgumentType memoryValueType;
|
||||
std::variant<RegisterByte, int> data;
|
||||
|
||||
int & GetRegister(State & state) const;
|
||||
std::uint8_t * GetMemory(State & state) const;
|
||||
|
||||
public:
|
||||
void Write(int const value, State & state) const;
|
||||
int Read(State & state) const;
|
||||
|
||||
// Returns the size of the argument in bytes
|
||||
std::size_t Parse(
|
||||
std::vector<std::uint8_t> const & memory,
|
||||
std::size_t const pos);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user