Updated the Instruction's structure and updated the Parser accordingly.
This commit is contained in:
+16
-2
@@ -37,12 +37,26 @@ Instruction* CreateInstruction(Mnemonic mnemonic) {
|
||||
}
|
||||
|
||||
instruction->Mnemonic = mnemonic;
|
||||
instruction->ParameterOneType = NoParameter;
|
||||
instruction->ParameterTwoType = NoParameter;
|
||||
// instruction->ParameterOne = CreateParameter(NoParameter);
|
||||
// instruction->ParameterTwo = CreateParameter(NoParameter);
|
||||
|
||||
return instruction;
|
||||
}
|
||||
|
||||
Parameter* CreateParameter(OpcodeParameter parameterType) {
|
||||
Parameter* param = calloc(1, sizeof(Parameter));
|
||||
|
||||
if (!param) {
|
||||
fprintf(stderr, "Failed to calloc room for a Parameter. %s,\n", strerror(errno));
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
param->ParameterType = parameterType;
|
||||
|
||||
return param;
|
||||
}
|
||||
|
||||
void FreeInstruction(Instruction* instruction) {
|
||||
if (!instruction) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user