From eacf838f0aff4db8ac748ed49905c1709c759225 Mon Sep 17 00:00:00 2001
From: Jeffrey Lee <jlee@gitlab.riscosopen.org>
Date: Sun, 11 Mar 2012 16:02:28 +0000
Subject: [PATCH] Select correct mouse type for IOMD systems

Detail:
  s/NewReset - When resetting the mouse type, for M_32 builds, check what IOMD version is fitted and select Quadrature/PS2 as appropriate
  Falls back to USB if no IOMD/unrecognised IOMD
Admin:
  Tested in IOMD softload on RiscPC


Version 5.35, 4.79.2.139. Tagged as 'Kernel-5_35-4_79_2_139'
---
 VersionASM | 10 +++++-----
 VersionNum | 14 +++++++-------
 s/NewReset | 27 +++++++++++++++++++++++++++
 3 files changed, 39 insertions(+), 12 deletions(-)

diff --git a/VersionASM b/VersionASM
index b005760..293b2d4 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.138"
-Module_Date             SETS    "25 Feb 2012"
-Module_ApplicationDate  SETS    "25-Feb-12"
+Module_MinorVersion     SETS    "4.79.2.139"
+Module_Date             SETS    "11 Mar 2012"
+Module_ApplicationDate  SETS    "11-Mar-12"
 Module_ComponentName    SETS    "Kernel"
 Module_ComponentPath    SETS    "castle/RiscOS/Sources/Kernel"
-Module_FullVersion      SETS    "5.35 (4.79.2.138)"
-Module_HelpVersion      SETS    "5.35 (25 Feb 2012) 4.79.2.138"
+Module_FullVersion      SETS    "5.35 (4.79.2.139)"
+Module_HelpVersion      SETS    "5.35 (11 Mar 2012) 4.79.2.139"
                         END
diff --git a/VersionNum b/VersionNum
index e24d50f..bc02520 100644
--- a/VersionNum
+++ b/VersionNum
@@ -5,19 +5,19 @@
  *
  */
 #define Module_MajorVersion_CMHG        5.35
-#define Module_MinorVersion_CMHG        4.79.2.138
-#define Module_Date_CMHG                25 Feb 2012
+#define Module_MinorVersion_CMHG        4.79.2.139
+#define Module_Date_CMHG                11 Mar 2012
 
 #define Module_MajorVersion             "5.35"
 #define Module_Version                  535
-#define Module_MinorVersion             "4.79.2.138"
-#define Module_Date                     "25 Feb 2012"
+#define Module_MinorVersion             "4.79.2.139"
+#define Module_Date                     "11 Mar 2012"
 
-#define Module_ApplicationDate          "25-Feb-12"
+#define Module_ApplicationDate          "11-Mar-12"
 
 #define Module_ComponentName            "Kernel"
 #define Module_ComponentPath            "castle/RiscOS/Sources/Kernel"
 
-#define Module_FullVersion              "5.35 (4.79.2.138)"
-#define Module_HelpVersion              "5.35 (25 Feb 2012) 4.79.2.138"
+#define Module_FullVersion              "5.35 (4.79.2.139)"
+#define Module_HelpVersion              "5.35 (11 Mar 2012) 4.79.2.139"
 #define Module_LibraryVersionInfo       "5:35"
diff --git a/s/NewReset b/s/NewReset
index b581981..56bdd98 100644
--- a/s/NewReset
+++ b/s/NewReset
@@ -938,9 +938,36 @@ not_full_reset
         BL      Write
 
  [ HAL
+     [ M_32
+; M_32 used for IOMD based machines, select quadrature or PS2 as appropriate
+        AddressHAL
+        MOV     R0, #0
+        MOV     R1, #&400
+        CallHAL HAL_ControllerAddress
+        CMP     R0, #0
+        MOVEQ   R1, #PointerDevice_USB
+        BEQ     program_mousetype
+        LDRB    R1, [R0, #IOMD_ID1]
+        LDRB    R0, [R0, #IOMD_ID0]
+        ORR     R0, R0, R1, LSL #8
+        LDR     R1, =IOMD_Original
+        TEQ     R0, R1
+        MOVEQ   R1, #PointerDevice_QuadMouse
+        BEQ     program_mousetype
+        LDR     R1, =IOMD_7500
+        TEQ     R0, R1
+        LDRNE   R1, =IOMD_7500FE
+        TEQNE   R0, R1
+        MOVEQ   R1, #PointerDevice_PS2Mouse
+        MOVNE   R1, #PointerDevice_USB
+program_mousetype
+        MOV     R0, #MouseCMOS
+        BL      Write
+     |
         MOV     R0, #MouseCMOS
         MOV     R1, #PointerDevice_USB
         BL      Write
+     ]
 
 ; set print and sound CMOS (16bit sound)
         MOV     R0, #TutuCMOS
-- 
GitLab