diff options
Diffstat (limited to 'disasm.c')
-rw-r--r-- | disasm.c | 7 |
1 files changed, 2 insertions, 5 deletions
@@ -51,10 +51,7 @@ void disasm(struct sux *cpu, uint8_t lines, uint8_t opcode, uint8_t prefix, uint case IMM : case REL : addrsize = (1 << rs)-1; break; } - - for (uint8_t i = 0; i < addrsize+1; i++) { - mask.u8[i] = (i == addrsize && addrsize != 0xFF) ? 0x7F : 0xFF; - } + mask.u64 = (-(uint64_t)1 >> ((7 - addrsize) * 8)); value = read_value(cpu, 0, cpu->pc, addrsize, 0, 0); if ((prefix >> 6) == 1 || (prefix >> 6) == 2 || optype[opcode] == REL) { switch (addrsize) { @@ -67,7 +64,7 @@ void disasm(struct sux *cpu, uint8_t lines, uint8_t opcode, uint8_t prefix, uint case 6 : case 7 : sign = ((int64_t)value < 0) ? "-" : "+"; break; } - value &= mask.u64; + value = (sign[0] == '-') ? (~value + 1) & mask.u64 : value; } switch (optype[opcode]) { case BREG: |