Hi,
With the Symbian OS v6.0 OPL SDK there is the "EPOC OPL Guide &
Reference" in Windows help format, describing OPL for Symbian OS v3 to
v5 (EPOC Release 3 to 5, for Psion Series 5, 5MX, etc).
In the topic "Programming in OPL / Advanced Topics / Scanning the
keyboard directly", we see the scan codes of the keys pressed or
released, that are returned in the third element of the array ev&() of
GetEventA32 ev&()
or
GetEvent32 ev&()
These scan codes are valid for a UK Psion Series 5MX, for example, but
not for the Nokia 9210.
Before talking about the Nokia scan codes, it is worth explaining that
the scan codes do not change for different keyboards with relation to
the key positions. On english Psion Series 5MX (or Revo, etc), the "A"
key returns $41 (its ASCII code in hexadecimal); on french Psion Series
5MX, it is the "Q" key that returns the same code $41 (the ASCII code of
"A"😉 because the french use the AZERTY configuration, and the "Q" is
exchanged with the "A". So the scan codes are related to the position of
the keys, only for the UK keyboard there is a agreement between the
ASCII code of the keys "A"..."Z" (and others) and the scan codes
returned.
On english Nokia 9210 machines, the correct scan codes are shown in the GIF picture attached, "9210ScanCodes.gif". Because I am a little bit lazy, not all scan codes for "0"..."9" and "A"..."Z" are shown, but they are in numerical and alphabetical order, their scan codes are simply the ASCII codes.
So, a real OPL code for returning the description of the keys, given the scan code, can be written as follows (for english keyboards) :
PROC KeyDescription$😞k&😉
LOCAL desc$(12)
IF k& = KScanDel%
desc$="Del"
ELSEIF k& = KScanTab%
desc$="Tab"
ELSEIF k& = KScanEnter%
desc$="Enter"
ELSEIF k& = KScanEsc%
desc$="Esc"
ELSEIF k& = KScanSpace%
desc$="Space"
ELSEIF k& = $0E
desc$="[Left]"
ELSEIF k& = $0F
desc$="[Right]"
ELSEIF k& = $10
desc$="[Up]"
ELSEIF k& = $11
desc$="[Down]"
ELSEIF k& = $12
desc$="Shift"
ELSEIF k& = $16
desc$="Ctrl"
ELSEIF k& = $18
desc$="Chr"
ELSEIF k& = $1A
desc$="Caps"
ELSEIF k& = $79
desc$=","
ELSEIF k& = $7A
desc$="."
ELSEIF k& = $7B
desc$="/"
ELSEIF k& = $7D
desc$=":"
ELSEIF k& = $2B
desc$="+"
ELSEIF (k& >= $30) AND (k& <= $5A)
desc$=CHR$(k&😉
ELSE
desc$=HEX$(k&😉
ENDIF
RETURN desc$
ENDP
Thanks to Dazler, for testing on a real Nokia machine the "Change
Keys..." dialog for the game Smuggers, which uses the code above. In this game, I do not allow the application and CBA buttons, nor "Esc", "Menu" and "Help" (?) keys, to be chosen as game keys.
Regards,
Roberto Colistete Jr.
Obs.: the CBA buttons have scan codes $A4 (top) to $A7.