#ifndef OPCODES_H #define OPCODES_H #include #include "symbols_table.h" #define OPCODECOUNT 13 typedef enum { R1, R2, R3, R4, R5, R6, R7, R8 } Registers; typedef enum { COPY, ADD, SUB, JZ, INT, YLD, RET, CMP, NOP, JMP, CALL, IN, OUT, } Mnemonic; typedef enum { None, Constant, Address } OpcodeParameter; typedef struct { Mnemonic Mnemonic; OpcodeParameter ParameterOneType; OpcodeParameter ParameterTwoType; union { int Constant; Symbol* Symbol; } ParameterOne; union { int Constant; Symbol* Symbol; } ParameterTwo; } Instruction; extern Instruction instructions[OPCODECOUNT]; int IsOpcode(const char*, Mnemonic*); int IsRegister(const char*, Registers*); //const Instruction* GetOpcodeDetails(Mnemonic); unsigned char GetInstructionMask(Mnemonic type); #endif