the avr instruction manual states that overflow be set _before_ the operation takes place, however the core tests based on the result. values checked adjusted accordingly.
bug find credit goes to: Shay Green <gblargg@gmail.com>
_avr_set_r(avr, r, res);
avr->sreg[S_Z] = res == 0;
avr->sreg[S_N] = res >> 7;
- avr->sreg[S_V] = res == 0x7f;
+ avr->sreg[S_V] = res == 0x80;
avr->sreg[S_S] = avr->sreg[S_N] ^ avr->sreg[S_V];
SREG();
} break;
_avr_set_r(avr, r, res);
avr->sreg[S_Z] = res == 0;
avr->sreg[S_N] = res >> 7;
- avr->sreg[S_V] = res == 0x80;
+ avr->sreg[S_V] = res == 0x7f;
avr->sreg[S_S] = avr->sreg[S_N] ^ avr->sreg[S_V];
SREG();
} break;