Users' Eye View - The Alt Key
The article below was published in Archive Magazine many years ago
and describes how and why AltKeys was developed. It also explains
how it should be used.
Triggered by the article 'The Alt Key' (Archive April '00) I felt
it was time to sit down and find an easier way to enter the various
special characters from the keyboard. This has resulted in a small
relocatable module that can be added to the boot sequence, allowing an
easy and intuitive manner of entering the special characters.
Although everyone needs to enter special characters from time to
time, I think users in some countries (e.g. France) this can be
an invaluable tool.
In the current situation, special characters can be entered in any of the following ways:
- By using the !Chars application from Apps:!Chars
- By pressing three digits on the numerical keyboard whilst holding down Alt
- By pressing a letter key whilst holding down Alt
The !Chars application proves to be very useful and does exactly
what it is supposed to, but is very unpractible when typing text.
Furthermore the application quits itself when the window is closed,
so it needs to be restarted each time a character is wanted.
Leaving the window on the screen may produce 'random' characters
when the Shift Key is pressed whilst the mouse pointer is inside
the !Chars window.
Pressing three digits from the numerical keyboard whilst holding
down Alt allows any character to be entered as long as its ASCII
code is remembered. Although it is possible to remember the most
commonly used codes (e.g. Alt-134 for the bullet) this is
not very helpful when typing a foreign text.
The third method, pressing a letter key whilst holding down Alt,
seems a better method, but is not very intuitive in many cases as
Paul's article demonstrates.
Years ago DEC terminals used to have a Compose Key that allowed the
user to construct any special character from two other characters.
All you needed to do was to press the Compose Key to enter compose
mode and then, intuitively, press two keys on the keyboard to 'compose'
the special character.
Back in 1990 I wrote a RISC OS module that did exactly that. The only
problem was that is was written to run under RISC OS 3.10 and when
the Risc PC was introduced (i.e. RISC OS 3.50) it refused to run.
In fact it crashed the machine when it was loaded. The reason for
this incompatibility was the fact that Acorn had completely changed
the way the keyboard was interpreted by the Kernel when they moved
over to IBM compatible keyboards. In fact, the operating system is
now much more flexible allowing foreign keyboard to be used as well,
but writing a new keyboard driver has become a tedious task.
Reading Paul's article last month triggered me to dig into the matter
once again to see if it was possible to add a further method of
entering special characters directly from the keyboard, without
discarding the existing ones. The result after one evening of
programming is the AltKeys module as described below.
The AltKeys module can be loaded simply by double clicking it.
If you want to use it permanently, you may add it to your PreDesk
directory inside !Boot. Please note that AltKeys will only work
on RISC OS 3.50 or later (it is RISC OS 4 compatible).
Once the module is loaded, all keyboard operations are transparent.
You can still type any key or key combination as before and use any
of the other methods for entering special characters.
Compose Mode can be entered by pressing and releasing the Alt Key.
The CapsLock LED on the keyboard will start flashing to show that
you are now in Compose Mode. Next, type two characters in sequence
(e.g. 'c' and 'o') to form a special character (the © in this case).
That's all! If you've pressed the Alt Key accidently and the
CapsLock LED starts flashing, just press it again to cancel the
Compose Mode. If the Alt Key is held down for more than 50 cs
(halve a second), Compose Mode is also cancelled, to allow for
programs such as ArtWorks to use the Alt Key whilst dragging.
When entering a special character, all you need to do is think
of an intuitive key combination. E.g. The pound sign (£) can be
thought of as an (L) and a (-) sign. The (é) can be build from
(e) and (/) and the (ë) consists of a (e) and (:).
If you can think of only one character, press it twice, e.g.
(1) and (1) will give (¹).
I've tried to include as many key combinations as possible.
As a result of this there is often more then one way to enter
a character. Some examples:
ç (the french c-cedilla) can be entered as:
c, C and comma (as some people call it a comma)
c5 Some say the little tail looks like a (5)
c? or a reversed question mark (?)
cc or just press (c) twice
ë can be entered as:
e" the quote resembles the double dot
e: the colon resembles the double dot
e; so that you don't have to press Shift
Some other useful examples:
In some cases you may use the abbreviation of a character, e.g.
° dg (for degrees), or use (gr) for gradient
§ pg (for paragraph), or use (pa), or (se) for section
ß rs (for ringel-s, or ss for scharfes-s)
‰ pm (for promille), or use (%o)
• bu (for bullet), or (ul) for useful list, (bp) big point
· cp (for centre point)
The module has a number of *-Commands that can be used to control it's
behaviour. Type |
*AltKey_Info to obtain useful information about the
module and any external tables that may be loaded. Use
to obtain a complete list of all combinations known by the current table.
You may want to do this in a task window, so that you can scroll through
The list is long, but by no means complete. If you've got any combination
that doesn't work and you feel it should, please email me and (if it makes
sense) I'll include it in the next release. Furthermore, any suggestions
for improvement are very welcome.
At present the module is only suitable for Latin-1 encoded fonts, but from
version 2.04 onwards user tables may be added. If you have assembled any
new tables yourself and you want to share them with the rest of us, feel
free to send us a copy, so that we can include it in the next distribution.
How it works (the technical stuff)
Because of the way the keyboard interface is implemented in the operating
system, it is not easy to intercept and modify key presses.
As you can see in the drawing, the keyboard generates scan codes that are
send to the Keyboard Device Driver. This Device Driver translates the scan
codes into low level key numbers (as used in previous versions of the OS).
These low level key numbers are then sent trough the vector 'KeyV' to the
Kernel to allow for debouncing, auto-repeat, etc. The Kernel then sends the
low level key codes on to the Keyboard Handler which in turn translates the
key codes into ASCII characters (allowing different Keyboard Handlers for
foreign keyboards). Once tranlated into ASCII, the Keyboard Handler sends
the characters through the vector 'InsV' to the keybord buffer where they
The AltKeys module intercepts both the KeyV and InsV vectors.
When the Alt Key is pressed and released, Compose Mode is entered
and all characters through InsV are intercepted and recorded.
Once two characters are received, it leaves Compose Mode and
tries to interpret the two recorded characters by scanning through
a look up table. If no match is found, the combination is lost
and no character will be shown. If the module finds a match, the
resulting character is inserted into the keyboard buffer directly.
Because of the way in which the keyboard buffer works, an extra
problem was introduced. OS_Bytes 221 to 228 can be used to program
the interpretation of certain groups of ASCII codes, e.g. to allow
for F-keys to be used. By default the WIMP is set up in such a way
that some ASCII codes are converted into something else.
Furthermore the user (or programmer) is free to redefine the key
interpretation. The AltKeys module overcomes this problem by
changing the key interpretation into a 1-to-1 relation temporarily
and reverting to the original setting on the next key press.
If you have any comments or suggestions, please email me at: firstname.lastname@example.org
I hope the AltKeys module will prove a useful addition to your favorite OS.
Paul Reuvers, X-Ample Technology bv, The Netherlands
Modern RISC OS systems generally have USB for connection of keyboard and
mouse. AltKeys fully supports USB keyboards. For additional support of
USB keyboards and other Human Interface Devices (HID), please refer to
our page about !HID.
The AltKeys module is included with !HID.
Any links shown in red are currently unavailable.
© X-Ample Technology BV.|
Last changed: Thursday, 03 November 2016 - 07:29 CET.