From 070f8d8bc3a5b699e9fbc37c33bae137a9cffb78 Mon Sep 17 00:00:00 2001
From: Thomas Harte <thomas.harte@gmail.com>
Date: Tue, 12 Dec 2023 09:29:28 -0500
Subject: [PATCH] Simplify control flow.

---
 Machines/PCCompatible/PCCompatible.cpp         | 18 ++++++------------
 .../xcschemes/Clock Signal.xcscheme            |  2 +-
 2 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/Machines/PCCompatible/PCCompatible.cpp b/Machines/PCCompatible/PCCompatible.cpp
index 57504d156..c51648cef 100644
--- a/Machines/PCCompatible/PCCompatible.cpp
+++ b/Machines/PCCompatible/PCCompatible.cpp
@@ -152,28 +152,22 @@ class FloppyController {
 							const auto sector = drives_[decoder_.target().drive].sector(target.head, target.sector);
 
 							if(sector) {
-								bool wrote_in_full = true;
-
 								for(int c = 0; c < 128 << target.size; c++) {
 									const auto access_result = dma_.write(2, sector->samples[0].data()[c]);
 									switch(access_result) {
-										default: break;
+										// Default: keep going.
+										default: continue;
+
+										// Anything else: update flags and exit.
 										case AccessResult::NotAccepted:
 											complete = true;
-											wrote_in_full = false;
+											status_.set(Intel::i8272::Status1::OverRun);
+											status_.set(Intel::i8272::Status0::AbnormalTermination);
 										break;
 										case AccessResult::AcceptedWithEOP:
 											complete = true;
 										break;
 									}
-									if(access_result != AccessResult::Accepted) {
-										break;
-									}
-								}
-
-								if(!wrote_in_full) {
-									status_.set(Intel::i8272::Status1::OverRun);
-									status_.set(Intel::i8272::Status0::AbnormalTermination);
 									break;
 								}
 
diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/xcshareddata/xcschemes/Clock Signal.xcscheme b/OSBindings/Mac/Clock Signal.xcodeproj/xcshareddata/xcschemes/Clock Signal.xcscheme
index 19b54b90e..474fa352e 100644
--- a/OSBindings/Mac/Clock Signal.xcodeproj/xcshareddata/xcschemes/Clock Signal.xcscheme	
+++ b/OSBindings/Mac/Clock Signal.xcodeproj/xcshareddata/xcschemes/Clock Signal.xcscheme	
@@ -62,7 +62,7 @@
       </Testables>
    </TestAction>
    <LaunchAction
-      buildConfiguration = "Release"
+      buildConfiguration = "Debug"
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
       enableASanStackUseAfterReturn = "YES"