Some refactoring to update everything to use the new structures and some new considerations for how Symbols and Instructions shoudl be represented.

This commit is contained in:
2022-09-15 22:14:38 -05:00
parent 2ae60a607c
commit 0b58e0124f
5 changed files with 119 additions and 64 deletions
+8 -6
View File
@@ -4,8 +4,6 @@
#include <string.h>
#include "symbols_table.h"
#define OPCODECOUNT 13
typedef enum {
R1, R2, R3, R4, R5, R6, R7, R8
} Registers;
@@ -16,9 +14,10 @@ typedef enum {
} Mnemonic;
typedef enum {
None,
Constant,
Address
NoParameter,
ConstantParameter,
AddressParameter,
RegisterParameter
} OpcodeParameter;
typedef struct {
@@ -37,10 +36,13 @@ typedef struct {
} ParameterTwo;
} Instruction;
extern Instruction instructions[OPCODECOUNT];
//extern Instruction instructions[OPCODECOUNT];
Instruction* CreateInstruction(Mnemonic mnemonic);
void FreeInstruction(Instruction* instruction);
int IsOpcode(const char*, Mnemonic*);
int IsRegister(const char*, Registers*);
void GetMnemonicText(Mnemonic mnemonic, char buffer[12]);
//const Instruction* GetOpcodeDetails(Mnemonic);
unsigned char GetInstructionMask(Mnemonic type);