1
0
mirror of https://github.com/lefticus/6502-cpp.git synced 2024-10-15 15:24:20 +00:00
6502-cpp/include/assembly.hpp
2021-05-06 23:11:12 -06:00

52 lines
863 B
C++

#ifndef INC_6502_CPP_ASSEMBLY_HPP
#define INC_6502_CPP_ASSEMBLY_HPP
struct Operand
{
enum class Type {
empty,
literal,
reg /*ister*/
};
Type type = Type::empty;
int reg_num = 0;
std::string value;
Operand() = default;
bool operator==(const Operand &other) const
{
return type == other.type && reg_num == other.reg_num && value == other.value;
}
Operand(const Type t, std::string v)
: type(t), value(std::move(v))
{
assert(type == Type::literal);
}
Operand(const Type t, const int num)
: type(t), reg_num(num)
{
assert(type == Type::reg);
}
};
struct ASMLine
{
enum class Type {
Label,
Instruction,
Directive
};
ASMLine(Type t, std::string te) : type(t), text(std::move(te)) {}
Type type;
std::string text;
};
#endif//INC_6502_CPP_ASSEMBLY_HPP