From d58ce17772fad6af4605aa53ce02e9470801c302 Mon Sep 17 00:00:00 2001
From: Robert Sprowson <rsprowson@gitlab.riscosopen.org>
Date: Sun, 28 Oct 2012 16:51:52 +0000
Subject: [PATCH] Review of Internation switch

Variously the call to TranslateError was either followed (outside the switch) by an unnecessary SETV, or missing SETV for the non international case.
Added DMA controller HAL device for IOMD.

Version 5.35, 4.79.2.174. Tagged as 'Kernel-5_35-4_79_2_174'
---
 Makefile        |  5 -----
 VersionASM      | 10 +++++-----
 VersionNum      | 14 +++++++-------
 hdr/HALDevice   |  2 ++
 s/ARM600        |  6 +++---
 s/ARMops        |  4 ++++
 s/Arthur3       |  3 ++-
 s/ArthurSWIs    | 12 +-----------
 s/ChangeDyn     | 34 ++++++++++++++++++++--------------
 s/Convrsions    | 12 ++----------
 s/MoreComms     |  3 +--
 s/MoreSWIs      | 12 ++++++++----
 s/Oscli         |  2 ++
 s/PMF/osbyte    |  4 ++--
 s/SysComms      |  3 ++-
 s/VMSAv6        |  6 +++---
 s/vdu/vdudriver |  3 ++-
 s/vdu/vdugrafh  |  5 +++--
 s/vdu/vdugrafj  |  7 ++++---
 s/vdu/vduswis   |  3 ++-
 20 files changed, 75 insertions(+), 75 deletions(-)

diff --git a/Makefile b/Makefile
index 129eff7..43ea0e4 100644
--- a/Makefile
+++ b/Makefile
@@ -101,7 +101,6 @@ install_rom: ${TARGET}
 
 clean:
 	${RM} s.TMOSHelp
-	${RM} s.Time+Date
 	${XWIPE} o.* ${WFLAGS}
 	${RM} ${TARGET}
 	${XWIPE} aif ${WFLAGS}
@@ -143,10 +142,6 @@ ${GPADBG}: ${AIFDBG}
 s.TMOSHelp: ${TOKENS} HelpStrs
 	${TOKENISE} ${TOKENS} HelpStrs $@
 
-#s.Time+Date:
-#        @echo |IGBLS Builddate|JBuilddate SETS "<Sys$Date> <Sys$Year>.<Sys$Time>" |J|IEND { > s.Time+Date }
-#        settype s.Time+Date FFF
-	
 o.GetAll: s.TMOSHelp
 
 #
diff --git a/VersionASM b/VersionASM
index 3cdf7c6..eeafefb 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.173"
-Module_Date             SETS    "14 Oct 2012"
-Module_ApplicationDate  SETS    "14-Oct-12"
+Module_MinorVersion     SETS    "4.79.2.174"
+Module_Date             SETS    "28 Oct 2012"
+Module_ApplicationDate  SETS    "28-Oct-12"
 Module_ComponentName    SETS    "Kernel"
 Module_ComponentPath    SETS    "castle/RiscOS/Sources/Kernel"
-Module_FullVersion      SETS    "5.35 (4.79.2.173)"
-Module_HelpVersion      SETS    "5.35 (14 Oct 2012) 4.79.2.173"
+Module_FullVersion      SETS    "5.35 (4.79.2.174)"
+Module_HelpVersion      SETS    "5.35 (28 Oct 2012) 4.79.2.174"
                         END
diff --git a/VersionNum b/VersionNum
index c312452..251fec7 100644
--- a/VersionNum
+++ b/VersionNum
@@ -5,19 +5,19 @@
  *
  */
 #define Module_MajorVersion_CMHG        5.35
-#define Module_MinorVersion_CMHG        4.79.2.173
-#define Module_Date_CMHG                14 Oct 2012
+#define Module_MinorVersion_CMHG        4.79.2.174
+#define Module_Date_CMHG                28 Oct 2012
 
 #define Module_MajorVersion             "5.35"
 #define Module_Version                  535
-#define Module_MinorVersion             "4.79.2.173"
-#define Module_Date                     "14 Oct 2012"
+#define Module_MinorVersion             "4.79.2.174"
+#define Module_Date                     "28 Oct 2012"
 
-#define Module_ApplicationDate          "14-Oct-12"
+#define Module_ApplicationDate          "28-Oct-12"
 
 #define Module_ComponentName            "Kernel"
 #define Module_ComponentPath            "castle/RiscOS/Sources/Kernel"
 
-#define Module_FullVersion              "5.35 (4.79.2.173)"
-#define Module_HelpVersion              "5.35 (14 Oct 2012) 4.79.2.173"
+#define Module_FullVersion              "5.35 (4.79.2.174)"
+#define Module_HelpVersion              "5.35 (28 Oct 2012) 4.79.2.174"
 #define Module_LibraryVersionInfo       "5:35"
diff --git a/hdr/HALDevice b/hdr/HALDevice
index 6b6b139..2b24462 100644
--- a/hdr/HALDevice
+++ b/hdr/HALDevice
@@ -127,11 +127,13 @@ HALDeviceID_DMAC_M5229          #       1
 HALDeviceID_DMAC_OMAP3          #       1
 HALDeviceID_DMAC_OMAP4          #       1
 HALDeviceID_DMAC_BCM2835        #       1
+HALDeviceID_DMAC_IOMD21         #       1
 
                                 ^       0
 HALDeviceID_DMAB_M1535          #       1
 HALDeviceID_DMAB_OMAP3          #       1
 HALDeviceID_DMAB_OMAP4          #       1
+HALDeviceID_DMAB_IOMD21         #       1
 
                                 ^       0
 HALDeviceID_DMAL_M5229          #       1
diff --git a/s/ARM600 b/s/ARM600
index b1c5351..b5e5bb9 100644
--- a/s/ARM600
+++ b/s/ARM600
@@ -2134,10 +2134,10 @@ MMUControl_Unknown
         ADRL    r0, ErrorBlock_HeapBadReason
  [ International
         BL      TranslateError
- ]
-        Pull    lr
+ |
         SETV
-        MOV     pc, lr
+ ]
+        Pull    "pc"
 
 
 MMUControl_ModifyControl ROUT
diff --git a/s/ARMops b/s/ARMops
index 18edf5a..da99c03 100644
--- a/s/ARMops
+++ b/s/ARMops
@@ -2245,7 +2245,11 @@ ARM_PrintProcessorType
         ADR     a2, PNameTable
         LDHA    a1, a2, a1, a3
         ADD     a1, a2, a1
+      [ International
         BL      Write0_Translated
+      |
+        SWI     XOS_Write0
+      ]
         SWI     XOS_NewLine
         SWI     XOS_NewLine
         Pull    "pc"
diff --git a/s/Arthur3 b/s/Arthur3
index 8cc7eeb..09054d5 100644
--- a/s/Arthur3
+++ b/s/Arthur3
@@ -1635,8 +1635,9 @@ statoptservice
         ADR     r0, %FT03
       [ International
         BL      TranslateError
-      ]
+      |
         SETV
+      ]
         Pull    "pc"
 03
         &       ErrorNumber_Syntax
diff --git a/s/ArthurSWIs b/s/ArthurSWIs
index 9db8f57..f78e3f4 100644
--- a/s/ArthurSWIs
+++ b/s/ArthurSWIs
@@ -126,31 +126,21 @@ ReadUnsigned_Routine Entry "r0-r1, r3-r6, r9"
 
 
 80      ADR     r2, ErrorBlock_NumbTooBig
-      [ International
-        B       %FT94
-      |
         B       %FT95
-      ]
 
 85      ADR     r2, ErrorBlock_BadNumb
-      [ International
-        B       %FT94
-      |
         B       %FT95
-      ]
 
 90      ADR     r2, ErrorBlock_BadBase
 
+95
       [ International
-94
         Push    "r0,lr"
         MOV     r0,r2
         BL      TranslateError
         MOV     r2,r0
         Pull    "r0,lr"
       ]
-
-95
         STR     r2, [stack]     ; Go set the current error
         MOV     r2, #0          ; Defined to return 0 on error
         TST     r11, #1 :SHL: 28
diff --git a/s/ChangeDyn b/s/ChangeDyn
index 4023df2..5463af5 100644
--- a/s/ChangeDyn
+++ b/s/ChangeDyn
@@ -1508,9 +1508,9 @@ UnknownDyn
         ADRL    r0, ErrorBlock_BadDynamicArea
  [ International
         BL      TranslateError
- ]
-90
+ |
         SETV
+ ]
         EXIT
 
 ;**************************************************************************
@@ -2078,8 +2078,9 @@ DynArea_Renumber ALTENTRY
         ADRL    r0, ErrorBlock_AreaAlreadyExists
  [ International
         BL      TranslateError
- ]
+ |
         SETV
+ ]
         EXIT
 
 ;if you think this is worth internationalising, I pity you
@@ -2289,9 +2290,10 @@ CheckForOverlappingAreas Entry "r0-r5"
         ADRL    r0, ErrorBlock_OverlappingAreas
  [ International
         BL      TranslateError
+ |
+        SETV
  ]
         STR     r0, [sp]
-        SETV
         EXIT
 
 ; Now, check against DAList
@@ -2414,9 +2416,10 @@ AllocateAreaAddress Entry "r0-r2,r4-r7"
         ADRL    r0, ErrorBlock_CantAllocateArea
   [ International
         BL      TranslateError
+  |
+        SETV
   ]
         STR     r0, [sp]
-        SETV
         EXIT                                    ; say we can't do it
 
         LTORG
@@ -2619,9 +2622,10 @@ AllocateBackingLevel2 Entry "r0-r8,r11"
         ADRL    r0, ErrorBlock_CantAllocateLevel2
   [ International
         BL      TranslateError
+  |
+        SETV
   ]
         STR     r0, [sp]
-        SETV
         EXIT
 
 ;**************************************************************************
@@ -3925,8 +3929,9 @@ DoTheGrowPageUnavailable ROUT
         ADR     r0, ErrorBlock_CantGetPhysMem
  [ International
         BL      TranslateError
- ]
+ |
         SETV
+ ]
         EXIT
 
         MakeErrorBlock  CantGetPhysMem
@@ -4572,9 +4577,10 @@ CheckAppSpace ROUT
 10
  [ International
         BL      TranslateError
+ |
+        SETV
  ]
         STR     r0, [sp]
-        SETV
         EXIT
 
 ; IF service call claimed Then Error AplWSpaceInUse
@@ -4641,7 +4647,6 @@ CallPreShrink Entry "r0,r3,r4, r12"
         BLEQ    TranslateError
  ]
         STR     r0, [sp]
-        SETV
         EXIT
 
 ; ***********************************************************************************
@@ -4706,13 +4711,12 @@ CallPreGrow Entry "r0,r4, r12"
         FastCDA_ProfEnd CallPreGrow, r12, r4, lr
         EXIT    VC                                      ; if no error then exit
 
-        TEQ     r0, #0                                  ; if generic error returned
+        TEQ     r0, #0                                  ; if generic error returned (V still set)
         ADREQL  r0, ErrorBlock_ChDynamNotAllMoved       ; then substitute real error message
  [ International
         BLEQ    TranslateError
  ]
         STR     r0, [sp]
-        SETV
         EXIT
 
 ; ***********************************************************************************
@@ -4774,7 +4778,7 @@ CallTestShrink Entry "r0,r4,r5, r12"
         SUBVC   lr, r5, #1
         BICVC   r3, r3, lr                              ; make page multiple
         EXIT    VC
-        TEQ     r0, #0                                  ; if generic error returned
+        TEQ     r0, #0                                  ; if generic error returned (V still set)
         ADREQL  r0, ErrorBlock_ChDynamNotAllMoved       ; then substitute real error message
  [ International
         BLEQ    TranslateError
@@ -4871,8 +4875,9 @@ UnknownHandlerError
         ADRL    r0, ErrorBlock_UnknownAreaHandler
   [ International
         BL      TranslateError
-  ]
+  |
         SETV
+  ]
         Pull    "pc"
 
 DynAreaHandler_Sprites
@@ -5004,9 +5009,10 @@ PreShrink_RAMDisc Entry "r0-r5"
         ADR     r0, ErrorBlock_RAMFsUnchangeable
  [ International
         BL      TranslateError
+ |
+        SETV
  ]
         STR     r0, [sp]
-        SETV
         EXIT
 
 90
diff --git a/s/Convrsions b/s/Convrsions
index d0ccfaa..edabf81 100644
--- a/s/Convrsions
+++ b/s/Convrsions
@@ -724,17 +724,9 @@ NetToDec
         SWI     XOS_ConvertCardinal1
         Pull    "pc"
 
-ErrorBlock_BadNetwork
-        DCD     ErrorNumber_BadNetwork
-        DCB     "BadNet"                ; The token for the Global message
-        DCB     0
-        ALIGN
+        MakeInternatErrorBlock BadNetwork,,BadNet
 
-ErrorBlock_BadStation
-        DCD     ErrorNumber_BadStation
-        DCB     "BadStn"                ; The token for the Global message
-        DCB     0
-        ALIGN
+        MakeInternatErrorBlock BadStation,,BadStn
 
 ; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 ; OS_ConvertStandardDateAndTime
diff --git a/s/MoreComms b/s/MoreComms
index 83372d1..4c107eb 100644
--- a/s/MoreComms
+++ b/s/MoreComms
@@ -547,8 +547,7 @@ BuildRMEnsureError
       [ International
         LDR     r4,[r3, #Module_Title]
         ADD     r4,r4,r3
-        BL      TranslateError_UseR4
-        SETV
+        BL      TranslateError_UseR4            ; => V set
         Pull    pc
       |
         BL      GetOscliBuffer
diff --git a/s/MoreSWIs b/s/MoreSWIs
index 2bf0e53..21af14c 100644
--- a/s/MoreSWIs
+++ b/s/MoreSWIs
@@ -582,9 +582,10 @@ RdItem    ROUT
       ADR    R0, ErrorBlock_ArgRepeated
     [ International
       BL     TranslateError
+    |
+      SETV
     ]
       ADD    stack, stack, #4 ; discard PSR
-      SETV
       Pull  "R1, R7, R8, PC"
 34
       ANDS   R12, R12, #SFlag
@@ -616,8 +617,9 @@ RdItem    ROUT
       ADR    R0, ErrorBlock_BadParameters
     [ International
       BL     TranslateError
-    ]
+    |
       SETV
+    ]
       Pull  "R1, R7, R8, PC"
 39
    ; copy arg until <" "
@@ -637,8 +639,9 @@ RdItem    ROUT
       ADRL   R0, ErrorBlock_BuffOverflow
     [ International
       BL     TranslateError
-    ]
+    |
       SETV
+    ]
       Pull  "R1, R7, R8, PC"
 
 04    CMP    R7, #""""
@@ -665,8 +668,9 @@ ohnoitsquotedargumentsagain
 08    ADRL   R0, ErrorBlock_BadString
     [ International
       BL     TranslateError
-    ]
+    |
       SETV
+    ]
       Pull  "R1, R7, R8, PC"
 
 ;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
diff --git a/s/Oscli b/s/Oscli
index 8afaa5e..529ff74 100644
--- a/s/Oscli
+++ b/s/Oscli
@@ -264,6 +264,8 @@ VecOsCli ROUT
          ADR       R0, ErrorBlock_OscliLongLine
        [ International
          BL        TranslateError
+       |
+         SETV
        ]
 RedirectionError
          BL        ReleaseBuff
diff --git a/s/PMF/osbyte b/s/PMF/osbyte
index d2d48eb..420ea37 100644
--- a/s/PMF/osbyte
+++ b/s/PMF/osbyte
@@ -77,7 +77,7 @@ OsByte
         CLRPSR  V_bit, R3                       ; clear V flag
 
         Pull    R0
-        ADRNE   R0, BadCommandError             ; not claimed, R0 -> error
+        ADRNE   R0, ErrorBlock_BadCommand       ; not claimed, R0 -> error
       [ International
         BLNE    TranslateError
       ]
@@ -86,7 +86,7 @@ OsByte
         ADD     SP,SP,#4
         Pull    "PC"
 
-BadCommandError MakeErrorBlock BadCommand
+        MakeErrorBlock BadCommand
 
 GoMyOsbyte
         CLRPSR  V_bit, R3
diff --git a/s/SysComms b/s/SysComms
index 1e8f5f6..d647b0d 100644
--- a/s/SysComms
+++ b/s/SysComms
@@ -594,8 +594,9 @@ helpnostack
         ADRL    R0, ErrorBlock_StackFull
       [ International
         BL      TranslateError
-      ]
+      |
         SETV
+      ]
         Pull   "R2-R6, pc"
 
 CallHelpKeywordCode
diff --git a/s/VMSAv6 b/s/VMSAv6
index b2af60e..988a1da 100644
--- a/s/VMSAv6
+++ b/s/VMSAv6
@@ -370,10 +370,10 @@ MMUControl_Unknown
         ADRL    r0, ErrorBlock_HeapBadReason
  [ International
         BL      TranslateError
- ]
-        Pull    lr
+ |
         SETV
-        MOV     pc, lr
+ ]
+        Pull    "pc"
 
 
 MMUControl_ModifyControl ROUT
diff --git a/s/vdu/vdudriver b/s/vdu/vdudriver
index ce8d771..3780b3a 100644
--- a/s/vdu/vdudriver
+++ b/s/vdu/vdudriver
@@ -1666,8 +1666,9 @@ ValidateModeSelector Entry
 90
   [ International
         BL      TranslateError
-  ]
+  |
         SETV
+  ]
         EXIT
 
         MakeErrorBlock BadMSFlags
diff --git a/s/vdu/vdugrafh b/s/vdu/vdugrafh
index 6df775a..4c8b91d 100644
--- a/s/vdu/vdugrafh
+++ b/s/vdu/vdugrafh
@@ -1180,10 +1180,11 @@ bounce_new_format_masks ROUT
         BL      MaskOffset              ; returns R0=mask size, EQ if no mask, NE if mask
         LDMEQFD R13!,{R0,R15}           ; out now if no mask
         ADRL    R0, SpriteErr_NoMaskOrPaletteAllowedInThisDepth
-        [ International
+      [ International
         BL      TranslateError
-        ]
+      |
         SETV
+      ]
         STR     R0,[R13]
         STR     R0,[WsPtr, #RetnReg0]
         LDMFD   R13!,{R0,R15}
diff --git a/s/vdu/vdugrafj b/s/vdu/vdugrafj
index b8a15b9..1c25ec7 100644
--- a/s/vdu/vdugrafj
+++ b/s/vdu/vdugrafj
@@ -1229,11 +1229,12 @@ WritePaletteFromSprite ROUT
         B       %FT40                   ;otherwise get on with it
 90
         ADRL    R0,SpriteErr_InvalidSpriteMode
-        [ International
+      [ International
         BL      TranslateError
-        ]
-        STR     R0, [WsPtr, #RetnReg0]
+      |
         SETV
+      ]
+        STR     R0, [WsPtr, #RetnReg0]
         Pull    "R0-R6,PC"
         |
 
diff --git a/s/vdu/vduswis b/s/vdu/vduswis
index ffdae21..54f1c00 100644
--- a/s/vdu/vduswis
+++ b/s/vdu/vduswis
@@ -887,8 +887,9 @@ FindOKMode ROUT
         ADRL    r0, ErrorBlock_ModeNotAvailable ; then return error
  [ International
         BL      TranslateError
- ]
+ |
         SETV                            ; error exit
+ ]
         Pull    "r2-r4,r10,r11, pc"
 
 SubstModeTable
-- 
GitLab