Updated the parser and setup the opcodes.c file to include helper functions to build up an Opcode object. I don't like how this is setup at the moment but seems to be a decent way to handle things for now.
This commit is contained in:
+13
-2
@@ -1,9 +1,13 @@
|
||||
#ifndef OPCODES_H
|
||||
#define OPCODES_H
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
typedef enum {
|
||||
R1 = 1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13, R14, R15, R16, R17, R18, R19,
|
||||
@@ -15,9 +19,16 @@ typedef enum {
|
||||
OUTB, INB, HLT, CLI, ENI, INT, LIVT, PUSHA, POPA, CALL, RET, PUSH, POP
|
||||
} Mnemonics;
|
||||
|
||||
int IsOpcode(const char*, Mnemonics*);
|
||||
int IsRegister(const char*, Registers*);
|
||||
typedef struct opcode Opcode;
|
||||
|
||||
bool IsOpcode(const char*, Mnemonics*);
|
||||
bool IsRegister(const char*, Registers*);
|
||||
void GetMnemonicText(Mnemonics mnemonic, char buffer[12]);
|
||||
void GetRegisterText(Registers reg, char buffer[5]);
|
||||
Opcode* OpcodeCreate(Mnemonics mnemonic);
|
||||
int OpcodeArgCount(const Opcode* opcode);
|
||||
int OpcodeAddLiteral(uint32_t number, bool pointer, Opcode* opcode);
|
||||
int OpcodeAddSymbol(char* symbol, bool pointer, Opcode* opcode);
|
||||
int OpcodeAddRegister(Registers reg, bool pointer, Opcode* opcode);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user