From f04a4a3c073b0f97039daa51c563ded9afb4a5d5 Mon Sep 17 00:00:00 2001 From: Michel Pollet Date: Wed, 14 Apr 2010 20:42:46 +0100 Subject: [PATCH] core: Fixes SBCI Thanks to Signed-off-by: Michel Pollet --- simavr/sim/sim_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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]; -- 2.39.5