From 88c888e92c2ebb16f6ab645caf8e2c633bb9ac92 Mon Sep 17 00:00:00 2001
From: Ben Avison <bavison@gitlab.riscosopen.org>
Date: Fri, 12 May 2000 15:14:29 +0000
Subject: [PATCH] Improvement to the new callback functionality from version
 5.27.

Detail:
  In the previous version, Portable_Idle was called each time that the callback
  chain was examined. This is only desirable in cases where we're polling the
  keyboard, waiting before scrolling the text window; in the normal case, it's
  an unnecessary slow-down. Now fixed to only call Portable_Idle if we're
  waiting for a key up/down/timeout.
Admin:
  Not tested.

Version 5.28. Tagged as 'Kernel-5_28'
---
 VersionASM    |  8 ++++----
 VersionNum    | 14 +++++++-------
 s/vdu/vduwrch | 15 ++++++++++++---
 3 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/VersionASM b/VersionASM
index d67f3942..ab1d6c2f 100644
--- a/VersionASM
+++ b/VersionASM
@@ -6,9 +6,9 @@
                         GBLS    Module_MinorVersion
                         GBLS    Module_Date
                         GBLS    Module_FullVersion
-Module_MajorVersion     SETS    "5.27"
-Module_Version          SETA    527
+Module_MajorVersion     SETS    "5.28"
+Module_Version          SETA    528
 Module_MinorVersion     SETS    ""
-Module_Date             SETS    "10 May 2000"
-Module_FullVersion      SETS    "5.27"
+Module_Date             SETS    "12 May 2000"
+Module_FullVersion      SETS    "5.28"
                         END
diff --git a/VersionNum b/VersionNum
index 6eb31113..386e4639 100644
--- a/VersionNum
+++ b/VersionNum
@@ -1,15 +1,15 @@
-/* (5.27)
+/* (5.28)
  *
  * This file is automatically maintained by srccommit, do not edit manually.
  *
  */
-#define Module_MajorVersion_CMHG        5.27
+#define Module_MajorVersion_CMHG        5.28
 #define Module_MinorVersion_CMHG        
-#define Module_Date_CMHG                10 May 2000
+#define Module_Date_CMHG                12 May 2000
 
-#define Module_MajorVersion             "5.27"
-#define Module_Version                  527
+#define Module_MajorVersion             "5.28"
+#define Module_Version                  528
 #define Module_MinorVersion             ""
-#define Module_Date                     "10 May 2000"
+#define Module_Date                     "12 May 2000"
 
-#define Module_FullVersion              "5.27"
+#define Module_FullVersion              "5.28"
diff --git a/s/vdu/vduwrch b/s/vdu/vduwrch
index 02ada601..fcff2f8a 100644
--- a/s/vdu/vduwrch
+++ b/s/vdu/vduwrch
@@ -2724,7 +2724,7 @@ CSWaitLoop
         SEC                             ; set leds
         BL      CtrlShiftTest
         BCC     Page18
-        BLMI    Page_ProcessCallbacks
+        BLMI    Page_ProcessCallbacksIdle
         BMI     CSWaitLoop              ; and wait for change (NB C=1 now)
 Page18
         BL      PreWrchCursor           ; get rid of cursor again
@@ -2748,7 +2748,7 @@ Page30
         BCC     Page35                  ; CTRL no longer down
         LDROSB  R1, CentiCounter
         CMP     R1, #1
-        BLCS    Page_ProcessCallbacks
+        BLCS    Page_ProcessCallbacksIdle
         BCS     Page30                  ; loop with carry set
 Page35
         BL      PreWrchCursor           ; remove cursor again
@@ -2787,7 +2787,7 @@ Page50                                  ; NB C=0 on entry from above
 PageWaitLoop
         SEC
         BL      CtrlShiftTest
-        BLPL    Page_ProcessCallbacks
+        BLPL    Page_ProcessCallbacksIdle
         BPL     PageWaitLoop
         BL      PreWrchCursor
 
@@ -2838,6 +2838,15 @@ CtrlShiftTest ROUT
         MOV     PC, R14
 
 Page_ProcessCallbacks
+        Entry
+        ; See if there are any pending callbacks
+        MOV     R0, #0
+        LDRB    R14, [R0, #CallBack_Flag]
+        TST     R14, #CBack_VectorReq
+        BLNE    process_callback_chain
+        EXIT
+
+Page_ProcessCallbacksIdle
         EntryS                          ; routine must preserve flags
         ; See if there are any pending callbacks
         MOV     R0, #0
-- 
GitLab