From 000fafc5f1d7d80e05876068b25608ec9ff575c5 Mon Sep 17 00:00:00 2001
From: Owen Love <olove@gitlab.riscosopen.org>
Date: Wed, 4 Mar 1998 14:37:04 +0000
Subject: [PATCH] Merged Spinner branch changes (0.36 and 0.37) into the Trunk
 version.

---
 s/DeviceFS |  2 ++
 s/FSystem  | 23 ++++++++++++++---------
 2 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/s/DeviceFS b/s/DeviceFS
index 341d082..02afc3f 100644
--- a/s/DeviceFS
+++ b/s/DeviceFS
@@ -143,6 +143,8 @@
 ; 29-Apr-97 0.35 JRC Fix some logic errors; add 'fs' debug flag; use local error buffer.
 ;         (Spinner)
 ; 19-May-97 0.36 KJB Merge two version 0.35s.
+; 25-Feb-98 0.38 AR  Added checks to flush buffered output to avoid loops on blocked output (monitor TX) (from Spinner 0.36)
+; 25-Feb-98 0.38 RWB,AR Fix bug introduced by previous fix for printing. (from Spinner 0.37)
 ;
 
                 GET     hdr:ListOpts
diff --git a/s/FSystem b/s/FSystem
index 8922adc..68c0b88 100644
--- a/s/FSystem
+++ b/s/FSystem
@@ -25,8 +25,8 @@
 
 ; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
-
-
+flush		SETD	false	;debug for file flushing
+close		SETD	false	;sets the close debug flag, somehow not visable from version
 
 ; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 ;
@@ -1146,20 +1146,25 @@ args_eof        ENTRY   "r0,r1,r3-r6, fr"
 ; quick exit from these operations.
 ;
 
-args_flush      ENTRY   "r1-r3"
+args_flush      ENTRY   "r1-r3,fr"
 
+		Debug	flush, "Entered Flush"
                 LDR     r0, [r1, #file_Flags]
                 TST     r0, #ff_FileForTX                       ; is the file an output object
                 EXITS   EQ                                      ; no, so return now
+                MOV     fr, r1
 10
-                BL      checkescape
-                BLVC    checkeof                                ; loop until EOF or Escape pressed
-                PullEnv VS
-                ORRVSS  pc, lr, #V_bit                          ; return the error (if one)
-                BCC     %BT10                                   ; if C clear then still no end of data
+                BL      checkeof                                ; CS = exit loop until EOF or Escape pressed
+		DebugIf CS, flush, "Exited  Flush EOF"
+                EXITS	CS					; normal exit eof found
 
-                EXITS                                           ; and then restore flags
+                BLVC    checkescape				; VS = exit not always enabled
+                BLVC	checkfileTXOK				; VS = exit Monitor TX for errors call 12.
 
+		DebugE  flush, "Exited  Flush forced exit"
+                PullEnv VS
+                ORRVSS  pc, lr, #V_bit                          ; return the error (if one)
+                B       %BT10                                   ; if C clear then still no end of data
 
 ; get load and exec address of a stream and return them back to the caller.
 ;
-- 
GitLab