From 04cc80c19d763f6de4ef5c3baac5026e5e6969b3 Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Sun, 4 Apr 2021 12:39:34 -0400 Subject: - Fixed a bug to do with how SIB operands were parsed in the assembler. - Rewrote more of the SuB Suite to use the new calling convention. - Fixed a bug to do with SIB operands in the emulator's disassembler. - Made the MMV instruction not require a loop prefix for copying data. --- disasm.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'disasm.c') diff --git a/disasm.c b/disasm.c index 38770da..9e37646 100644 --- a/disasm.c +++ b/disasm.c @@ -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 : -- cgit v1.2.3-13-gbd6f