From f48cad692111f6a9d3afcb75343365bff6247331 Mon Sep 17 00:00:00 2001
From: Ben Avison <bavison@gitlab.riscosopen.org>
Date: Wed, 4 Aug 1999 14:15:16 +0000
Subject: [PATCH] Doing all of recalcmodevars on Service_ModeChanging turns out
 to be a Bad Idea because some of the Wimp's copies of VDU variables end up
 out-of-date. Now only the parts pertaining to command windows are done on
 Service_ModeChanging

(for that was the bit we were having trouble with), and the rest is back on
Service_ModeChange.

Version 4.24. Tagged as 'Wimp-4_24'
---
 VersionASM |  8 ++++----
 VersionNum | 14 +++++++-------
 s/Wimp01   | 13 +++++++++++--
 3 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/VersionASM b/VersionASM
index 05fb6d1..71196f2 100644
--- a/VersionASM
+++ b/VersionASM
@@ -6,9 +6,9 @@
 			GBLS	Module_MinorVersion
 			GBLS	Module_Date
 			GBLS	Module_FullVersion
-Module_MajorVersion	SETS    "4.23"
-Module_Version          SETA    423
+Module_MajorVersion	SETS    "4.24"
+Module_Version          SETA    424
 Module_MinorVersion	SETS	""
-Module_Date		SETS    "03 Aug 1999"
-Module_FullVersion      SETS    "4.23"
+Module_Date		SETS    "04 Aug 1999"
+Module_FullVersion      SETS    "4.24"
                         END
diff --git a/VersionNum b/VersionNum
index 4b4c75a..8f8983b 100644
--- a/VersionNum
+++ b/VersionNum
@@ -1,15 +1,15 @@
-/* (4.23)
+/* (4.24)
  *
  * This file is automatically maintained by srccommit, do not edit manually.
  *
  */
-#define Module_MajorVersion_CMHG     	4.23
+#define Module_MajorVersion_CMHG     	4.24
 #define Module_MinorVersion_CMHG	
-#define Module_Date_CMHG      		03 Aug 1999
+#define Module_Date_CMHG      		04 Aug 1999
 
-#define Module_MajorVersion     	"4.23"
-#define Module_Version                  423
+#define Module_MajorVersion     	"4.24"
+#define Module_Version                  424
 #define Module_MinorVersion		""
-#define Module_Date      		"03 Aug 1999"
+#define Module_Date      		"04 Aug 1999"
 
-#define Module_FullVersion              "4.23"
+#define Module_FullVersion              "4.24"
diff --git a/s/Wimp01 b/s/Wimp01
index 45c4374..ae54436 100644
--- a/s/Wimp01
+++ b/s/Wimp01
@@ -3537,6 +3537,7 @@ ServiceTable
         ]                                               ;
         DCD     Service_Reset                   ; &27   ;
         DCD     Service_NewApplication          ; &2A   ;
+        DCD     Service_ModeChange              ; &46   ;
         [ :LNOT: UseAMBControl                          ;
         DCD     Service_MemoryMoved             ; &4E   ;
         ]                                               ; must be in ascending order
@@ -3568,6 +3569,7 @@ Service
         TEQ     R1, #Service_Reset
         ]
         TEQNE   R1, #Service_NewApplication
+        TEQNE   R1, #Service_ModeChange
         [ :LNOT: UseAMBControl
         TEQNE   R1, #Service_MemoryMoved
         ]
@@ -3639,6 +3641,8 @@ Service2
         TEQ     R1, #Service_SwitchingOutputToSprite
         BEQ     switchingtosprite
       ]
+        TEQ     R1,#Service_ModeChange
+        BEQ     recalcmodevars
         TEQ     R1,#Service_ResourceFSStarting  ; redeclare resource files
         BEQ     serviceresourcefsstarting
         TEQ     R1,#Service_ResourceFSStarted   ; re-link to sprite file
@@ -3648,7 +3652,7 @@ Service2
         TEQ     R1,#Service_InvalidateCache     ; ColourTrans changed palette
         BEQ     invalidatecache
         TEQ     R1,#Service_ModeChanging
-        BEQ     recalcmodevars
+        BEQ     releasewrchvpremodechange
         TEQ     R1,#Service_Reset
         MOVNE   PC,LR
 
@@ -3827,7 +3831,7 @@ switchingtosprite_recache
         EXITS
   ]
 
-; Service_ModeChanging: cache new graphics parameters
+; Service_ModeChange: cache new graphics parameters
 
 recalcmodevars
         Push    "LR"
@@ -3849,7 +3853,12 @@ recalcmodevars
         TEQ     R14,#0
         BLNE    recalc_greys_palette
         ]
+        Pull    "PC"
 
+; Service_ModeChanging: get off wrchv if necessary
+
+releasewrchvpremodechange
+        Push    "LR"
 ; medusa may require the write character vector to be reset.
 
         LDR     R14,commandflag
-- 
GitLab