Commit bcb499b5 authored by Jeffrey Lee's avatar Jeffrey Lee
Browse files

Add support for new extended internal key codes, low level key codes, and key handler format

Detail:
  s/Middle - Added OS_ReadSysInfo 13 to allow the kernel to validate a key handler before the owner attempts to install it
  Resources/UK/Messages - Text for new "Bad key handler" error
  s/GetAll, s/PMF/Def - Get rid of now obsolete s/PMF/Def file. It only contained definitions for pre-HAL hardware, and for the key handler layout (now in Hdr:Keyboard)
  hdr/KeyWS - Increased size of KeysDown array so it can hold 768 keys instead of 160. Trim a couple of obsolete variables, and increase CurrKey/OldKey from 1 byte to 4 bytes.
  s/PMF/key, s/PMF/osbyte - Main bulk of the changes for the new key handling. All the important interfaces are now able to deal with extended (i.e. > 8 bit) internal key numbers, and the kernel is able to cope with key handlers which use 16 bit internal/low level key numbers instead of 8 bit.
Admin:
  Tested on Pandora & BB-xM
  Requires HdrSrc-2_20


Version 5.35, 4.79.2.178. Tagged as 'Kernel-5_35-4_79_2_178'
parent 80d476ae
......@@ -163,6 +163,7 @@ SNoMask:Mask or Palette operations not supported in this display depth
BadVIDCDiv:Bad VIDC divider value
BadPlatReas:Unknown OS_PlatformFeatures reason code
UnConv:Unsupported conversion
BadKeyHandler:Bad key handler
600:ARM 600 Processor
610:ARM 610 Processor
......
......@@ -13,11 +13,11 @@
GBLS Module_ComponentPath
Module_MajorVersion SETS "5.35"
Module_Version SETA 535
Module_MinorVersion SETS "4.79.2.177"
Module_Date SETS "21 Nov 2012"
Module_ApplicationDate SETS "21-Nov-12"
Module_MinorVersion SETS "4.79.2.178"
Module_Date SETS "05 Dec 2012"
Module_ApplicationDate SETS "05-Dec-12"
Module_ComponentName SETS "Kernel"
Module_ComponentPath SETS "castle/RiscOS/Sources/Kernel"
Module_FullVersion SETS "5.35 (4.79.2.177)"
Module_HelpVersion SETS "5.35 (21 Nov 2012) 4.79.2.177"
Module_FullVersion SETS "5.35 (4.79.2.178)"
Module_HelpVersion SETS "5.35 (05 Dec 2012) 4.79.2.178"
END
......@@ -5,19 +5,19 @@
*
*/
#define Module_MajorVersion_CMHG 5.35
#define Module_MinorVersion_CMHG 4.79.2.177
#define Module_Date_CMHG 21 Nov 2012
#define Module_MinorVersion_CMHG 4.79.2.178
#define Module_Date_CMHG 05 Dec 2012
#define Module_MajorVersion "5.35"
#define Module_Version 535
#define Module_MinorVersion "4.79.2.177"
#define Module_Date "21 Nov 2012"
#define Module_MinorVersion "4.79.2.178"
#define Module_Date "05 Dec 2012"
#define Module_ApplicationDate "21-Nov-12"
#define Module_ApplicationDate "05-Dec-12"
#define Module_ComponentName "Kernel"
#define Module_ComponentPath "castle/RiscOS/Sources/Kernel"
#define Module_FullVersion "5.35 (4.79.2.177)"
#define Module_HelpVersion "5.35 (21 Nov 2012) 4.79.2.177"
#define Module_FullVersion "5.35 (4.79.2.178)"
#define Module_HelpVersion "5.35 (05 Dec 2012) 4.79.2.178"
#define Module_LibraryVersionInfo "5:35"
......@@ -32,19 +32,19 @@ keyprefix SETS "Key$"
^ 0, R11
CurrKey # 1 ; current key in two key rollover
OldKey # 1 ; old key in two key rollover
CurrKey # 4 ; current key in two key rollover
OldKey # 4 ; old key in two key rollover
KbId # 1
LastKbId # 1
AutoRepeatCount # 1
Debouncing # 1 ; NZ => do delay next, Z => do repeat
MouseButtons # 1 ; bit0=R, bit1=C, bit2=L
PendingAltType # 1 ; 1 => A, 2 => SA, 3 => CA, 4 => CSA
ModulesOK # 1 ; bit0=1 => modules are initialised
; bit1=1 => we have offered service
LastLED # 1 ; last request for LED change, so we don't send repeated ones
MouseType # 1 ; current pointer device type
[ STB
MousePresent # 1 ; mouse detected
]
MouseReporting # 1 ; mouse is sending reports itself
NoDebounce # 1 ; NZ => no kernel key debounce
; set if R2="NoKd" on KeyV 0 entry
......@@ -66,7 +66,7 @@ MouseBoundBRow * MouseBounds+4
MouseBoundRCol * MouseBounds+8
MouseBoundTRow * MouseBounds+12
KeysDown # 20 ; bitmap of all down keys
KeysDown # &300/8 ; bitmap of all down keys
SoftKeyName # 3 + :LEN:(keyprefix) ; up to 2 digits + terminator
......
......@@ -75,8 +75,7 @@
GET Hdr:nvram
GET Hdr:PortMan
GET Hdr:SerialOp
GET s.PMF.DEF ; Common with 6502 code in the keyboard
Protocol
GET Hdr:Keyboard
; now the main parts of the MOS
......
......@@ -1291,7 +1291,7 @@ dhte
; Out r0 = sysinfo for r0in
ReadSysInfo_Code ROUT
CMP r0,#13 ;R0 > 12, so illegal value
CMP r0,#14 ;R0 > 13, so illegal value
ADDLO PC, PC, R0,LSL #2
B ReadSysInfo_InvalidReason
......@@ -1308,6 +1308,7 @@ ReadSysInfo_Code ROUT
B ReadSysInfo_InvalidReason ; ROL's "read OS version" call
B %FT110
B %FT120
B %FT130
ReadSysInfo_InvalidReason
ADR r0, ErrorBlock_BadReadSysInfo
......@@ -2111,6 +2112,39 @@ RSI_DebugRX
Pull "r1-r3,r9,r14"
ExitSWIHandler
; OS_ReadSysInfo 13 - Validate key handler
;
; On entry:
; r0 = 13 (reason code 13)
; r1 = key handler address (0 to just return valid flags)
;
; On exit:
; r0 = Mask of supported key handler flags
; Or pointer to error block
;
130
LDR R0, =KeyHandler_Flag_Wide
CMP R1, #0
ExitSWIHandler EQ
Push "R2"
LDR R2, [R1, #KeyHandler_KeyTranSize]
TST R2, #KeyHandler_HasFlags
LDRNE R2, [R1, #KeyHandler_Flags]
BICNES R2, R2, R0
Pull "R2"
ExitSWIHandler EQ
ADR R0, ErrorBlock_BadKeyHandler
[ International
Push "lr"
BL TranslateError
Pull "lr"
]
ORR lr, lr, #V_bit
ExitSWIHandler
MakeErrorBlock BadKeyHandler
;
; Extended ROM footer functions
;
......
; Copyright 1996 Acorn Computers 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.
;
; > $.Source.PMF.Def
MACRO
Protocol
;
; Protocol constants
;
; 4 bit codes for input commands
;
LEDON * &00
LEDOFF * &10
REQUEST * &20
ACK * &30
SPDDATA * &40 ;Bottom four bits are data to convert
RSTREQ * &80 ;Request for reset
;
; 4 bit input data types
;
; Requests
;
KBID * 0
SPDRESET * 1
MDATA * 2 ;New mouse position, even if it hasn't moved
;
; Acks
;
BYTE * 0
SCAN * 1
MOUSE * 2
ALL * 3
;
; data output
;
; Type d7 d6 d5 d4 d3 d2 d1 d0 number of bytes
; Reset 1 x x x x x x x 1
; Key up 0 0 1 1 x x x x 2 (row then column)
; Key down 0 0 1 0 x x x x 2 (row then column)
; Mouse change 0 1 x x x x x x 2 (X, Y)
; SPD data 0 0 0 0 x x x x 8
; KB Ids 0 0 0 1 x x x x 2 (low nibble then high nibble)
;
; The keyboard type
;
IDTYPE * &10
KBTYPE * 0 ;This is keyboard 0
;
; Key transitions
;
KEYDOWN * &20
KEYUP * &30
;
; Mouse transitions
;
MMOVED * &40
;
; SPD converted data
;
SPDDONE * 0
;
; Reset types
;
HRDRESET * &FF
RST1ACK * &FE
RST2ACK * &FD
; New keyboard protocols
; Keyboard -> ARM
K1mdat * &00 ; 0xxx xxxx Mouse data from keyboard
K1kbid * &80 ; 10xx xxxx Keyboard ID from keyboard
K1kdda * &C0 ; 1100 xxxx Key down data
K1kuda * &D0 ; 1101 xxxx Key up data
K1pdat * &E0 ; 1110 xxxx SPD data from keyboard (won't happen)
K1rak2 * &FD ; 1111 1101 Reset acknowledge 2
K1rak1 * &FE ; 1111 1110 Reset acknowledge 1
K1hrst * &FF ; 1111 1111 Hard reset
K1kbidmask * &3F ; 0011 1111 Valid bits in keyboard id
K1notmousedata * &80
; ARM -> Keyboard
;
; The IOC registers
;
^ &04, R12
KARTTx # 0
KARTRx # 0
^ &20, R12
IRQStatusB # 4
IRQReqB # 4
IRQMaskB # 4
^ &70, R12
Timer3Low # 4
Timer3High # 4
Timer3Go # 4
Timer3Latch # 4
; Register bits
KARTRxBit * &80
KARTTxBit * &40
KARTIRQBits * KARTTxBit :OR: KARTRxBit
K1leds * &00 ; 0000 0xxx Set LED states
K1rqid * &20 ; 0010 0000 Request keyboard id
K1prst * &21 ; 0010 0001 SPD reset
K1rqmp * &22 ; 0010 0010 Request mouse position
K1nack * &30 ; 0011 0000 Acknowledge (keys- mouse-)
K1sack * &31 ; 0011 0001 Acknowledge (keys+ mouse-)
K1mack * &32 ; 0011 0010 Acknowledge (keys- mouse+)
K1smak * &33 ; 0011 0011 Acknowledge (keys+ mouse+)
K1back * &3F ; 0011 1111 Byte acknowledge (between 2 data bytes)
K1rqpd * &40 ; 0100 xxxx Request SPD data conversion
; Keyboard vector offsets
^ 0
KVKeyTran # 4
KVKeyTranSize # 4
KVInkeyTran # 4
KVShiftingList # 4
KVSpecialList # 4
KVSpecialCodeTable # 4
KVInit # 4
KVPendingAltCode # 4
KVPendingAltSpecial # 4 ; Used only internally
MEND
END
This diff is collapsed.
......@@ -815,9 +815,9 @@ Osbyte78
BL WriteKeysDown
MyOsbyte
; Perform Keyboard Scan from 16
; Perform Keyboard Scan from 15
Osbyte7A
MOV R1, #&10
MOV R1, #&0F
; and drop thru to ...
; Perform Keyboard Scan
......
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