diff options
author | Maxwell Beck <max@rastertail.net> | 2024-12-28 13:15:30 -0600 |
---|---|---|
committer | Maxwell Beck <max@rastertail.net> | 2024-12-28 13:15:30 -0600 |
commit | 3b76eca83a34f92dc18e0046b90a5966711d556a (patch) | |
tree | db07e95542e6d380b772a592012975dac8402308 /src/pico1541.c | |
parent | 1f76e68525edc278998a1d94ae4acd0a9383069d (diff) |
Fix track stepping
Diffstat (limited to 'src/pico1541.c')
-rw-r--r-- | src/pico1541.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/pico1541.c b/src/pico1541.c index 5c16e0a..f76d8c3 100644 --- a/src/pico1541.c +++ b/src/pico1541.c @@ -69,9 +69,11 @@ void via_pb_write(via_t *via, uint8_t cycle) { } else if (via == &via2) { if ((via->ddrb & 3) == 3) { int8_t step = via->orb & 3; - if (step - track_step > 0) { + int8_t r = (step - track_step) % 4; + uint8_t mod = r < 0 ? r + 4 : r; + if (mod == 1) { drive_step_up(&drive); - } else if (step - track_step < 0) { + } else if (mod == 3) { drive_step_down(&drive); } track_step = step; |