Changed format of inst_print

Prints the opcode then any operands in the following brackets
This commit is contained in:
2023-10-22 18:02:05 +01:00
parent 47c7d6baf7
commit e6339b1036

View File

@@ -145,17 +145,17 @@ data_type_t get_opcode_data_type(opcode_t opcode)
void inst_print(inst_t instruction, FILE *fp) void inst_print(inst_t instruction, FILE *fp)
{ {
fprintf(fp, "(%s", opcode_as_cstr(instruction.opcode)); fprintf(fp, "%s(", opcode_as_cstr(instruction.opcode));
if (OPCODE_IS_TYPE(instruction.opcode, OP_PUSH)) if (OPCODE_IS_TYPE(instruction.opcode, OP_PUSH))
{ {
data_type_t type = get_opcode_data_type(instruction.opcode); data_type_t type = get_opcode_data_type(instruction.opcode);
fprintf(fp, ", datum=0x"); fprintf(fp, "datum=0x");
data_print(instruction.operand, type, fp); data_print(instruction.operand, type, fp);
} }
else if (OPCODE_IS_TYPE(instruction.opcode, OP_PUSH_REGISTER) || else if (OPCODE_IS_TYPE(instruction.opcode, OP_PUSH_REGISTER) ||
OPCODE_IS_TYPE(instruction.opcode, OP_MOV)) OPCODE_IS_TYPE(instruction.opcode, OP_MOV))
{ {
fprintf(fp, ", reg=0x"); fprintf(fp, "reg=0x");
data_print(instruction.operand, DATA_TYPE_BYTE, fp); data_print(instruction.operand, DATA_TYPE_BYTE, fp);
} }
fprintf(fp, ")"); fprintf(fp, ")");