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:
+25
-5
@@ -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
|
||||
Reference in New Issue
Block a user