p-sprint Keymap v. 0.63a - 102 key compatibility mode

last edited 30 august 2005
- fixed a few keymappings in the documentation (the alphabet keycodes actually had the ASCII values and the Function keys were off too)
- added the OS/shift key to the list
- added comment on possibility of combining SHIFT keys

Introduction

This is a description of the p-sprint keyboard emulator. The p-sprint keyboard emulator provides a full 114 key-set to cover all 102 keys of a pc-style keyboard. The program has been written as an include for c projects and is designed to make integration into your own applications as easy as possible. Because the system does not require an on-screen keyboard, it is particularly suitable for software that is ported to the PSP from a system that expects full keyboard support.

Here is an illustration of how p-sprint maps button presses to a keyboard (this is just a fragment, in reality all keys including function and keypad keys are mapped. If there are symbols in two colors, the white symbol is the first button you press, the coloured one the second. Compare the letter A to the example given below under 'How does it work?'.   

How does it work?

Obviously, the playstation controller doesn't have 102 keys, so a way was needed to select keys using less buttons. P-sprint does this by using sequential key combinations for regular key selection, and sequential key combinations with holds for immediate shift, alt, control and group selections.

Sequential key combinations means that you first press one button, and then another. For instance, if you press  (Square) in p-sprint, followed by  (Triangle), you get an 'a'.

A hold is that you first press one button, keep that button pressed, and then press another button. Say that you wanted to type a capital letter 'A'. First you press , and then you hold this button while you press . Now you've selected Shift. If you finally press , you will have typed an 'A'.

In the key overview below, all Hold combinations are indicated with an '+', and all regular combinations are indicated with a ','. So, say you were to describe the 'a' and the 'A', you would get:

,  = 'a'

+,  = 'A'

Key Layout and Groups

For easy typing, p-sprint limits itself mostly to the top three keys of each side of the screen (up,right,left and square,triangle,circle). By keeping cross and down clear from normal combinations, they only have to be pressed once to return a value. This is valuable for keys that are used often, like space and backspace.

As a result, you have 38 combinations for the regular face buttons. As this does not nearly cover 102 keys yet, a group-select option has been added to p-sprint. Through a hold-combination, you can select 1 of 6 different groups of keys. The first three are default groups designed for compatibility and cover the 102 basic keys in a layout designed for general purpose pc-keyboard compatibility environments.

Here's a small overview of the basic keys in each group.

Group 1:

Group 2:

Group 3:

Custom Groups

The second three groups are available to programmers who want to offer a set of keys that is optimised for a certain application.

Cross-platform compatibility

Obviously, the PSP has more buttons. For compatibility reasons under different environments, however, the default keymap only assumes those keys and all 102 keys can be found under the basic 8 buttons and their combinations and groups. The other buttons can be assigned values also, but those values should normally double values (as shortcut keys) that are also present among the regular 8 button combos.

In order to make the system work under most circumstances I have restricted the use of buttons to the d-pad and standard symbol buttons (square, triangle, cross and circle). Another advantage of this system is that it can be implemented on a large variety of console like platforms, as most of them these days have at least 8 such buttons.

Another reason is that the analog stick and the shoulder buttons are useful to reserve for mouse emulation in environments where a mouse is applicable (like Shells, Microwindows, and so on).

The default Keymap

Group Selection Shortcuts

Press the combination for the active group to return to the default group (Group '0' / Alphabet Keys). If you're not sure in which group you were (for instance in dosbox) you can press any of the combinations you're sure you weren't in twice.

p_spid
+ 58 Group 1 / Numbers and Function Keys
+ 59 Group 2 / Control Keys
+ 60 Group 3 / Reserved
+ 61 Custom Group 1
+ 62 Custom Group 2
+ 63 Custom Group 3

Shift Methods

Shift methods provide a shortcut for getting the shifted value for a key. They are separate from their true keymappings and do not render a keycode. If, say in a game like Doom, you need to shoot using the Shift key, get the normal combination that is mapped to this key instead.

You can also combine shift combinations by pressing more than one shift button while holding the first button. E.g. ctrl-alt-del would be (in group 2 mode): while holding , press , press , release , press .

1st button+, 2nd button Left Shift
1st button+, 2nd button Right Shift
1st button+, 2nd button Left Control
1st button+, 2nd button Right Control
1st button+, 2nd button Left Alt
1st button+, 2nd button Right Alt
1st button+, 2nd button OS key (win/apple)
1st button+, 2nd button OS key (win/apple)

The default 102 keys and their mappings

p_spid 1 (shift - ctrl - alt) 2 (shift - ctrl - alt) 3 (shift - ctrl - alt)
1 Backspace - 8 Backspace - 8 Down - 40
2 Space - 32 Space - 32 Enter - 13
3 b (B) - 66 F1 - 112 Left - 37
4 y (Y) - 89 F2 - 113 Home - 36
5 g (G) - 71 F8 - 119 Insert - 45
, 6 [ ({) - 219 [ ({) - 219
, 7 ' (") - 222 ; (:) - 186
, 8 , (<) - 188 , (<) - 188
9 f (F) - 70 F3 - 114 End - 35
10 o (O) - 79 F4 - 115 Up -38
11 u (U) - 85 F5 - 116 Pg Up - 33
, 12 x (X-24) - 88 / - 111 (numpad) Break - 19
, 13 v (V-22) - 86 F12 - 113 Print Screen - 16 
, 14 ` (~) - 192 ` (~) - 192
15 j (J) - 74 F9 - 120 Delete - 46
16 l (L) - 76 F6 - 117 Pg Dwn - 34
17 d (D) - 68 F7 - 118 Right - 39
, 18 m (M) - 77 F10 - 121 + - 107(numpad)
, 19 z (Z-26) - 90 F11 - 122 * - 106 (numpad)
, 20 ] (}) - 221 ] (}) - 221
21 \ (|) - 220
22 q (Q) - 81 * - 106 (numpad) Scroll Lock - 145
23 p (P) - 80 0 ()) - - 109 (numpad)
, 24 s (S) - 83 1 (!) ESC - 27
, 25 t (T) - 84 2 (@) LPSP - 91
, 26 c (C-3) - 67 9 (() MENU - 93
27 ; (:) - 186 ; (:) - 186
28 w (W) - 87 + - 107 (numpad) Num Lock - 144
29 k (K) - 75 - - 109 (numpad)
, 30 r (R) - 82 3 (#) Ctrl - 17
, 31 e (E) - 69 4 ($) Shift - 16
, 32 a (A) - 65 5 (%) Alt - 18
33 . (>) - 190 . (>) - 190
34 - (_) - 189
35 / (?) - 191
, 36 h (H) - 72 8 (*) CAPS - 9
, 37 n (N) - 78 6 (^) RPSP - 92
, 38 i (I) - 73 7 (&) TAB - 20
39 Enter - 13 Enter - 13 Enter - 13
40 Esc - 27 Esc - 27 Esc - 27
41 TAB - 20 TAB - 20 TAB - 20
42 MENU - 93 MENU - 93 Backspace - 8

Example Code

For example code, check out main.c in the p-sprint test application, and the special versions of the Microwindows keyboard and mouse drivers.

(will add links and paste decent example codes for specific implementations here later)