From afb1baa1f52a29418f11c048a37d02a67113e336 Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Tue, 8 Dec 2020 13:37:38 -0500 Subject: - Fixed a bug with the ortho extension implementation in the emulator. --- sux.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/sux.h b/sux.h index 6b8a7f6..4ba4862 100644 --- a/sux.h +++ b/sux.h @@ -900,7 +900,7 @@ static /*inline*/ void exec_ortho_inst(struct sux *cpu, uint8_t opcode, uint8_t operand op[2]; cpu->pc = get_ortho_addr(cpu, prefix, cpu->pc, op, address, op_type, op_id, 1, 1, thread); if (op[1].type) { - src = read_value(cpu, 0, op[1].value, size, 1, 1); + src = read_value(cpu, 0, address[1], size, 1, 1); } else { switch (op[1].id) { case REG_A : src = cpu->a; break; @@ -922,7 +922,7 @@ static /*inline*/ void exec_ortho_inst(struct sux *cpu, uint8_t opcode, uint8_t } } if (op[0].type) { - dst = read_value(cpu, 0, op[0].value, size, 1, 1); + dst = read_value(cpu, 0, address[0], size, 1, 1); } else { switch (op[0].id) { case REG_A : dst = cpu->a; break; @@ -1005,23 +1005,23 @@ static /*inline*/ void exec_ortho_inst(struct sux *cpu, uint8_t opcode, uint8_t case ORTHO_2OP(IDV): dst = idiv(cpu, dst, src, &rem, (op[0].type) ? size+1 : 8, thread); isdiv = 1; break; case ORTHO_2OP(LEA): do { - uint64_t address; + uint64_t addr; uint64_t mask; if (op[1].type) { uint8_t addr_size = get_ortho_addrsize(prefix, op[1].id); size = (!size) ? addr_size : size; - address = op[1].value; + addr = address[1]; } else { - address = src; + addr = src; } mask = (-(uint64_t)1 >> ((7 - size) * 8)); - dst = (address & mask); + dst = (addr & mask); } while (0); break; case ORTHO_1OP(PEA): do { - uint64_t address = (op[0].type) ? op[0].value : dst; - push(cpu, address, 7, thread); + uint64_t addr = (op[0].type) ? address[0] : dst; + push(cpu, addr, 7, thread); } while (0); break; case ORTHO_1OP(INC): dst = inc_dec(cpu, dst, size, 1, thread); break; @@ -1045,7 +1045,7 @@ static /*inline*/ void exec_ortho_inst(struct sux *cpu, uint8_t opcode, uint8_t } if (op[0].type) { - write_value(cpu, dst, op[0].value, size, 1, 1); + write_value(cpu, dst, address[0], size, 1, 1); } else { switch (op[0].id) { case REG_A : cpu->a = dst; break; @@ -1068,7 +1068,7 @@ static /*inline*/ void exec_ortho_inst(struct sux *cpu, uint8_t opcode, uint8_t } if (isdiv) { if (op[1].type) { - write_value(cpu, rem, op[1].value, size, 1, 1); + write_value(cpu, rem, address[1], size, 1, 1); } else { switch (op[1].id) { case REG_A : cpu->a = rem; break; -- cgit v1.2.3-13-gbd6f