From b1bc30528321335471c2bb2bf67040bbb6984850 Mon Sep 17 00:00:00 2001
From: Jeffrey Lee <jlee@gitlab.riscosopen.org>
Date: Wed, 3 Aug 2011 23:46:21 +0000
Subject: [PATCH] Add new OS_ReadSysInfo 6 items codes. Change naming of
 PublicWS values.

Detail:
  s/Middle - Added some new OS_ReadSysInfo 6 items which are needed by the zero page relocation kernel. Also duplicated some existing entries to avoid conflicts with ROL's allocations.
  hdr/OSRSI6, Makefile - New header listing OS_ReadSysInfo 6 items
  hdr/PublicWS - Duplicated the workspace definitions for &0-&4000, but with a 'Legacy_' prefix to their names. Also added some new entries as needed by the zero page relocation kernel. Once existing modules have been updated to use OS_ReadSysInfo & the Legacy_ definitions, the old defs will be removed.
  hdr/KernelWS - Removed 'Export_' prefix from all the exported workspace values, since the kernel can now use the original names directly
  hdr/Options - Dummy HiProcVecs option so merging things will be a bit cleaner
Admin:
  Tested in ROM softload on Iyonix


Version 5.35, 4.79.2.118. Tagged as 'Kernel-5_35-4_79_2_118'
---
 Makefile     |  11 ++++-
 VersionASM   |  10 ++---
 VersionNum   |  14 +++---
 hdr/KernelWS | 124 ++++++++++++++++++++++++++++++++-------------------
 hdr/OSRSI6   |  85 +++++++++++++++++++++++++++++++++++
 hdr/Options  |   3 ++
 hdr/PublicWS |  73 ++++++++++++++++++++++++++++++
 s/Middle     |  57 ++++++++++++++++++-----
 8 files changed, 305 insertions(+), 72 deletions(-)
 create mode 100644 hdr/OSRSI6

diff --git a/Makefile b/Makefile
index 7a5dd41..cc1e44c 100644
--- a/Makefile
+++ b/Makefile
@@ -66,11 +66,13 @@ EXPORTS   = ${EXP_HDR}.EnvNumbers \
             ${EXP_HDR}.HALEntries \
             ${EXP_HDR}.HALDevice \
             ${EXP_HDR}.OSEntries \
+            ${EXP_HDR}.OSRSI6 \
             ${C_EXP_HDR}.RISCOS \
             ${C_EXP_HDR}.HALEntries \
             ${C_EXP_HDR}.HALDevice \
             ${C_EXP_HDR}.OSEntries \
-            ${C_EXP_HDR}.Variables
+            ${C_EXP_HDR}.Variables \
+            ${C_EXP_HDR}.OSRSI6
 
 #
 # Generic rules:
@@ -168,6 +170,9 @@ ${EXP_HDR}.HALDevice: hdr.HALDevice
 ${EXP_HDR}.OSEntries: hdr.OSEntries
 	${CP} hdr.OSEntries $@ ${CPFLAGS}
 	
+${EXP_HDR}.OSRSI6: hdr.OSRSI6
+	${CP} hdr.OSRSI6 $@ ${CPFLAGS}
+	
 ${C_EXP_HDR}.RISCOS: hdr.RISCOS
 	${MKDIR} ${C_EXP_HDR}
 	${PERL} Build:Hdr2H hdr.RISCOS $@
@@ -188,6 +193,10 @@ ${C_EXP_HDR}.Variables: hdr.Variables
 	${MKDIR} ${C_EXP_HDR}
 	${PERL} Build:Hdr2H hdr.Variables $@
 
+${C_EXP_HDR}.OSRSI6: hdr.OSRSI6
+	${MKDIR} ${C_EXP_HDR}
+	${PERL} Build:Hdr2H hdr.OSRSI6 $@
+
 o.Global.h.HALDevice: hdr.HALDevice
 	${MKDIR} o.Global.h
 	dir o
diff --git a/VersionASM b/VersionASM
index 06f6c63..7db5f66 100644
--- a/VersionASM
+++ b/VersionASM
@@ -13,11 +13,11 @@
                         GBLS    Module_ComponentPath
 Module_MajorVersion     SETS    "5.35"
 Module_Version          SETA    535
-Module_MinorVersion     SETS    "4.79.2.117"
-Module_Date             SETS    "01 Aug 2011"
-Module_ApplicationDate  SETS    "01-Aug-11"
+Module_MinorVersion     SETS    "4.79.2.118"
+Module_Date             SETS    "04 Aug 2011"
+Module_ApplicationDate  SETS    "04-Aug-11"
 Module_ComponentName    SETS    "Kernel"
 Module_ComponentPath    SETS    "castle/RiscOS/Sources/Kernel"
-Module_FullVersion      SETS    "5.35 (4.79.2.117)"
-Module_HelpVersion      SETS    "5.35 (01 Aug 2011) 4.79.2.117"
+Module_FullVersion      SETS    "5.35 (4.79.2.118)"
+Module_HelpVersion      SETS    "5.35 (04 Aug 2011) 4.79.2.118"
                         END
diff --git a/VersionNum b/VersionNum
index f8b8cea..34c2111 100644
--- a/VersionNum
+++ b/VersionNum
@@ -5,19 +5,19 @@
  *
  */
 #define Module_MajorVersion_CMHG        5.35
-#define Module_MinorVersion_CMHG        4.79.2.117
-#define Module_Date_CMHG                01 Aug 2011
+#define Module_MinorVersion_CMHG        4.79.2.118
+#define Module_Date_CMHG                04 Aug 2011
 
 #define Module_MajorVersion             "5.35"
 #define Module_Version                  535
-#define Module_MinorVersion             "4.79.2.117"
-#define Module_Date                     "01 Aug 2011"
+#define Module_MinorVersion             "4.79.2.118"
+#define Module_Date                     "04 Aug 2011"
 
-#define Module_ApplicationDate          "01-Aug-11"
+#define Module_ApplicationDate          "04-Aug-11"
 
 #define Module_ComponentName            "Kernel"
 #define Module_ComponentPath            "castle/RiscOS/Sources/Kernel"
 
-#define Module_FullVersion              "5.35 (4.79.2.117)"
-#define Module_HelpVersion              "5.35 (01 Aug 2011) 4.79.2.117"
+#define Module_FullVersion              "5.35 (4.79.2.118)"
+#define Module_HelpVersion              "5.35 (04 Aug 2011) 4.79.2.118"
 #define Module_LibraryVersionInfo       "5:35"
diff --git a/hdr/KernelWS b/hdr/KernelWS
index d1fc748..55f01af 100644
--- a/hdr/KernelWS
+++ b/hdr/KernelWS
@@ -231,7 +231,11 @@ DANode_NodeSize   #     0
 
 ; The addresses below are only temporary; eventually most of them will be allocated at run time (we hope!)
 
+ [ HiProcVecs
+ZeroPage            * &FFFF0000
+ |
 ZeroPage            * &00000000
+ ]
 
  [ HAL
 ; Sort out 26/32 bit versions
@@ -819,20 +823,18 @@ TextExpandArea_Size * (8*1024)
 
                  # 2*4   ; SPARE (avoiding changes of exported addresses for now)
 
-;ScreenBlankFlag # 1     ; 0 => unblanked, 1 => blanked
+ScreenBlankFlag # 1     ; 0 => unblanked, 1 => blanked
 
-Export_ScreenBlankFlag      #       1
-        ASSERT  Export_ScreenBlankFlag =  ScreenBlankFlag
-        ASSERT ?Export_ScreenBlankFlag = ?ScreenBlankFlag
+        ASSERT  ScreenBlankFlag =  Legacy_ScreenBlankFlag
+        ASSERT ?ScreenBlankFlag = ?Legacy_ScreenBlankFlag
 
-;ScreenBlankDPMSState # 1       ; 0 => just blank video
-                                ; 1 => blank to stand-by (hsync off)
-                                ; 2 => blank to suspend (vsync off)
-                                ; 3 => blank to off (H+V off)
+ScreenBlankDPMSState # 1       ; 0 => just blank video
+                               ; 1 => blank to stand-by (hsync off)
+                               ; 2 => blank to suspend (vsync off)
+                               ; 3 => blank to off (H+V off)
 
-Export_ScreenBlankDPMSState      #       1
-        ASSERT  Export_ScreenBlankDPMSState =  ScreenBlankDPMSState
-        ASSERT ?Export_ScreenBlankDPMSState = ?ScreenBlankDPMSState
+        ASSERT  ScreenBlankDPMSState =  Legacy_ScreenBlankDPMSState
+        ASSERT ?ScreenBlankDPMSState = ?Legacy_ScreenBlankDPMSState
 
 
  [ AssemblingArthur :LAND: :DEF: ShowWS
@@ -840,13 +842,13 @@ Export_ScreenBlankDPMSState      #       1
  ]
         AlignSpace 64
 
-Export_FgEcfOraEor # 4*16      ; Interleaved zgora & zgeor
-        ASSERT  Export_FgEcfOraEor =  FgEcfOraEor
-        ASSERT ?Export_FgEcfOraEor = ?FgEcfOraEor
+FgEcfOraEor # 4*16      ; Interleaved zgora & zgeor
+        ASSERT  FgEcfOraEor =  Legacy_FgEcfOraEor
+        ASSERT ?FgEcfOraEor = ?Legacy_FgEcfOraEor
 
-Export_BgEcfOraEor # 4*16      ; Interleaved zgora & zgeor
-        ASSERT  Export_BgEcfOraEor =  BgEcfOraEor
-        ASSERT ?Export_BgEcfOraEor = ?BgEcfOraEor
+BgEcfOraEor # 4*16      ; Interleaved zgora & zgeor
+        ASSERT  BgEcfOraEor =  Legacy_BgEcfOraEor
+        ASSERT ?BgEcfOraEor = ?Legacy_BgEcfOraEor
 
 BgEcfStore  # 4*16      ; Interleaved zgora & zgeor to store background
 
@@ -999,7 +1001,9 @@ VDWSSize # 0
 ; locations used during reset only. Not cleared by ClearPhysRAM, but
 ; cleared later (just before DEFHAN).
 
-                ^       ZeroPage+&80    ; steer clear of FIQ code
+; Note that these are all relative to ZeroPage!
+
+                ^       &80             ; steer clear of FIQ code
 InitIRQHandler  #       4               ; pointer to IRQ handler (LDR PC'ed from IRQ HW vector)
 InitIRQWs       #       16              ; workspace for IRQ handler
 InitUsedStart   #       4               ; start of used pages (L2PT etc) not to be cleared
@@ -1011,33 +1015,36 @@ InitWsEnd       #       0
 
 ; Basic kernel space - defined locations for external modules
 
-                       ^       ZeroPage+&100
+                       ^       &100
 IRQ1V                  #       4       ; &100
 
-Export_ESC_Status      #       1       ; &104
-        ASSERT  Export_ESC_Status =  ESC_Status
-        ASSERT ?Export_ESC_Status = ?ESC_Status
+ESC_Status             #       1       ; &104
+        ASSERT  ESC_Status =  Legacy_ESC_Status
+        ASSERT ?ESC_Status = ?Legacy_ESC_Status
 
-Export_LatchBSoftCopy  #       1       ; &105
-        ASSERT  Export_LatchBSoftCopy =  LatchBSoftCopy
-        ASSERT ?Export_LatchBSoftCopy = ?LatchBSoftCopy
+LatchBSoftCopy         #       1       ; &105
+        ASSERT  LatchBSoftCopy =  Legacy_LatchBSoftCopy
+        ASSERT ?LatchBSoftCopy = ?Legacy_LatchBSoftCopy
 
 IOCControlSoftCopy     #       1       ; &106
 
-Export_CannotReset     #       1       ; &107
-        ASSERT  Export_CannotReset =  CannotReset
-        ASSERT ?Export_CannotReset = ?CannotReset
+CannotReset            #       1       ; &107
+        ASSERT  CannotReset =  Legacy_CannotReset
+        ASSERT ?CannotReset = ?Legacy_CannotReset
 
-Export_IRQsema         #       4       ; &108
-        ASSERT  Export_IRQsema =  IRQsema
-        ASSERT ?Export_IRQsema = ?IRQsema
+IRQsema                #       4       ; &108
+        ASSERT  IRQsema =  Legacy_IRQsema
+        ASSERT ?IRQsema = ?Legacy_IRQsema
 
 MetroGnome             #       4       ; &10C
+        ASSERT  MetroGnome =  Legacy_MetroGnome
+        ASSERT ?MetroGnome = ?Legacy_MetroGnome
+
 MemorySpeed            #       4       ; &110
 
-Export_MEMC_CR_SoftCopy #      4       ; &114
-        ASSERT  Export_MEMC_CR_SoftCopy =  MEMC_CR_SoftCopy
-        ASSERT ?Export_MEMC_CR_SoftCopy = ?MEMC_CR_SoftCopy
+MEMC_CR_SoftCopy       #      4       ; &114
+        ASSERT  MEMC_CR_SoftCopy =  Legacy_MEMC_CR_SoftCopy
+        ASSERT ?MEMC_CR_SoftCopy = ?Legacy_MEMC_CR_SoftCopy
 
 ResetIndirection        #      4       ; &118
 
@@ -1273,7 +1280,16 @@ ProcVecPreVeneers       #       ProcVecPreVeneersSize
 
         ASSERT  @ <= &300
                         #       (&300-@)
-Export_DebuggerSpace    #       16*8    ; Debugger module needs some zero page
+ [ :LNOT: HiProcVecs
+DebuggerSpace           #       16*8    ; Debugger module needs some zero page
+DebuggerSpace_Size      *       ?DebuggerSpace
+
+        ASSERT  DebuggerSpace =  Legacy_DebuggerSpace
+        ASSERT ?DebuggerSpace = ?Legacy_DebuggerSpace
+ |
+DebuggerSpace           *       &2000   ; Debugger gets a page all to itself!
+DebuggerSpace_Size      *       &1000
+ ]
 
 ; NVRAM support
 
@@ -1469,13 +1485,13 @@ PFIQasIRQ_Chain #       4
 
 EnvTime            #    5
 
-Export_RedirectInHandle   #    1
-        ASSERT  Export_RedirectInHandle =  RedirectInHandle
-        ASSERT ?Export_RedirectInHandle = ?RedirectInHandle
+RedirectInHandle   #    1
+        ASSERT  RedirectInHandle =  Legacy_RedirectInHandle
+        ASSERT ?RedirectInHandle = ?Legacy_RedirectInHandle
 
-Export_RedirectOutHandle  #    1
-        ASSERT  Export_RedirectOutHandle =  RedirectOutHandle
-        ASSERT ?Export_RedirectOutHandle = ?RedirectOutHandle
+RedirectOutHandle  #    1
+        ASSERT  RedirectOutHandle =  Legacy_RedirectOutHandle
+        ASSERT ?RedirectOutHandle = ?Legacy_RedirectOutHandle
 
 MOShasFIQ          #    1
 FIQclaim_interlock #    1
@@ -1613,6 +1629,8 @@ CachedErrorBlocks   #  4                ; pointer to sysheap node holding the er
 
                         ^       &FE8
 CLibCounter             #       1               ; Counter for Shared C Library tmpnam function
+        ASSERT  CLibCounter =  Legacy_CLibCounter
+        ASSERT ?CLibCounter = ?Legacy_CLibCounter
 
         AlignSpace
 
@@ -1622,18 +1640,26 @@ CLibCounter             #       1               ; Counter for Shared C Library t
 ; ROM libraries. They cannot use the private word since the block pointed
 ; to by this will be freed.
 RISCOSLibWord           #       4
+        ASSERT  RISCOSLibWord =  Legacy_RISCOSLibWord
+        ASSERT ?RISCOSLibWord = ?Legacy_RISCOSLibWord
+
 CLibWord                #       4
+        ASSERT  CLibWord =  Legacy_CLibWord
+        ASSERT ?CLibWord = ?Legacy_CLibWord
+
 FPEAnchor               #       4
+        ASSERT  FPEAnchor =  Legacy_FPEAnchor
+        ASSERT ?FPEAnchor = ?Legacy_FPEAnchor
 
-Export_DomainId                #       4       ; SKS added for domain identification
-        ASSERT  Export_DomainId =  DomainId
-        ASSERT ?Export_DomainId = ?DomainId
+DomainId                #       4       ; SKS added for domain identification
+        ASSERT  DomainId =  Legacy_DomainId
+        ASSERT ?DomainId = ?Legacy_DomainId
 
 Modula2_Private         #       4       ; MICK has FFC and uses it it in USR mode
 
-Export_VduDriverWorkSpace      #       VDWSSize
-        ASSERT  Export_VduDriverWorkSpace =  VduDriverWorkSpace
-        ASSERT ?Export_VduDriverWorkSpace = ?VduDriverWorkSpace
+VduDriverWorkSpace      #       VDWSSize
+        ASSERT  VduDriverWorkSpace =  Legacy_VduDriverWorkSpace
+        ASSERT ?VduDriverWorkSpace = ?Legacy_VduDriverWorkSpace
 
  ASSERT (VduDriverWorkSpace :AND: 63) = 0 ; For Tim (VDU5)
 
@@ -1809,7 +1835,11 @@ SvcTable                |#|     &400
  ASSERT SvcTable = &01F033FC ; Required for SVC table pokers, 1.20 compatible
  ]
  [ No26bitCode
+   [ ZeroPage = 0
 SWIDespatch_Size        *       32*4
+   |
+SWIDespatch_Size        *       33*4
+   ]
  |
 SWIDespatch_Size        *       30*4    ; can save 2 instructions if 26-bit (no Thumb)
  ]
diff --git a/hdr/OSRSI6 b/hdr/OSRSI6
new file mode 100644
index 0000000..e3cbc3c
--- /dev/null
+++ b/hdr/OSRSI6
@@ -0,0 +1,85 @@
+; Copyright 2011 Castle Technology Ltd
+;
+; Licensed under the Apache License, Version 2.0 (the "License");
+; you may not use this file except in compliance with the License.
+; You may obtain a copy of the License at
+;
+;     http://www.apache.org/licenses/LICENSE-2.0
+;
+; Unless required by applicable law or agreed to in writing, software
+; distributed under the License is distributed on an "AS IS" BASIS,
+; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+; See the License for the specific language governing permissions and
+; limitations under the License.
+;
+
+; OS_ReadSysInfo 6 values
+
+OSRSI6_CamEntriesPointer                       * 0
+OSRSI6_MaxCamEntry                             * 1
+OSRSI6_PageFlags_Unavailable                   * 2
+OSRSI6_PhysRamTable                            * 3
+OSRSI6_ARMA_Cleaner_flipflop                   * 4 ; Unused in HAL kernels
+OSRSI6_TickNodeChain                           * 5
+OSRSI6_ROMModuleChain                          * 6
+OSRSI6_DAList                                  * 7
+OSRSI6_AppSpaceDANode                          * 8
+OSRSI6_Module_List                             * 9
+OSRSI6_ModuleSHT_Entries                       * 10
+OSRSI6_ModuleSWI_HashTab                       * 11
+OSRSI6_IOSystemType                            * 12
+OSRSI6_L1PT                                    * 13
+OSRSI6_L2PT                                    * 14
+OSRSI6_UNDSTK                                  * 15
+OSRSI6_SVCSTK                                  * 16
+OSRSI6_SysHeapStart                            * 17
+
+; These are used by ROL, but conflict with our allocations
+
+OSRSI6_ROL_KernelMessagesBlock                 * 18
+OSRSI6_ROL_ErrorSemaphore                      * 19
+OSRSI6_ROL_MOSdictionary                       * 20
+OSRSI6_ROL_Timer_0_Latch_Value                 * 21
+OSRSI6_ROL_FastTickerV_Counts_Per_Second       * 22
+OSRSI6_ROL_VecPtrTab                           * 23
+OSRSI6_ROL_NVECTORS                            * 24
+OSRSI6_ROL_IRQSTK                              * 25
+OSRSI6_ROL_SWIDispatchTable                    * 26 ; JTABLE-SWIRelocation?
+OSRSI6_ROL_SWIBranchBack                       * 27 ; DirtyBranch?
+
+; Our allocations which conflict with the above
+
+OSRSI6_Danger_SWIDispatchTable                 * 18 ; JTABLE-SWIRelocation (Relocated base of OS SWI dispatch table)
+OSRSI6_Danger_Devices                          * 19 ; Relocated base of IRQ device head nodes
+OSRSI6_Danger_DevicesEnd                       * 20 ; Relocated end of IRQ device head nodes
+OSRSI6_Danger_IRQSTK                           * 21
+OSRSI6_Danger_SoundWorkSpace                   * 22 ; workspace (8K) and buffers (2*4K)
+OSRSI6_Danger_IRQsema                          * 23
+
+; Safe versions of the danger allocations
+; Only supported by OS 5.19+, so if backwards compatability is required code
+; should (safely!) fall back on the danger versions
+
+OSRSI6_SWIDispatchTable                        * 64 ; JTABLE-SWIRelocation (Relocated base of OS SWI dispatch table)
+OSRSI6_Devices                                 * 65 ; Relocated base of IRQ device head nodes
+OSRSI6_DevicesEnd                              * 66 ; Relocated end of IRQ device head nodes
+OSRSI6_IRQSTK                                  * 67
+OSRSI6_SoundWorkSpace                          * 68 ; workspace (8K) and buffers (2*4K)
+OSRSI6_IRQsema                                 * 69
+
+; New ROOL allocations
+
+OSRSI6_DomainId                                * 70 ; current Wimp task handle
+OSRSI6_OSByteVars                              * 71 ; OS_Byte vars (previously available via OS_Byte &A6/VarStart)
+OSRSI6_FgEcfOraEor                             * 72
+OSRSI6_BgEcfOraEor                             * 73
+OSRSI6_DebuggerSpace                           * 74
+OSRSI6_DebuggerSpace_Size                      * 75
+OSRSI6_CannotReset                             * 76
+OSRSI6_MetroGnome                              * 77 ; OS_ReadMonotonicTime
+OSRSI6_CLibCounter                             * 78
+OSRSI6_RISCOSLibWord                           * 79
+OSRSI6_CLibWord                                * 80
+OSRSI6_FPEAnchor                               * 81
+
+        END
diff --git a/hdr/Options b/hdr/Options
index 98614ac..7bd2379 100644
--- a/hdr/Options
+++ b/hdr/Options
@@ -356,6 +356,9 @@ GetMessages     SETS    "GET s.MsgCode"
 GetMessages     SETS    ""
               ]
 
+                GBLL    HiProcVecs              ; Relocate processor vectors and first 16K of workspace to &FFFF0000
+HiProcVecs      SETL    {FALSE} ; Coming soon!
+
                 GBLL    DebugForcedReset        ; debug forced hard resets
 DebugForcedReset SETL   {FALSE}
 
diff --git a/hdr/PublicWS b/hdr/PublicWS
index 5d9c772..9c3b36e 100644
--- a/hdr/PublicWS
+++ b/hdr/PublicWS
@@ -31,6 +31,16 @@ OldOpt  SETA    {OPT}
 ; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 ; Memory map values: (in address order)
 
+; These old definitions will be gone soon.
+        GBLL OldKernelWorkSpace
+ [ :DEF: AssemblingArthur
+OldKernelWorkSpace SETL :LNOT: AssemblingArthur
+ |
+OldKernelWorkSpace SETL {TRUE}
+ ]
+
+ [ OldKernelWorkSpace :LAND: {TRUE}
+
                     ^ &00000104
 ESC_Status          #         1
 
@@ -75,6 +85,69 @@ DomainId            #         4           ; domain identification
                     ^ &00001000
 VduDriverWorkSpace  #     &3000
 
+ ]
+
+; New 'legacy' definitions
+
+                           ^ &00000104
+Legacy_ESC_Status          #         1
+
+                           ^ &00000105
+Legacy_LatchBSoftCopy      #         1
+
+                           ^ &00000107
+Legacy_CannotReset         #         1
+
+                           ^ &00000108
+Legacy_IRQsema             #         4
+
+                           ^ &0000010C
+Legacy_MetroGnome          #         4
+
+                           ^ &00000114
+Legacy_MEMC_CR_SoftCopy    #         4
+
+                           ^ &00000300
+Legacy_DebuggerSpace       #      8*16
+
+                           ^ &0000047C
+Legacy_ScreenBlankFlag     #         1    ; 0 => unblanked, 1 => blanked
+
+                            ^ &0000047D
+Legacy_ScreenBlankDPMSState #        1    ; 0 => just blank video
+                                          ; 1 => blank to stand-by (hsync off)
+                                          ; 2 => blank to suspend (vsync off)
+                                          ; 3 => blank to off (H+V off)
+                           ^ &00000480
+Legacy_FgEcfOraEor         #      4*16    ; Interleaved zgora & zgeor (from Vdu Driver Workspace)
+
+                           ^ &000004C0
+Legacy_BgEcfOraEor         #      4*16    ; Interleaved zgora & zgeor (from Vdu Driver Workspace)
+
+                           ^ &00000AE1    ; RedirectInHandle
+Legacy_RedirectInHandle    #         1
+
+                           ^ &00000AE2    ; RedirectOutHandle
+Legacy_RedirectOutHandle   #         1
+
+                           ^ &00000FE8
+Legacy_CLibCounter         #         1
+
+                           ^ &00000FEC
+Legacy_RISCOSLibWord       #         4
+
+                           ^ &00000FF0
+Legacy_CLibWord            #         4
+
+                           ^ &00000FF4
+Legacy_FPEAnchor           #         4
+
+                           ^ &00000FF8
+Legacy_DomainId            #         4    ; domain identification
+
+                           ^ &00001000
+Legacy_VduDriverWorkSpace  #     &3000
+
                     ^ &00004000
 ScratchSpace        #     &4000
 
diff --git a/s/Middle b/s/Middle
index 6a03988..b0f952a 100644
--- a/s/Middle
+++ b/s/Middle
@@ -1825,30 +1825,63 @@ MachineAddressNVRAMError
         ExitSWIHandler
 
 osri6_table
-    DCD  CamEntriesPointer                            ;0
-    DCD  MaxCamEntry                                  ;1
+    DCD  ZeroPage+CamEntriesPointer                   ;0
+    DCD  ZeroPage+MaxCamEntry                         ;1
     DCD  PageFlags_Unavailable                        ;2
-    DCD  PhysRamTable                                 ;3
+    DCD  ZeroPage+PhysRamTable                        ;3
     DCD  0                                            ;4 (was ARMA_Cleaner_flipflop)
-    DCD  TickNodeChain                                ;5
-    DCD  ROMModuleChain                               ;6
-    DCD  DAList                                       ;7
-    DCD  AppSpaceDANode                               ;8
-    DCD  Module_List                                  ;9
-    DCD  ModuleSHT_Entries                            ;10
-    DCD  ModuleSWI_HashTab                            ;11
-    DCD  IOSystemType                                 ;12
+    DCD  ZeroPage+TickNodeChain                       ;5
+    DCD  ZeroPage+ROMModuleChain                      ;6
+    DCD  ZeroPage+DAList                              ;7
+    DCD  ZeroPage+AppSpaceDANode                      ;8
+    DCD  ZeroPage+Module_List                         ;9
+    DCD  ZeroPage+ModuleSHT_Entries                   ;10
+    DCD  ZeroPage+ModuleSWI_HashTab                   ;11
+    DCD  ZeroPage+IOSystemType                        ;12
     DCD  L1PT                                         ;13
     DCD  L2PT                                         ;14
     DCD  UNDSTK                                       ;15
     DCD  SVCSTK                                       ;16
     DCD  SysHeapStart                                 ;17
+    ; **DANGER** - this block conflicts with ROL's allocations
+    ; ROL use:
+    ; 18 = kernel messagetrans block
+    ; 19 = error semaphore
+    ; 20 = OS_PrettyPrint dictionary
+    ; 21 = Timer 0 latch value
+    ; 22 = FastTickerV counts per second
+    ; 23 = Vector claimants table
+    ; 24 = Number of vectors supported
+    ; 25 = IRQSTK
+    ; 26 = JTABLE-SWIRelocation
+    ; 27 = Address of branch back to OS after SWIs
     DCD  JTABLE-SWIRelocation                         ;18 - relocated base of OS SWI despatch table
     DCD  DefaultIRQ1V+(Devices-DefaultIRQ1Vcode)      ;19 - relocated base of IRQ device head nodes
     DCD  DefaultIRQ1V+(DevicesEnd-DefaultIRQ1Vcode)   ;20 - relocated end of IRQ device head nodes
     DCD  IRQSTK                                       ;21 - top of the IRQ stack
     DCD  SoundWorkSpace                               ;22 - workspace (8K) and buffers (2*4K)
-    DCD  IRQsema                                      ;23 - the address of the IRQ semaphore (may move if zero page is protected)
+    DCD  ZeroPage+IRQsema                             ;23 - the address of the IRQ semaphore
+    %    (256-(.-osri6_table))
+    ; Use 64+ for a repeat of the danger zone, and our new allocations
+    DCD  JTABLE-SWIRelocation                         ;64 - relocated base of OS SWI despatch table
+    DCD  DefaultIRQ1V+(Devices-DefaultIRQ1Vcode)      ;65 - relocated base of IRQ device head nodes
+    DCD  DefaultIRQ1V+(DevicesEnd-DefaultIRQ1Vcode)   ;66 - relocated end of IRQ device head nodes
+    DCD  IRQSTK                                       ;67 - top of the IRQ stack
+    DCD  SoundWorkSpace                               ;68 - workspace (8K) and buffers (2*4K)
+    DCD  ZeroPage+IRQsema                             ;69 - the address of the IRQ semaphore
+    ; New allocations
+    DCD  ZeroPage+DomainId                            ;70 - current Wimp task handle
+    DCD  ZeroPage+OsbyteVars-&A6                      ;71 - OS_Byte vars (previously available via OS_Byte &A6/VarStart)
+    DCD  ZeroPage+VduDriverWorkSpace+FgEcfOraEor      ;72
+    DCD  ZeroPage+VduDriverWorkSpace+BgEcfOraEor      ;73
+    DCD  DebuggerSpace                                ;74
+    DCD  DebuggerSpace_Size                           ;75
+    DCD  ZeroPage+CannotReset                         ;76
+    DCD  ZeroPage+MetroGnome                          ;77 - OS_ReadMonotonicTime
+    DCD  ZeroPage+CLibCounter                         ;78
+    DCD  ZeroPage+RISCOSLibWord                       ;79
+    DCD  ZeroPage+CLibWord                            ;80
+    DCD  ZeroPage+FPEAnchor                           ;81
 osri6_maxvalue * (.-4-osri6_table) :SHR: 2
 
 
-- 
GitLab