summaryrefslogtreecommitdiff
path: root/disasm.c
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2021-04-04 12:39:34 -0400
committermrb0nk500 <b0nk@b0nk.xyz>2021-04-04 12:39:34 -0400
commit04cc80c19d763f6de4ef5c3baac5026e5e6969b3 (patch)
tree9407076966196a65faa786518a529f79daeefa76 /disasm.c
parent35a18609864470b3dc49f3a9a6cb6ec93e57300d (diff)
- 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.
Diffstat (limited to 'disasm.c')
-rw-r--r--disasm.c10
1 files changed, 8 insertions, 2 deletions
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 :