ok, fixed the remaining bugs, i pass all of nestest.asm now
thanks a lot to whoever wrote it!
the actual bugs were
1. overflow for sbc/adc was wrong
this is what i had originally
Code: Select all
static void cpu_updateOverflow(CPU cpu, Byte a, Byte b, Byte c) {
assert(cpu != NULL);
// positive // positive // negative
if ( ((a & MASK_BIT7) == MASK_BIT7) && ((b & MASK_BIT7) == MASK_BIT7) && ((c & MASK_BIT7) == 0) ) {
cpu_setOverflow(cpu, TRUE);
// negative // negative // positive
} else if ( ((a & MASK_BIT7) == 0) && ((b & MASK_BIT7) == 0) && ((c & MASK_BIT7) == MASK_BIT7) ) {
cpu_setOverflow(cpu, TRUE);
} else {
cpu_setOverflow(cpu, FALSE);
}
}
it still looks right to me, but apparently it was wrong. i did a rewrite based on the overflow stuff
here
2. jmp indirect wasn't wrapping around the low byte property
3. all the indirect,x functions weren't wrapping around the low byte properly
(i made the indirect y functions wrap too for now)