Added all the instructions supported to a structure to help make validation of parameters easier.
This commit is contained in:
+8
-6
@@ -12,15 +12,16 @@ typedef enum {
|
||||
|
||||
typedef enum {
|
||||
ADD, SUB, JZ, INT, YLD, RET,
|
||||
CMP, NOP, JMP, CALL, LOAD, JE, INC, DEC, LOADB
|
||||
CMP, CMPI, NOP, JMP, CALL, LODW, LAA, LODWI, JE, INC, DEC, LOADB,
|
||||
STOB, STOW, JG, JL, AND, XOR, OR, NOT, SHR, SHL
|
||||
} Mnemonic;
|
||||
|
||||
typedef enum {
|
||||
NoParameter,
|
||||
ConstantParameter,
|
||||
AddressParameter,
|
||||
RegisterParameter,
|
||||
UnresolvedParameter
|
||||
NoParameter = 1,
|
||||
ConstantParameter = 2,
|
||||
AddressParameter = 4,
|
||||
RegisterParameter = 8,
|
||||
UnresolvedParameter = 16
|
||||
} OpcodeParameter;
|
||||
|
||||
typedef struct {
|
||||
@@ -45,6 +46,7 @@ Parameter* CreateParameter(OpcodeParameter parameterType);
|
||||
void FreeInstruction(Instruction* instruction);
|
||||
int IsOpcode(const char*, Mnemonic*);
|
||||
int IsRegister(const char*, Registers*);
|
||||
void ExpectParameters(Mnemonic mnemonic, OpcodeParameter* paramOne, OpcodeParameter* paramTwo);
|
||||
void GetMnemonicText(Mnemonic mnemonic, char buffer[12]);
|
||||
void GetRegisterText(Registers reg, char buffer[3]);
|
||||
unsigned char GetInstructionMask(Mnemonic type);
|
||||
|
||||
Reference in New Issue
Block a user