# Character codes

## Contents

- The EPOC character set

- Entering characters at the keyboard
- Modification of character codes
- Other special keys
- Character codes of special keys

- Special character codes with PRINT
- Keyboard modifiers

## The EPOC character set

Section Contents

- Entering characters at the keyboard
- Modification of character codes
- Other special keys
- Character codes of special keys

The following are character code descriptions for the 8-bit character set used in the English version of EPOC. The definition is intended to be synonymous with code page 1252, which is 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:

### 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:

## 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.

`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
Shift | 2 | `KKmodShift%`
Control | 4 | `KKmodControl%`
Caps | 16 | `KKmodCaps%`
Fn | 32 | `KKmodFn%`