fix indirect JMP bug where the high byte does not increment out of page
https://old.reddit.com/r/EmuDev/comments/15plfes/having_an_issue_with_nestest_on_my_6502_emulator/jvyck7k/ With this, it seems that all official opcodes run as nestest expects. Now, it's the unofficial opcodes that need to be implemented.
This commit is contained in:
parent
718f89c9c5
commit
4525490beb
7
cpu.c
7
cpu.c
@ -196,7 +196,7 @@ opcode_mem(enum addressing_mode mode)
|
|||||||
val = arg + regs.y;
|
val = arg + regs.y;
|
||||||
break;
|
break;
|
||||||
case AM_IND:
|
case AM_IND:
|
||||||
val = peek16(arg);
|
val = peek(arg) | (peek(((arg + 1) & 0xFF) | (arg & 0xFF00)) << 8);
|
||||||
break;
|
break;
|
||||||
case AM_IND_X:
|
case AM_IND_X:
|
||||||
val = peek((arg + regs.x) % 256) + peek((arg + regs.x + 1) % 256) * 256;
|
val = peek((arg + regs.x) % 256) + peek((arg + regs.x + 1) % 256) * 256;
|
||||||
@ -1308,9 +1308,10 @@ interpret(void)
|
|||||||
case 0x6c:
|
case 0x6c:
|
||||||
mode = AM_IND;
|
mode = AM_IND;
|
||||||
mem = peek16(regs.pc);
|
mem = peek16(regs.pc);
|
||||||
deref = peek(mem);
|
deref = peek16(mem);
|
||||||
arg = opcode_mem(mode);
|
arg = opcode_mem(mode);
|
||||||
jmp(deref);
|
deref = arg;
|
||||||
|
jmp(arg);
|
||||||
cycles += 6;
|
cycles += 6;
|
||||||
printf("JMP");
|
printf("JMP");
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user