Commit f04a4a3c073b0f97039daa51c563ded9afb4a5d5
authorMichel Pollet <buserror@gmail.com>
Wed, 14 Apr 2010 19:42:46 +0000 (20:42 +0100)
committerMichel Pollet <buserror@gmail.com>
Wed, 14 Apr 2010 19:42:46 +0000 (20:42 +0100)
Thanks to <evgeny.chukreev@gmail.com>

Signed-off-by: Michel Pollet <buserror@gmail.com>
simavr/sim/sim_core.c

index 1ccae6b912bfb1e05a2d76f8cc25b6aceaf64a98..3901ede95a7dd8d2cc9edaf734fef8e2a7e50658 100644 (file)
@@ -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];