From 8ce46b6e498d7227c947263e4d2821e2f8708fcc Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 20 Aug 2017 10:32:09 -0400 Subject: [PATCH] Having spotted that I was using my single-character loop counter names incorrectly (quelle surprise!), got a bit more explicit. Also flattened into a single loop so that I can break rather than returning. --- Components/8272/i8272.cpp | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/Components/8272/i8272.cpp b/Components/8272/i8272.cpp index 5a1958dbb..96b50e73e 100644 --- a/Components/8272/i8272.cpp +++ b/Components/8272/i8272.cpp @@ -129,19 +129,20 @@ void i8272::run_for(Cycles cycles) { // check for any head unloads if(head_timers_running_) { int timers_left = head_timers_running_; - for(int c = 0; c < 4; c++) { - for(int h = 0; h < 2; h++) { - if(drives_[c].head_unload_delay[c] > 0) { - if(cycles.as_int() >= drives_[c].head_unload_delay[c]) { - drives_[c].head_unload_delay[c] = 0; - drives_[c].head_is_loaded[c] = false; - head_timers_running_--; - } else { - drives_[c].head_unload_delay[c] -= cycles.as_int(); - } - timers_left--; - if(!timers_left) return; + for(int c = 0; c < 8; c++) { + int drive = (c >> 1); + int head = c&1; + + if(drives_[drive].head_unload_delay[head] > 0) { + if(cycles.as_int() >= drives_[drive].head_unload_delay[head]) { + drives_[drive].head_unload_delay[head] = 0; + drives_[drive].head_is_loaded[head] = false; + head_timers_running_--; + } else { + drives_[drive].head_unload_delay[head] -= cycles.as_int(); } + timers_left--; + if(!timers_left) break; } } }