diff --git a/cpu.c b/cpu.c index 51ab824..a2fea28 100644 --- a/cpu.c +++ b/cpu.c @@ -196,7 +196,7 @@ opcode_mem(enum addressing_mode mode) val = arg + regs.y; break; case AM_IND: - val = peek16(arg); + val = peek(arg) | (peek(((arg + 1) & 0xFF) | (arg & 0xFF00)) << 8); break; case AM_IND_X: val = peek((arg + regs.x) % 256) + peek((arg + regs.x + 1) % 256) * 256; @@ -1308,9 +1308,10 @@ interpret(void) case 0x6c: mode = AM_IND; mem = peek16(regs.pc); - deref = peek(mem); + deref = peek16(mem); arg = opcode_mem(mode); - jmp(deref); + deref = arg; + jmp(arg); cycles += 6; printf("JMP"); break;