From 5f93bdae259810c5aedb0457efeb06c64c00e11c Mon Sep 17 00:00:00 2001 From: Peter Evans Date: Sun, 21 Jan 2018 01:17:04 -0600 Subject: [PATCH] Try to match technical behavior described for JSR/RTS --- src/mos6502.exec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mos6502.exec.c b/src/mos6502.exec.c index 14146a7..437558c 100644 --- a/src/mos6502.exec.c +++ b/src/mos6502.exec.c @@ -37,7 +37,7 @@ DEFINE_INST(jmp) */ DEFINE_INST(jsr) { - vm_16bit pc3 = cpu->PC + 3; + vm_16bit pc3 = cpu->PC + 2; mos6502_push_stack(cpu, pc3 >> 8); mos6502_push_stack(cpu, pc3 & 0xff); @@ -72,4 +72,5 @@ DEFINE_INST(rts) { cpu->PC = mos6502_pop_stack(cpu); cpu->PC |= mos6502_pop_stack(cpu) << 8; + cpu->PC++; }