GitLab has been upgraded to 13.3.6. If you encounter any issues mail code@riscosopen.org

Commit 9d5ab8de authored by Timothy E Baldwin's avatar Timothy E Baldwin Committed by ROOL

Disable interrupts whilst checking for keys in OS_ReadC / INKEY

This ensures that on exit from OS_ReadC / INKEY either
a character is returned or the input buffer is empty,
and that Portable_Idle is only called when the input
buffer is empty.

This avoids a 10 microsecond delay and relying on timer
interrupts to make progress and allows reliably waiting
for input and another event by:

Disable Interrupts
Repeat
  Call INKEY(0), exit loop if key pressed
  Check other event, exit loop if key pressed
  Call Portable_Idle

Version 6.42. Tagged as 'Kernel-6_42'
parent fb127e47
...@@ -9,12 +9,12 @@ ...@@ -9,12 +9,12 @@
GBLS Module_ApplicationDate GBLS Module_ApplicationDate
GBLS Module_HelpVersion GBLS Module_HelpVersion
GBLS Module_ComponentName GBLS Module_ComponentName
Module_MajorVersion SETS "6.41" Module_MajorVersion SETS "6.42"
Module_Version SETA 641 Module_Version SETA 642
Module_MinorVersion SETS "" Module_MinorVersion SETS ""
Module_Date SETS "11 Jul 2020" Module_Date SETS "25 Jul 2020"
Module_ApplicationDate SETS "11-Jul-20" Module_ApplicationDate SETS "25-Jul-20"
Module_ComponentName SETS "Kernel" Module_ComponentName SETS "Kernel"
Module_FullVersion SETS "6.41" Module_FullVersion SETS "6.42"
Module_HelpVersion SETS "6.41 (11 Jul 2020)" Module_HelpVersion SETS "6.42 (25 Jul 2020)"
END END
/* (6.41) /* (6.42)
* *
* This file is automatically maintained by srccommit, do not edit manually. * This file is automatically maintained by srccommit, do not edit manually.
* *
*/ */
#define Module_MajorVersion_CMHG 6.41 #define Module_MajorVersion_CMHG 6.42
#define Module_MinorVersion_CMHG #define Module_MinorVersion_CMHG
#define Module_Date_CMHG 11 Jul 2020 #define Module_Date_CMHG 25 Jul 2020
#define Module_MajorVersion "6.41" #define Module_MajorVersion "6.42"
#define Module_Version 641 #define Module_Version 642
#define Module_MinorVersion "" #define Module_MinorVersion ""
#define Module_Date "11 Jul 2020" #define Module_Date "25 Jul 2020"
#define Module_ApplicationDate "11-Jul-20" #define Module_ApplicationDate "25-Jul-20"
#define Module_ComponentName "Kernel" #define Module_ComponentName "Kernel"
#define Module_FullVersion "6.41" #define Module_FullVersion "6.42"
#define Module_HelpVersion "6.41 (11 Jul 2020)" #define Module_HelpVersion "6.42 (25 Jul 2020)"
#define Module_LibraryVersionInfo "6:41" #define Module_LibraryVersionInfo "6:42"
...@@ -969,7 +969,7 @@ RdchInkey Entry ...@@ -969,7 +969,7 @@ RdchInkey Entry
; Enable interrupts so that keyboard can work properly ; Enable interrupts so that keyboard can work properly
WritePSRc SVC_mode, r1 CLI SVC32_mode
LDR r1, =ZeroPage LDR r1, =ZeroPage
LDRB r1, [r1, #RedirectInHandle] LDRB r1, [r1, #RedirectInHandle]
...@@ -1022,15 +1022,8 @@ RdchInkey Entry ...@@ -1022,15 +1022,8 @@ RdchInkey Entry
LDRB R5, [R5, #PortableFlags] ; 0 if not a portable, else Portable_Features result LDRB R5, [R5, #PortableFlags] ; 0 if not a portable, else Portable_Features result
RdchLoop RdchLoop
LDR R0, =ZeroPage ; Enable interrupts so that keyboard can work properly
LDRB R0, [R0, #ESC_Status] CLI SVC32_mode
MOVS R0, R0, LSL #(32-6) ; shift relevant bit into carry
MOVCS R0, #27 ; escape detected
BCS ReturnChar2
LDROSB R1, InputStream ; 0 => keyboard, 1 => RS423
BL RDCHG
BCC ReturnChar2
; Sam's hack to call the callback vector if appropriate ; Sam's hack to call the callback vector if appropriate
...@@ -1041,6 +1034,19 @@ RdchLoop ...@@ -1041,6 +1034,19 @@ RdchLoop
; here endeth the hack ; here endeth the hack
; Disable interrupts to prevent a race with Portable_Idle
SEI SVC32_mode
LDR R0, =ZeroPage
LDRB R0, [R0, #ESC_Status]
MOVS R0, R0, LSL #(32-6) ; shift relevant bit into carry
MOVCS R0, #27 ; escape detected
BCS ReturnChar2
LDROSB R1, InputStream ; 0 => keyboard, 1 => RS423
BL RDCHG
BCC ReturnChar2
TEQ R4, #0 ; EQ => inkey, NE => rdch TEQ R4, #0 ; EQ => inkey, NE => rdch
LDREQ R0, InkeyCounter ; if inkey LDREQ R0, InkeyCounter ; if inkey
TEQEQ R0, #0 ; and count expired TEQEQ R0, #0 ; and count expired
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment