diff options
Diffstat (limited to 'disasm.c')
-rw-r--r-- | disasm.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -253,7 +253,7 @@ static int is_2op(uint8_t opcode) { static void disasm_ortho(struct sux *cpu, WINDOW *w, uint8_t opcode, uint8_t prefix, uint8_t prefix2, uint64_t *value, char *inst_name, char *postfix, operand *op, uint8_t rs, uint8_t thread) { char opr[2][256]; - char address[2][17]; + char address[2][18]; char *rind[2] = {"", ""}; char *sign[2] = {"", ""}; char *ind[2] = {"", ""}; @@ -313,7 +313,13 @@ static void disasm_ortho(struct sux *cpu, WINDOW *w, uint8_t opcode, uint8_t pre } } } - sprintf(idx[i], "%s%s%s%s", scale[i], rind[0], (op[i].rind[1] != 0xFF) ? "+" : "", rind[1]); + + if (op[i].rind[1] == 0xFF) { + rind[1] = (op[i].id == MEM_SIB) ? rind[0] : rind[1]; + rind[0] = (op[i].id == MEM_SIB) ? "" : rind[0]; + } + + sprintf(idx[i], "%s%s%s%s", rind[0], (op[i].rind[1] != 0xFF) ? "+" : "", scale[i], rind[1]); switch (op[i].id) { case MEM_AINDR: case MEM_AIND : |