Modified how registers and opcodes are represented. This commit is a bit buggy but doesn't crash and burn at least. I just wanted the new structs push out before making a bigger mess of things as I try to organize this all.

This commit is contained in:
2022-02-17 21:35:57 -06:00
parent 3d4ab57f05
commit 19021ff782
6 changed files with 106 additions and 59 deletions
+25 -5
View File
@@ -2,14 +2,34 @@
#define OPCODES_H
#include <string.h>
#include "lexer.h"
#define OPCODECOUNT 7
#define OPCODECOUNT 10
#define REGISTERCOUNT 8
extern char *opcodes[OPCODECOUNT];
extern char *registers[REGISTERCOUNT];
typedef enum {
None = 0,
Reg,
Imm8,
Imm16
} ParameterType;
int IsOpcode(const char*);
int IsRegister(const char*);
typedef struct {
char* lexeme;
TokenType op;
ParameterType parameter_one;
ParameterType parameter_two;
} OpCode;
typedef struct {
char* lexeme;
TokenType type;
} Register;
extern OpCode opcodes[OPCODECOUNT];
extern Register registers[REGISTERCOUNT];
int IsOpcode(const char*, TokenType*);
int IsRegister(const char*, TokenType*);
#endif