Logo (click for homepage)
Instructions
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 and – for the technically minded – how it works. The 'Paul' referred to in the article, is Paul Beverly, the original editor of Archive magazine.
Introduction
Triggered by the article 'The Alt Key' (Archive April 2000) 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, providing an easy and intuitive method for entering the special characters, in addition to the existing methods. Although every­one needs special characters every now and then, the use of accents and special characters is mandatory when typing in a foreign language (e.g. French).

Current situation
In the current situation, special characters can be entered in any of the following ways:

  1. By using the !Chars application from Apps:!Chars
  2. By pressing three digits on the numerical keyboard whilst holding down
    Alt
  3. 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-143 for the bullet) this is not very helpful when typing text in a foreign language.

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.

A possible solution
In the early days of mini and mainframe computers, 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 (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 keyboards to be used as well, but writing a new keyboard driver has become a tedious task, to put it mildly.

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
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. 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 is entered by briefly pressing and releasing
Alt
. 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
Alt
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 (-), so it can be entered with the key sequence
Alt
L
-
.

In the same vein, The (é) can be build from (e) and (/) and the (ë) consists of (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:

   ±   +-
   †   |-
   ‡   |=
   ®   RO
   ©   CO
   ™   tm
   ¥   Y-
   ß   ss
   ½   12
   ¼   14
   ÷   :-
   •   **
   ³   33
   ñ   n~
   °   oo
   ‰   %o
   ½   12
   ¾   34

In some cases you may use the abbreviation of a character, e.g.

   π   pi
   °   dg (for degrees), or use (gr) for gradient
   §   pg (for paragraph), or use (pa), or (se) for section
   ß   ss (double s)
   ‰   pm (for promille), or use (%o)
   •   bu (for bullet), or (ul) for useful list, (bp) big point
   ·   cp (for centre point)

* Commands
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
AltKey_List
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.

When using !HID you don't have to deal with *-commands.

Enhancements
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 are interpreted.

The AltKeys module intercepts both the KeyV and InsV vectors. When
Alt
is pressed and released, Compose Mode is entered and all characters through InsV are trapped 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 a match is found, the resulting character is inserted into the keyboard buffer directly. If no match is found, the combination is lost and no character will be inserted.

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.
  

Contact
If you have any comments or suggestions, please email me at: support@xat.nl I hope the AltKeys module will prove a useful addition to your favorite OS.

Paul Reuvers, X-Ample Technology bv, The Netherlands


USB and HID
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.

 More about USBHID


Further information
Any links shown in red are currently unavailable. © X-Ample Technology BV.
Last changed: Thursday, 01 September 2022 - 07:56 CET.
Click for homepage