diff options
Diffstat (limited to 'disasm.c')
-rw-r--r-- | disasm.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -159,9 +159,11 @@ static void disasm_ortho(struct sux *cpu, uint8_t opcode, uint8_t prefix, uint8_ memset(address, 0, sizeof(address)); memset(idx, 0, sizeof(idx)); memset(scale, 0, sizeof(scale)); + for (int i = 0; i < 2; i++) { int is_ind = 0; int is_rind = 0; + uint64_t val = 0; if (op[i].type) { uint8_t addr_size = get_ortho_addrsize(prefix, op[i].id); if (addr_size != 0xFF) { @@ -170,6 +172,8 @@ static void disasm_ortho(struct sux *cpu, uint8_t opcode, uint8_t prefix, uint8_ } if (op[i].id == MEM_SIB) { sprintf(scale[i], "%u*", op[i].scale+1); + } else if (op[i].id == MEM_IMM) { + val = read_value(cpu, 0, value[i], rs-1, 0, 0); } switch (op[i].id) { case MEM_ABSR : @@ -244,7 +248,7 @@ static void disasm_ortho(struct sux *cpu, uint8_t opcode, uint8_t prefix, uint8_ case 0: sprintf(opr[i], "%s%s%s", idx[i], sign[i], address[i]); break; case 1: sprintf(opr[i], "%s%s(%s)", idx[i], sign[i], address[i]); break; case 2: sprintf(opr[i], "(%s%s%s)", idx[i], sign[i], address[i]); break; - case 3: sprintf(opr[i], "#$%*"PRIX64, rs*2, op[i].value); break; + case 3: sprintf(opr[i], "#$%0*"PRIX64, rs*2, val); break; case 4: sprintf(opr[i], "%s", reg[i]); break; } } @@ -399,7 +403,7 @@ void disasm(struct sux *cpu, uint8_t lines, uint8_t opcode, uint8_t prefix, uint } else { inst_name = ortho_opname[opcode]; memcpy(op, inst_name, 3); - disasm_ortho(cpu, opcode, prefix, prefix2, ortho_addr, op, postfix, ortho_op, rs, thread); + disasm_ortho(cpu, opcode, prefix, prefix2, ortho_addr, op, postfix, ortho_op, (1 << rs), thread); } if (address == TX_ADDR || address == RX_ADDR) { |