summaryrefslogtreecommitdiff
path: root/cpu.c
diff options
context:
space:
mode:
Diffstat (limited to 'cpu.c')
-rw-r--r--cpu.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/cpu.c b/cpu.c
index bcaa00b..b76e346 100644
--- a/cpu.c
+++ b/cpu.c
@@ -472,7 +472,7 @@ jmp(uint16_t arg)
static void
jsr(uint16_t arg)
{
- uint16_t tmp = regs.pc;
+ uint16_t tmp = regs.pc - 1;
/*
* first push high-byte of return address then low-byte
@@ -651,13 +651,13 @@ static void
rti(void)
{
plp();
- regs.pc = PULL();
+ regs.pc = PULL() | (PULL() << 8);
}
static void
rts(void)
{
- regs.pc = PULL() | (PULL() << 8);
+ regs.pc = (PULL() | (PULL() << 8)) + 1;
}
static void