From 463a9ba268f11e75b309c3195011711400784714 Mon Sep 17 00:00:00 2001 From: Peter Evans Date: Sun, 4 Feb 2018 01:11:30 -0600 Subject: [PATCH] Handle all phase cases (zero and non-zero) --- src/apple2.dd.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/apple2.dd.c b/src/apple2.dd.c index 27763bf..d1e00cb 100644 --- a/src/apple2.dd.c +++ b/src/apple2.dd.c @@ -185,9 +185,13 @@ apple2_dd_phaser(apple2dd *drive) // We only want to respond to adjacent phases, so if the last phase // shifted in _any_ direction is not equal to the phase state, then // we should do nothing. - if (phase != (last << 1) || - phase != (last >> 1) - ) { + if (phase != 0 && (phase << 1) != last && (phase >> 1) != last) { + return; + } + + // The above check works for non-zero phases, but for zero phases, + // the logic is a bit different. + if (phase == 0 && last != 0x1 && last != 0x8) { return; }