From: bsekisser Date: Sun, 13 Oct 2013 17:09:53 +0000 (-0400) Subject: sim_core.c: fix implimentation of ror instruction X-Git-Tag: v1.1^2 X-Git-Url: https://git.htl-mechatronik.at/public/?a=commitdiff_plain;h=c7a4f0ed2b24d36d13c80af60ce536e3d44b7e0c;p=sx%2Fsimavr.git sim_core.c: fix implimentation of ror instruction prior implimentation just cleared n flag while specification states n should be set or cleared according to the most significant bit of the result. bug find credit goes to: Shay Green modified: simavr/sim/sim_core.c --- diff --git a/simavr/sim/sim_core.c b/simavr/sim/sim_core.c index 03d46ff..8e7af22 100644 --- a/simavr/sim/sim_core.c +++ b/simavr/sim/sim_core.c @@ -1118,7 +1118,7 @@ avr_flashaddr_t avr_run_one(avr_t * avr) _avr_set_r(avr, r, res); avr->sreg[S_Z] = res == 0; avr->sreg[S_C] = vr & 1; - avr->sreg[S_N] = 0; + avr->sreg[S_N] = res >> 7; avr->sreg[S_V] = avr->sreg[S_N] ^ avr->sreg[S_C]; avr->sreg[S_S] = avr->sreg[S_N] ^ avr->sreg[S_V]; SREG();