From: Michel Pollet Date: Wed, 14 Apr 2010 19:42:46 +0000 (+0100) Subject: core: Fixes SBCI X-Git-Tag: v1.0a3~5 X-Git-Url: https://git.htl-mechatronik.at/public/?a=commitdiff_plain;h=f04a4a3c073b0f97039daa51c563ded9afb4a5d5;p=sx%2Fsimavr.git core: Fixes SBCI Thanks to Signed-off-by: Michel Pollet --- diff --git a/simavr/sim/sim_core.c b/simavr/sim/sim_core.c index 1ccae6b..3901ede 100644 --- a/simavr/sim/sim_core.c +++ b/simavr/sim/sim_core.c @@ -707,7 +707,8 @@ uint16_t avr_run_one(avr_t * avr) uint8_t res = vr - k - avr->sreg[S_C]; STATE("sbci %s[%02x], 0x%02x = %02x\n", avr_regname(r), avr->data[r], k, res); _avr_set_r(avr, r, res); - avr->sreg[S_Z] = res == 0; + if (res) + avr->sreg[S_Z] = 0; avr->sreg[S_N] = (res >> 7) & 1; avr->sreg[S_C] = (k + avr->sreg[S_C]) > vr; avr->sreg[S_S] = avr->sreg[S_N] ^ avr->sreg[S_V];