EPOC logo Left Right Up
Appendix D: Character codes

Appendix D: Character codes


Chapter Contents


The character set for the Series 5

Section Contents

The following are character code descriptions for the 8-bit character set used in the English version of EPOC32. The definition is intended to be synonymous with code page 1252 (also used by Microsoft for Windows systems).

Those items in the ‘character’ column which are given in italics are descriptions. Particularly note that the code for backspace will be the code returned when you press Del, that for carriage return will be returned when you press Enter and that for escape when you press Esc.


Entering characters at the keyboard

Any of the characters in the character set can be entered directly from the keyboard:

Look up the decimal code of the character you want from the preceding table.

Hold down the Ctrl key and type the three-digit code, then release the control key.

Make sure that you include any preceding zeros to make the code three digits long - for example use Ctrl+096 to enter a single left quote, ‘.


Modification of character codes

The keycode value is modified when pressing Ctrl at the same time as another key.

For alphabetic keys the Ctrl modified value is the ordinal position in the alphabet ignoring upper and lower case, i.e. 1 for Ctrl+A or Shift+Ctrl+A, 2 for Ctrl+B or Shift+Ctrl+B, etc. This value can be found by ANDing the ASCII value of the alphabetic character with (NOT $60). So the keycode of upper and lower case letters is the same when pressed together with Ctrl, with only the value of the modifier differing. For example, pressing Ctrl+J returns 10 which is (%j AND (NOT $60)).


Other special keys

The keycodes (returned by GETEVENT32, etc) for these special keys are as follows:

GET and KEY, however, return the same values as on the Series 3c (see below).


Character codes on the Series 3c and Siena

To find out a character’s character code either look up the character in the table given in the back of your User Guide, or press the Calc button and type the % sign followed by the character for example %P returns 80. Characters with codes from 0 to 127 are the same as in the ASCII character set. Codes 128 to 255 are compatible with the IBM code page 850.

Codes from 256 upwards are for other Series 3c keys see the list below.


Character codes of special keys

The GET and KEY functions return the character code of the key that was pressed. Some of the keys are not in the character set. They return these numbers:

The Psion key adds 512 to the value of the key pressed. For example, Psion-a is 609 (512+97), and Psion-Help (Dial) is 803 (512+291).


Special character codes with PRINT

These values can be used with PRINT and CHR$():

7

beep

8

backspace

9

tab

10

line feed

12

form feed (clear screen)

13

carriage return (cursor to left of window)

For example, PRINT CHR$(8) moves the cursor backwards, one character to the left.


Keyboard modifiers

Keyboard modifier values are the same for all machines, except that the Psion key (modifier value 8) does not exist on the Series 5.

GETEVENT a%() returns the modifier for a keypress in (a%(2) AND $ff).

GETEVENT32 ev&() returns modifiers to ev&(4) for keypresses and in ev&(5) for pointer (pen) events.

The values which can be returned are as follows:

modifier

value

constant name (Series 5 only)

Shift

2

KKmodShift%

Control

4

KKmodControl%

Caps

16

KKmodCaps%

For the Series 5 there is additionally a Fn key:

Fn

32

KKmodFn%

For the Series 3c there is additionally a Psion key:

Psion

8

-


EPOC logo Left Right Up