From c7a4f0ed2b24d36d13c80af60ce536e3d44b7e0c Mon Sep 17 00:00:00 2001 From: bsekisser Date: Sun, 13 Oct 2013 13:09:53 -0400 Subject: [PATCH] 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 --- simavr/sim/sim_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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(); -- 2.39.5