Permalink
Browse files

CPU: Relative Jump ops must always increment PC after reading offset

  • Loading branch information...
1 parent 2d6ef53 commit e26339655564d52dd7bd31b402e1327bce0e2f66 @NTmatter committed Jan 16, 2013
Showing with 2 additions and 3 deletions.
  1. +2 −3 src/sys/cpu.c
View
@@ -626,12 +626,11 @@ CPU_OP(JPHL)
{ \
CPU_INSTRUCTION_PRE; \
state->cpu.m = 2; \
+ int8_t offset = (int8_t) mmu_rb(state, state->cpu.pc++); \
if(test) \
{ \
- state->cpu.pc += (int8_t) mmu_rb(state, state->cpu.pc); \
+ state->cpu.pc += offset; \
state->cpu.m++; \
- } else { \
- state->cpu.pc++; \
} \
CPU_INSTRUCTION_POST; \
}

0 comments on commit e263396

Please sign in to comment.