Here's a picture of a keyboard you're not likely to see on sale for your PC compatible computer anytime soon, more's the pity...

It has 106 keys. What is a full 105-key keyboard doing with an Fn key on it? After all, those keys are used on small keyboards, such as laptop keyboards without numeric pads, for compatibility with larger keyboards.
Well, this keyboard is compatible with a larger keyboard: a 122-key keyboard, as those familiar with the IBM 3270 PC computer would recognize from the legends on many of the keys. Other versions of the 122-key Host Connected Keyboard have different legends on some of the additional keys. It has other extras; the APL character set, brightly color-coded keys with retro seventies styling.
The color coding may look familiar from my page about keyboards.
I have to admit, though, that it may be that a keyboard such as I illustrate above may be impossible. For one thing, the keyboard used with the 3270 PC was connected by means of a very special interface: the keyboard was connected to a card and then through the card to the motherboard as an ordinary keyboard. Modern 122-key keyboards that connect directly to computers usually have slightly different layouts, based on the IBM 5250 display terminal, so the way in which keys corresponding to those on the 101-key keyboard are located on the 122-key keyboard is likely to be different from what I had assumed in the creation of this diagram.
At one point, I was going to illustrate the definition of this keyboard by including a chart of its scan codes, but the first few references I looked at gave only some of the additional scan codes required for a 122-key keyboard. Many third-party 122-key keyboards appear to be offered for sale with different and incompatible scan code assignments; I presume this is either because the version offered by IBM doesn't offer sufficient compatibility with the regular 101-key keyboard, or simply to make some keys compatibile with the added keys on the 104-key keyboard.
Here are links to a couple of the many pages I went to which contained useful information on the subject:
http://www.delorie.com/djgpp/doc/rbinter/it/06/0.html
http://www.win.tue.nl/~aeb/linux/kbt/scancodes-1.html
Having gone more deeply into the subject, it might be noted that the keyboard pictured above isn't "really" intended to be a 105-key keyboard, but a 104-key one with one key from the 105-key keyboard; the 105-key keyboard actually has two added keys, and omits the key from the 104-key keyboard with | and \ on it instead of simply moving it to the other side of the keyboard to where the key with the same characters is located on a UK keyboard.
Or so I thought; but the key with ~ and # on it on the UK 102-key keyboard actually does use the same scan code as the key with | and \ on the US 101-key keyboard, yet references still say that key is omitted rather than relabelled on foreign-language keyboards. But they are right; the scan code is the same in scan code sets 1 and 2, but not in scan code set 3, where the U.S. version has scan code 5C, and the international version has scan code 5D, and the USB scan code differs as well.
Because the original keyboards for the IBM Personal Computer AT and its predecessors had some keys that combined functions in a different fashion than is done on the 101-key keyboard, specifically:
* Print Screen Scroll Lock Break System Request
the keys on the 101-key keyboard embodying these functions in different combinations do not have simple scan codes (that is, in Scan Code Set 1 and Scan Code Set 2) but instead, for compatibility, cause extra signals to be sent so as to modify the current shift state before sending their make code (and to restore it after sending their break code). This is in addition to the cursor keypad keys which both send the E0 signal to distinguish themselves and extra signals to adjust the Num Lock and shift status as appropriate. The / key in the numeric keypad area was also a late addition, and also has to generate extra scan codes under some circumstances.
The following diagram illustrates the layout of the keyboard on the original IBM Personal Computer, and the IBM Personal Computer XT as well:

For simplicity, and to avoid having to abbreviate the legends on some keys, it does not show that many of the keys had a raised central portion, so that the faces of the larger keys were the same size as those of the smaller ones.
A keyboard with the same arrangement was also used with the IBM System/23 Datamaster computer, an 8085-based successor to the IBM 5110-3 processor used in the IBM 5120 system, which was introduced shortly before the IBM PC was announced, and this keyboard design was also used on the 68000-based CS9000 system from IBM intended for use with laboratory instrumentation.
The positioning of the Enter key and the left shift key were unpopular with many users; these things were corrected in the keyboard for the IBM Personal Computer AT:

This keyboard, except for the extra System Request key, has exactly the same keys as the original PC keyboard, they are only arranged differently. This keyboard was very popular with computer users, despite the fact that now the Backspace key was hard to reach. So much so that when the 101-key Enhanced Keyboard started to become common, many manufacturers of keyboards compatible with that keyboard produced keyboards with a layout that was modified to follow that of the 84-key AT keyboard more closely.
The diagram below shows the arrangement of keys on the 101-key Enhanced Keyboard. As this keyboard arrangement is likely to be very familiar, and to be at least the basis of the arrangement used on the computer at which you are viewing this web site, even if it is a Macintosh, it may seem hardly necessary to include an image.

This keyboard arrangement was introduced on the IBM RT PC, which was IBM's first RS/6000-based workstation, and which ran IBM's AIX operating system, its licensed implementation of UNIX.
This keyboard design attracted notice, and became the industry standard, after the introduction of IBM's Personal System/2 line of computers, on which it was used; however, before then, it was used on other IBM systems, including the IBM XT 286, some later models of the Personal Computer AT. Prior to the Personal System/2, the Compaq Deskpro 386 offered a keyboard in this style as an option.
This keyboard finally placed both shift keys, the Enter key, and the Backspace key all in the locations familiar to typists. As well, it offered a cursor keypad that was always available, so that one could keep the keyboard in Num Lock mode, and have the numeric keypad available as well. One noted computer columnist criticized the keyboard for having two extra function keys which would be unlikely to be used, due to compatibility concerns; this was, in itself, a valid criticism, but he overlooked the justification for this addition: that IBM's mainframe terminals generally had a set of either 12 or 24 function keys, and thus this change made terminal emulation programs for them more convenient; on older keyboards, the programs could use the other keyboard mappings already used for those keyboards.
But some subtler changes were made that led to scan codes becoming complicated. Since the + and - keys on the numeric keypad didn't become anything else when shifted, the Print Screen function was taken away from the numeric keypad's * key, and given its own key. Since the System Request function introduced on the AT was very rarely used, it was moved to that key. A Pause key was added to the keyboard, and the Break function was moved to that key, and away from the Scroll Lock key, since it seemed to be more closely related to that key.
The PC architecture is designed to cope with different keyboard layouts for different languages, and some programs, like games, access key locations directly so that the physical relationships between keys used for different purposes will remain the same regardless of the language used with the computer on which the game is running.
While the original 101-key keyboards could only be used on newer IBM computers designed to work with them, however, the merits of the new keyboard arrangement were such that there was a great demand for keyboards with this arrangement that would be compatible with older computers. This led to the assignments for Scan Code Set 1 and Scan Code Set 2, associated with the 83-key and 84-key keyboards respectively, for this keyboard becoming complicated, since these scan codes were assigned so that a 101-key keyboard would simulate an 84-key keyboard when the keys with the same function were pressed, regardless of their new location on the new keyboard.
Scan Code Set 1 corresponds to the scan codes of the keyboard of the IBM PC, and to what most computer programs see when they request scan codes from the BIOS, despite that virtually all computers with conventionally-connected keyboards use Scan Code Set 2, which corresponds to the scan codes sent by the keyboard of the IBM Personal Computer AT, as the BIOS translates these. Scan Code Set 3 was designed to be native to the 101-key keyboard; it is used by keyboards connected to the higher-end members of the original IBM PS/2 family which had 386 processors (some low-end machines in the original PS/2 family actually used Scan Code Set 1), and with a few computers running licensed commercial versions of the UNIX operating system (as well, perhaps, as some computers using Linux if they are configured for use with keyboards with a large number of keys that their owners had been fortunate enough to obtain): as it had not been implemented correctly on some 3rd-party keyboards, it has not achieved general acceptance. USB keyboards use their own different set of key codes, which have been defined and standardized by Microsoft.
The keyboard sends both a make code and a break code for most of the keys. For scan code set 1, the break code is hexadecimal 80 XOR the regular scan code; for scan code sets 2 and 3, the break code consists of two bytes, hexadecimal F0 preceding the regular scan code.
This is what the table of the scan codes of the keyboard pictured above might have looked like. It is incomplete, however. The top row shows the scan codes when the key is used with the Fn key.
As noted above, the cursor keys whose functions match those provided by the numeric keypad also generate extra scan codes, representing the "Num Lock" key, if required, for the 101-key keyboard to simulate the 84-key keyboard of the IBM Personal Computer AT; the scan codes for these keys are marked by an asterisk.
As the / key on the numeric keypad was added later, unlike the +, -, and * keys there which have their own scan codes, it has the scan code for the ?/ key preceded by the E0 code which is used to distinguish the left and right Alt and Ctrl keys from each other precisely because it is ignored by older machines; hence, it wiggles out of being shifted to avoid making a question mark on those machines; newer machines are tipped off that it is a different key by the E0, and so they can use a 101-key keyboard for languages where something other than the slash is on the key used for the ? and / in the main typing area.
In addition, the original IBM PC keyboard had the Print Screen function on the same key as the asterisk, and the Break function was on the Scroll Lock key, and the AT keyboard had the System Request function on its own key.
Thus, on the 101-key keyboard, the keys now containing these functions in different shifts must send make or break codes for the appropriate shift keys before sending the code for the key which they are simulating, and then, after sending that key's break code, reverse the action. The scan codes for the two functions of the keys of this type with two functions are noted separated by a slash, and all the keys in this family of keys requiring complicated handling are marked with a plus sign.
|-------------------------------------------------------------------|
| E0 52 | E0 53 | E0 47 | E0 4F | E0 49 | E0 51 | | |
| E0 52*| E0 53*| E0 47*| E0 4F*| E0 49*| E0 51*| | E1/46+|
|---------------------------------------------------------------------------------------------------------------------------------------------------|
| | | | 5B | 5C | 5D | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 6A | 6B | | | 37 |
| 37/54+| 56 | 29 | 3B | 3C | 3D | 3E | 3F | 40 | 41 | 42 | 43 | 44 | 57 | 58 | E0 48*| 45 | 46+|
|---------------------------------------------------------------------------------------------------------------------------------------------------|
| | | | | | | | | | | | | | | | | | E0 39 |
| 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 0A | 0B | 0C | 0D | 0E | E0 4B*| E0 50*| E0 4D*| E0 35+|
|---------------------------------------------------------------------------------------------------------------------------------------------------|
| | | | | | | | | | | | | | | 6E | 6F | 75 | E0 0F |
| 0F | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 1A | 1B | 2B | 47 | 48 | 49 | 37+|
|---------------------------------------------------------------------------------------------------------------------------------------------------|
| 1D | | | | | | | | | | | | E0 1D | 73 | 74 | 6D | E0 4C*|
| 3A | 1E | 1F | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 1C | 4B | 4C | 4D | 4A |
|---------------------------------------------------------------------------------------------------------------------------------------------------|
| | | | | | | | | | | | | 70 | 71 | 72 | 1C |
| 2A | 2C | 2D | 2E | 2F | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 4F | 50 | 51 | 4E |
|---------------------------------------------------------------------------------------------------------------------------------------------------|
| | | | | | | | | 76 | | |
| 1D | E0 5B | 38 | 39 | E0 38 | E0 5C | E0 5D | E0 1D | 52 | 53 | E0 1C |
|---------------------------------------------------------------------------------------------------------------------------------------------------|
Since different scan codes, not conflicting with those used by the 122-key keyboard, are used for the other extra keyboard functions, such as a key to turn the computer on from the keyboard, keys to access the Internet, keys to change speaker volume, and since the letters of the alphabet still have some blank space left on the front of the keys, the Fn key could be used to allow the use of those functions as well, possibly even producing a universal keyboard.
Here is a table of keyboard scan codes, compiled from numerous sources. The first part of the table is in the same order as the set 1 scan codes of the keys. The third column contains some popular added keys for multimedia and Internet keyboards from various keyboards, and some manufacturers may use different scan codes for these functions, although the codes shown here are generally popular ones, and the scan codes for the extra keys on a 122-key keyboard, about which I am not entirely certain.
Scan Code Key Scan Code Key Scan Code Key
Set Set Set USB Set Set Set USB Set Set Set USB
1 2 3 1 2 3 1 2 3
01 76 08 29 Esc 37 7C PrtSc * E0 5E E0 37 Power
02 16 16 1E ! 1 37+ 7C+ 7E 55 * KP E0 5F E0 3F Sleep
03 1E 1E 1F @ 2 37/54+ 7C/84 57 46 PrtSc E0 63 E0 5E Wake
04 26 26 20 # 3 38 11 19 E2 Alt L E0 20 E0 23 7F Mute
05 25 25 21 $ 4 E0 38 E0 11 39 E6 Alt R E0 30 E0 33 80 Volume Up
06 2E 2E 22 % 5 39 29 29 2C Space E0 2E E0 21 81 Volume Down
07 36 36 23 ^ 6 3A 58 14 39 Caps Lock E0 17 E0 43 7B Cut
08 3D 3D 24 & 7 3B 05 07 3A F1 E0 18 E0 44 7C Copy
09 3E 3E 25 * 8 3C 06 0F 3B F2 E0 0A E0 46 7D Paste
0A 46 46 26 ( 9 3D 04 17 3C F3 E0 3B E0 05 75 Help
0B 45 45 27 ) 0 3E 0C 1F 3D F4 E0 08 E0 3D 7A Undo
0C 4E 4E 2D _ - 3F 03 27 3E F5 E0 07 E0 36 Redo
0D 55 55 2E + = 40 0B 2F 3F F6 E0 22 E0 34 Play
0E 66 66 2A Back Space 41 83 37 40 F7 E0 24 E0 3B Stop
0F 0D 0D 2B Tab 42 0A 3F 41 F8 E0 10 E0 15 Skip Back
10 15 15 14 Q 43 01 47 42 F9 E0 19 E0 4D Skip Fwd
11 1D 1D 1A W 44 09 4F 43 F10 E0 2C E0 1A Eject
12 24 24 08 E 45+ 77+ 76 53 Num Lock E0 1E E0 1C Mail
13 2D 2D 15 R 45/46+ 77/7E+ 62 48 Pause/Bk E0 32 E0 3A Web
14 2C 2C 17 T 46 7E ScrLk/Bk E0 3C E0 06 Music
15 35 35 1C Y 46+ 7E+ 5F 47 Scroll Lock E0 64 E0 08 Pictures
16 3C 3C 18 U 47 6C 6C 5F 7 Home KP E0 6D E0 50 Video
17 43 43 0C I E0 47* E0 6C* 6E 4A Home CP
18 44 44 12 O 48 75 75 60 8 Up KP 5B 1F 08 68 F13
19 4D 4D 13 P E0 48* E0 75* 63 52 Up CP 5C 27 10 69 F14
1A 54 54 2F { [ 49 7D 7D 61 9 PgUp KP 5D 2F 18 6A F15
1B 5B 5B 30 } ] E0 49* E0 7D* 6F 4B PgUp CP 63 5E 2C 6B F16
1C 5A 5A 28 Enter 4A 7B 84 56 - KP 64 08 2B 6C F17
E0 1C E0 5A 79 58 Enter KP 4B 6B 6B 5C 4 Left KP 65 10 30 6D F18
1D 14 11 E0 Ctrl L E0 4B* E0 6B* 61 50 Left CP 66 18 38 6E F19
E0 1D E0 14 58 E4 Ctrl R 4C 73 73 97 5 KP 67 20 40 6F F20
1E 1C 1C 04 A 4D 74 74 5E 6 Right KP 68 28 48 70 F21
1F 1B 1B 16 S E0 4D* E0 74* 6A 4F Right CP 69 30 50 71 F22
20 23 23 07 D 4E 79 7C 57 + KP 6A 38 57 72 F23
21 2B 2B 09 F 4F 69 69 59 1 End KP 6B 40 5F 73 F24
22 34 34 0A G E0 4F* E0 69* 65 4D End CP 05 9A Attn SysRq
23 33 33 0B H 50 72 72 5A 2 Down KP 06 9C Clear
24 3B 3B 0D J E0 50* E0 72* 60 51 Down CP 72 39 04 A3 CrSel
25 42 42 0E K 51 7A 7A 5B 3 PgDn KP 0C Pause ErInp
26 4B 4B 0F L E0 51* E0 7A* 6D 4E PgDn CP 74 53 03 A4 ExSel SetUp
27 4C 4C 33 : ; 52 70 70 62 0 Ins KP 6D 50 0E ErEOF Recrd
28 52 52 34 " ' E0 52* E0 70* 67 49 Ins CP 83 Print Ident
29 0E 0E 35 ~ ` 53 71 71 63 . Del KP 6F 6F 0A Copy Test
2A 12 12 E1 Shift L E0 53* E0 71* 64 4C Del CP 01 Enl Help
2B 5D 5C 31 | \ 54 84 SysRq 09 Ctrl
2B 5D 5D 32 (INT 2) 56 61 53 64 (INT 1) E0 4C E0 73 62 Rule
2C 1A 1A 1D Z 57 78 56 44 F11
2D 22 22 1B X 58 07 5E 45 F12
2E 21 21 06 C E0 5B E0 1F 8B E3 Win L
2F 2A 2A 19 V E0 5C E0 27 8C E7 Win R
30 32 32 05 B E0 5D E0 2F 8D 65 WinMenu
31 31 31 11 N 70 13 87 88 katakana
32 3A 3A 10 M 73 51 51 87 (INT 3)
33 41 41 36 < , 77 62 8C furigana
34 49 49 37 > . 79 64 86 8A kanji
35 4A 4A 38 ? / 7B 67 85 8B hiragana
35+ 4A+ 77 54 / KP 7D 6A 5D 89 (INT 4)
36 59 59 E5 Shift R 7E 6D 7B (INT 5)
Incidentally, the keyboard with my Sony computer has keys for the functions Mail, Web, Music, Video, Pictures, and Help, but instead of being as listed in the table above, they are (as translated to Set 1 form Set 2, of course) E0 11, E0 12, E0 13, E0 14, E0 15, and E0 16, respectively. The key with the moon on it, though, is the standard E0 5F, so it is a sleep key, not a power key.
As the keys are also labelled S1 through S6, assigning them consecutive codes is not without a measure of sense: the keyboard design provides for an overlay on those keys, so presumably they are to be regarded as reassignable.
The keypad * key with Set 1 scan code shown as 37+ (presumably) causes the necessary actions to be taken to make it appear that no shift key is depressed while it is being pressed.
The Print Screen key with Set 1 scan code shown as 37/54+ sends E0 37, with the left shift key forced to appear depressed, unless the right shift key is depressed, in which case it sends either E0 54 or 54; my references are not consistent on this point. (Behavior in scan code Set 2 is analogous, as the two sets are isomorphic except for a byte translation and the difference in break code handling.)
The Num Lock key with Set 1 scan code shown as 45+ (presumably) causes the necessary actions to be taken to make it appear that no control key is depressed while it is being pressed.
The Pause/Break key with Set 1 scan code shown as 45/46+ takes the necessary actions to make it appear that a control key is pressed when no control key is pressed, in which case it sends 45 (with an additional E1 code indicating the key is nonrepeating), and simply sends the code 46 when a control key is pressed.
The Scroll Lock key with Set 1 scan code shown as 46+ (presumably) causes the necessary actions to be taken to make it appear that no control key is depressed while it is being pressed.
The various cursor pad keys, as marked with an asterisk, in addition to having their scan codes in Set 1 and Set 2 prefixed with E0, take the necessary action to make it appear that the keyboard is not in Num Lock mode, and that no shift key is depressed, when they are pressed. (Alternatively, if the keyboard is in Num Lock mode, and a shift key is depressed, it might seem that these keys could get away with taking no special action. This is particularly useful when both shift keys are depressed; similarly, if both shift keys are depressed when not in Num Lock mode, the keys could make it appear that Num Lock mode is in effect instead of unpressing and subsequently restoring both shift keys. This is probably not done by any keyboard manufacturer, because of the danger of incompatibility with software using the keyboard in a nonstandard fashion.)
INT 1 is the key next to the left shift key on an international keyboard. On many international keyboards, it has the characters < and >, but on the United Kingdom keyboard, it has | and \.
INT 2 is the lower key of the two to the right of the Enter key on an international keyboard. Confusingly, it, and not the one with | and \ on it in the UK, has the same scan code in some sets as the U. S. | and \ key; and on the Canadian French keyboard, it is this key that has < and > on it. In the United Kingdom, the characters on this key are ~ and #. (The scan code set 3 scan code for this key could be 13 instead of 53 according to a source which I usually find more reliable than the one giving 53; however, corroboration supplied indirectly by my source for the 122-key keyboard makes me think that 53 is more likely.)
INT 3 is found both on some Brazilian keyboards and on the Japanese keyboard used for a Kanji input method (it has hiragana on the keys, as opposed to the other form of a plain Japanese keyboard with katakana on the keys). On the Japanese keyboard, it has _ and \ on it, and is located next to the right shift key.
INT 4 is also found on the Japanese keyboard. It has | and ¥ on it and is located next to the backspace key.
INT 5 is located on the numeric keypad on some Brazilian keyboards. It has the same Group 3 scan code as the extra key on the numeric keypad of 122-key keyboards when the code assignments used for keyboards used with IBM terminals are followed.
Also, the Korean keyboard has two extra keys, having scan codes F1 and F2, which are unique to that keyboard, rather than being chosen from among the extra keys used on other international keyboards.
Some information about the additional keys of the 122-key keyboard is integrated in the table above. The information that relates only to the added keys has been left in that table, since it fits there most efficiently.
For those who are unfamiliar with the 122-key keyboard, the diagram below illustrates the arrangement of its keys:

The diagram above shows the Host Connected Keyboard, as offered with the IBM Personal System/2 computers. Previously, a 122-key keyboard with the same arrangement of keys, that of the IBM 3270 Personal Computer, illustrated a significantly different assignment of keys from the IBM PC to positions on the 122-key keyboard:

(For reasons of space, the detail of renaming the F1 through F24 keys to PF1 through PF24 has been omitted in the diagram above.)
Incidentally, for comparison, here is one of the more popular keyboard arrangements for the original IBM 3277 Display Station, part of the IBM 3270 display subsystem:

The key codes given in the table above are from sources which may refer to different versions of this keyboard style, and is also incomplete for some scan code sets. Where the information is incomplete, it may also be less reliable: I assigned the codes based on the IBM 5250 layout, where the IBM 3270 layout or another different one might have been appropriate. The Set 3 scan codes for the ten keys arranged like the F1 to F10 keys of early IBM keyboards are the same as the Set 2 scan codes for the F1 to F10 keys; this makes me confident that my source for those codes is likely to reflect an arrangement actually used on an IBM keyboard: the entire arrangement of those codes is also given in the table specific to the 122-key keyboard given below. And the USB codes are as officially standardized by Microsoft; but for the ten keys to the left of the main alphabetic area, they may have been standardized for a different keyboard layout.
Thus, while the Scan Code 3 information is relatively trustworthy throughout (but even it is not absolutely certain to reflect any "standard"; it may just be valid for the one 3rd-party keyboard in whose documentation these codes were given) the USB information can only be regarded as reliable for F13-F24; the Scan Code 1 and 2 information is valid for at least some keyboard arrangement for F13-F24, but not necessarily the same one as that for which the Scan Code 3 information is given: it does appear to apply to some keyboard with a 5250 layout, so it is likely to have been assigned to the right key positions, while the case for the USB scan codes is more uncertain.
The Reset and Enter keys have the same scan codes as the left and right Ctrl keys on a conventional keyboard, while the Carrage Return or Field Exit key has the same scan code as the Enter key on a conventional keyboard. There are USB code assignments, not shown here as these 122-key keyboard keys gave rise to no new table entries, which seem to follow the opposite convention, however. The < and > key is INT 1, and the } and { key is INT 2. The keypad tab key is the keypad + key, with all the other keys on the numeric keypad corresponding by position. The extra key, the keypad - key on a 122-key keyboard, is INT 5.
The E0 4C and E0 73 scan codes are a mere surmise on my part, but indicate where the Rule key is located on the 122-key keyboard: in the middle of the cursor key cluster. It would be nice if I could just add E0 to the scan codes for function keys F1 through F10 to get the scan codes for the keys to the left of the main typewriter area, but that can't be true, according to the sources I've seen, more's the pity.
However, because of the existence of several completely incompatible versions of the 122-key keyboard, some of which reassign keys already defined on the 101-key keyboard, it seems appropriate to give the 122-key keyboard its own table in which the different implementations of a 122-key keyboard can be examined in their entirety.
Key IBM Memorex- Nokia
5250 3270 PC 3476 Telex
SC3 SC1 Equiv
F13 Red PF13 Red F13 06 64 shift F1
F14 Pink PF14 Pink F14 10 65 shift F2
F15 Green PF15 Green F15 1B 66 shift F3
F16 Yellow PF16 Yellow F16 20 67 shift F4
F17 Blue PF17 Blue F17 2B 68 shift F5
F18 Turq PF18 Turq F18 30 69 shift F6
F19 White PF19 White F19 38 6A shift F7
F20 ffw1 PF20 Black F20 40 6B shift F8
F21 PF21 ffw1 F21 48 6C shift F9
F22 CrBnk PF22 F22 50 6D shift F10
F23 AltCr PF23 AltCr F23 57 6E shift F11
F24 +Cr PF24 F24 +Cr 5F 76 shift F12
F1 PSA PF1 PSA F1 07 58 F1
F2 PSB PF2 PSB F2 0F 59 F2
F3 ffw2 PF3 PSC F3 17 5A F3
F4 PF4 PSD F4 1F 5B F4
F5 box PF5 PSE F5 27 5C F5
F6 ffw3 PF6 PSF F6 2F 5D F6
F7 PF7 ffw3 F7 37 5E F7
F8 PF8 F8 3F 5F F8
F9 inv PF9 inv F9 Back 47 60 F9
F10 bri PF10 bri F10 Fwd 4F 61 F10
F11 und PF11 und F11 58 62 F11
F12 ffw4 PF12 ffw4 F12 5E 63 F12
Attn SysRq Help SysRq SysRq Attn 05 3B Esc
Clear Clear Test Clear 06 3C Pause Break
CrSel WS Ctrl ExSel 04 3D ctrl F1
Pause ErInp Finish Attn ErInp 0C 3E Scr Lock
ExSel SetUp ChgSc Jump CrSel Print 03 3F ctrl F2
ErEOF Recrd Erase EOF ErInp Help Hex 0E 40 Print Screen
Print Ident enl dscrn 83 41 ctrl F3
Copy Play Test Copy Auto Pause Play Test 0A 42 ctrl F5
enl Help Print Ident * Print SetUp 01 43 ctrl F4
Ctrl Ctrl Recrd Pause 09 44 alt Page Up
~ ` 0E 29 ~ `
| 1 | 1 ! 1 18 02 ! 1
@ 2 1E 03 @ 2
# 3 26 04 # 3
$ 4 25 05 $ 4
% 5 2E 06 % 5
¬ 6 ¬ 6 ^ 6 36 07 ^ 6
& 7 3D 08 & 7
* 8 3E 09 * 8
( 9 46 0A ( 9
) 0 45 0B ) 0
_ - 4E 0C _ -
+ = 55 0D + =
Backspace 66 0E Backspace
Tab 0D 0F Tab
Q 15 10 Q
W 1D 11 W
E 24 12 E
R 2D 13 R
T 2C 14 T
Y 35 15 Y
U 3C 16 U
I 43 17 I
O 44 18 O
P 4D 19 P
! ¢ ! ¢ { [ 54 1A { [
¦ \ 5B 1B } ]
Carriage Return Carriage Return Field Exit 5A 1C Enter
Caps Lock Caps Lock 14 1D Caps Lock
A 1C 1E A
S 1B 1F S
D 23 20 D
F 2B 21 F
G 34 22 G
H 33 23 H
J 3B 24 J
K 42 25 K
L 4B 26 L
: ; 4C 27 : ;
" ' 52 28 " '
} { } { } [ 53 74 INT 2
Shift L Shift L 12 2A Shift L
> < 13 70 INT 1
Z 1A 2C Z
X 22 2D X
C 21 2E C
V 2A 2F V
B 32 30 B
N 31 31 N
M 3A 32 M
, , < , 41 33 ,
. . > . 49 34 .
? / 4A 35 ? /
Shift R Shift R 59 36 Shift R
Reset Quit Reset Quit Reset Quit 11 38 Ctrl L
Alt L Alt L 19 71 Alt L
Space Space 29 39 Space
Alt R Alt R 39 72 Alt R
Enter Enter 58 3A Ctrl R
Dup PA1 Dup PA1 Back Tab enl 67 7B Insert
FldMk PA2 ChgSc Field Mark PA2 Dup 6E 7F Home
Jump PA3 PA3 Jump 6F 6F Page Up
Back Tab Back Tab Carriage Return 64 79 Delete
super super Insert 65 7A End
del dmulti del Delete 6D 7E Page Down
Up Back Up Up Roll Up 63 78 Up
Left DblLeft Left DblLeft Left 61 56 Left
Rule Home Home Rule Home 62 77 ctrl F6
Right DblRight Right DblRight Right 6A 7D Right
Down Fwd Down Down Roll Down 60 55 Down
bk1 Esc bk1 76 01 Num Lock
bk2 NumLk bk2 77 45 / KP
, KP , KP ScrLK bk3 7E 46 * KP
Space KP Space KP bk4 84 54 - KP
7 KP 7 KP Home 7 KP 6C 47 7 KP
8 KP 8 KP Up 8 KP 75 48 8 KP
9 KP 9 KP PgUp 9 KP 7D 49 9 KP
Tab KP Tab KP Field - 7C 37 Tab
4 KP 4 KP Left 4 KP 6B 4B 4 KP
5 KP 5 KP 5 KP 73 4C 5 KP
6 KP 6 KP Right 6 KP 74 4D 6 KP
- KP - KP bk5 7B 4A + KP
1 KP 1 KP End 1 KP 69 4F 1 KP
2 KP 2 KP Down 2 KP 72 50 2 KP
3 KP 3 KP PgDn 3 KP 7A 51 3 KP
Enter KP Enter KP + KP Field + 79 4E Enter KP
0 KP 0 KP Ins 0 KP 70 52 0 KP
. KP . KP Del . KP 71 53 . KP
The Memorex-Telex keyboard, apparently designed before IBM came out with the 101-key keyboard, blithely assigns the scan codes for function keys F1 through F10 to the ten keys to the right of the main typewriter area; thus, F1 through F12 have scan codes 58 through 63. Having a specimen of this keyboard, purchased at a local thrift shop, and having used the following BASIC program
sc%=0
sp%=0
10 if sc%=57 then 90
REM exits on space bar, since that's usually easy to find
REM and outputs the correct code
sc% = inp(96)
if sc%<>sp% then print hex$(sc%): sp%=sc%
goto 10
90 end
to plumb its scan codes, I obtained the information about its Scan Code Set 1 codes shown above.
Of course, it actually outputs Scan Code Set 2 codes, obtainable by translation. Some keys, particularly the keyboard Enter key in the location of the right Ctrl key, do have special handling of their make and break codes, but the special operations of the 101-key keyboard are not present.
The two other popular 122-key keyboards are that made by KeyTronic and that formerly made by IBM and now by Lexmark. (As may be expected, I won't be satisfied until I can exhibit the scan codes for all three now.) As noted, I suspect the Set 3 codes given in the table above correspond to those of IBM's keyboard. The keyboard Enter key actually outputs the sequence FA F0 BA and so I'm assuming that BA is a break code in the table above. The FA code in the sequence appears to be acting as a break code for NumLock, and so it isn't always output.
The Nokia keyboard was described on a web page cited above as one of my sources; since it implements the extra keys by applying shifts to standard keys, it seemed simplest to describe the keyboard in terms of keys rather than scan codes: the scan codes are what a standard 101-key keyboard would send when the named keys are pressed.
A keyboard such as the Nokia makes the extra keys more limited than regular keys, since now they are not distinct in every shift. The Memorex-Telex doesn't assign the codes for keys F1 to F12 to keys F1 to F12, which is an incompatibility difficult to accept; although one cannot but forgive it, since that keyboard was designed before those keys were added to the PC keyboard by IBM. The IBM layout would be the sensible one to regard as the standard, and so I hope soon to learn the complete set of scan codes for it in Scan Code Set 1 or Set 2 that I can add them to this page.
In addition to helping me decide what scan codes to use for the compact keyboard above, the appropriate scan codes for an ultimate keyboard of the kind shown below might be possible to decide upon:

Note that, in the numeric keypad, there are two adjacent keys which both generate the - character. As may be obvious, though, the intent is that the numeric keypad might be used for a calculator, and the white - key (scan code E0 4A, or perhaps more likely E0 0C with forced unshift, as that scan code could be distinguished even by software designed for the 101-key keyboard) would be the "change sign" key, while the blue - key (scan code 4A) would be the "subtract" key.
Actually, in practice, it might be necessary to get just a little bit more ultimate:

while using the ten keys to the left of the main keyboard for the left-over functions is sensible, as there are different Group 3 scan codes defined for the keys involved, it seems necessary to keep the keys in the traditional 101-key keyboard positions. As well, an Fn key is added, to allow choosing between different scan code sets for compatibility with different 122-key keyboards, for example.
Note that the three keys to the right of the letter P do not have the same positions as on the 102-key keyboard. As well, if I had been designing a keyboard from scratch, rather than one to provide compatibility with a number of keyboards for the IBM PC, I would have interchanged the backslash (\) and tilde (~) characters, so that the \ ` key would be at a remote position on the keyboard, while the | ~ key would be the one key with less common characters within the main 44-key area of the keyboard. (Of course, having an [ ] key in that position would have the advantage of providing the uppercase subset of ASCII, along with the lower-case letters, in that area, as was done on the TRS-80 Model 100 notebook computer, but as that loses the arrangement of { [ and } ] keys, I would not consider it.)
Thus, the first keyboard shown here was a 130-key keyboard; the 122-key keyboard with five calculator keys and three Windows keys added, and this keyboard is now a 139-key keyboard, with five keys from the 101-keyboard returned to the array, and three keys from the 84-key keyboard of the IBM Personal Computer AT added for total compatibility with really old computer games, and with an Fn key added.
One possible set of scan codes for the keys of this keyboard might run as follows:
In Scan Code Set 1:
--------------- --------------- --------------- -----------
| 5B| 5C| 5D| 63| | 64| 65| 66| 67| | 68| 69| 6A| 6B| | 37| 46| 54|
--- |---------------| |---------------| |---------------| |-----------|
| 01| | 3B| 3C| 3D| 3E| | 3F| 40| 41| 42| | 43| 44| 57| 58| |+37|+46|+45|
--- --------------- --------------- --------------- -----------
------- --------------------------------------------------------- ----------- -------------------
|-3B|-3C| | 29| 02| 03| 04| 05| 06| 07| 08| 09| 0A| 0B| 0C| 0D| 0E| |*52|*47|*49| |+0A|+0B|+33|-39|+35|
|-------| |---------------------------------------------------------| |-----------| |-------------------|
|-3D|-3E| | 0F| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 2B| 1A| 1B| |*53|*4F|*51| | 47| 48| 49|+0F|+37|
|-------| |---------------------------------------------------------| ----------- |-------------------|
|-3F|-40| | 3A| 1E| 1F| 20| 21| 22| 23| 24| 25| 26| 27| 28| 1C| |*48| | 4B| 4C| 4D|+0C| 4A|
|-------| |---------------------------------------------------------| ----------- |-------------------|
|-41|-42| | 56| 2A| 2C| 2D| 2E| 2F| 30| 31| 32| 33| 34| 35| 36| |*4B|*4C|*4D| | 4F| 50| 51| | 4E|
|-------| |---------------------------------------------------------| |-----------| |-----------|-1C|---|
|-43|-44| | 1D|-5B| 38| 39|-38|-5C|-5D|-1D| |***|*50| 45| | 52| 53| |+0D|
------- --------------------------------------------------------- ----------- -------------------
Thus, we have keypad =, (, ), tab, space, and comma using the E0 code combined with forced unshift in the same manner as keypad /; the key in the middle of the cursor cluster corresponds to the 5 key in the numeric keypad in the same way that the other cursor cluster keys correspond to their counterparts.
As to the appropriate codes for the keys to the left of the main alphabetic area, they are derived by adding E0 to the codes for F1 through F10, since the purpose they serve when used with a computer running as a PC is to provide an alternate set of function keys. Originally, it was only envisaged these keys would be used when the keyboard is functioning as a 122-key keyboard, and so it was more difficult to determine what scan codes should be used; not having found the appropriate documentation, I had settled for this series of scan codes: 70, 71, 72, 73, 74, 6D, 6E, 6F, E0 43, and E0 44 for the keys in the F1 through F10 positions respectively for the diagram above for scan code set 1.
In Scan Code Set 3:
--------------- --------------- --------------- -----------
| 08| 10| 1B| 20| | 2B| 30| 38| 40| | 48| 50| 57| 5F| | 97| 98| 99|
--- |---------------| |---------------| |---------------| |-----------|
| 8E| | 07| 0F| 17| 1F| | 27| 2F| 37| 3F| | 47| 4F| 58| 5E| | 8F| 90| 91|
--- --------------- --------------- --------------- -----------
------- --------------------------------------------------------- ----------- -------------------
| 05| 06| | 0E| 18| 1E| 26| 25| 2E| 36| 3D| 3E| 46| 45| 4E| 55| 66| | 67| 6E| 6F| | 76| 77| 7E| 84| 96|
|-------| |---------------------------------------------------------| |-----------| |-------------------|
| 04| 0C| | 0D| 15| 1D| 24| 2D| 2C| 35| 3C| 43| 44| 4D| 5B| 54| 53| | 64| 65| 6D| | 6C| 75| 7D| 7C| 95|
|-------| |---------------------------------------------------------| ----------- |-------------------|
| 03| 0E| | 14| 1C| 1B| 23| 2B| 34| 33| 3B| 42| 43| 4C| 52| 5A| | 63| | 6B| 73| 74| 7B| 94|
|-------| |---------------------------------------------------------| ----------- |-------------------|
| 83| 0A| | 13| 12| 1A| 22| 21| 2A| 32| 31| 3A| 41| 49| 4A| 59| | 61| 62| 6A| | 69| 72| 7A| | 93|
|-------| |---------------------------------------------------------| |-----------| |-----------| 79|---|
| 01| 09| | 11| 8B| 19| 29| 39| 8C| 8D| 58| |***| 60| 8D| | 70| 71| | 92|
------- --------------------------------------------------------- ----------- -------------------
The codes in Scan Code Set 3 are shown as being assigned to this keyboard so as to favor the use of the keyboard as a 122-key keyboard for communications purposes, while the ones for sets 1 (and 2) are assigned so as to favor use as a keyboard compatible with a 101-key PC keyboard. Of course, the way in which the codes from 8D to 99 run is completely arbitrary here, and there may be reasons to make other assignments.
This short table shows how I have assigned these codes:
assigned not
Num Lock 8D 76
Esc 8E 08
Print Screen/Sys Req 8F 57
Scroll Lock 90 5F
Pause/Break 91 62
= KP 92
+ KP 93 7C
- KP 94 84
* KP 95 7E
/ KP 96 77
*/Print 97
Scroll Lock/Break 98
Sys Req 99
The fact that there are no distinct scan codes in Group 3 for the five keys taken out of the group of ten keys to the left of the main alphabetic keyboard almost suggests that it might be possible to leave those keys there; however, in that case, since there are Set 1 and Set 2 scan codes for those keys, incompatibilities with 122-key terminal software would arise; of course, such incompatibilities would still be present for the numeric keypad area for such software that relied on those sets of scan codes. This is what makes the Fn key necessary; the keyboard would have to have the ability of being switched to alternate scan code sets.
Of course, it is also envisaged that the keyboard could have, in addition to the keys shown, keys for the Internet and multimedia functions offered by many keyboards.
Another situation that is interesting to consider involves a keyboard like the following, shown on an earlier page:

This keyboard is designed to include the different keys found on the 122-key Host Connected keyboard and the different keys found on keyboards for Sun workstations. The Microsoft standard for USB scan codes includes codes for the different keys for these keyboards, as well as for the Macintosh. Because keys for different functions occupy the same positions on the keyboard, though, for these respective computers, a USB keyboard intended for use on these different computers would need to change the scan code it uses for a few of the keys depending on which computer it is connected to.
One can start from this basic layout:
--------------- --------------- ---------------
| 68| 69| 6A| 6B| | 6C| 6D| 6E| 6F| | 70| 71| 72| 73|
------- --- |---------------| |---------------| |---------------| -----------
| 75| | 8E| | 3A| 3B| 3C| 3D| | 3E| 3F| 40| 41| | 42| 43| 44| 45| | 46| 47| 48|
------- --- --------------- --------------- --------------- -----------
------- --------------------------------------------------------- ----------- -------------------
| 78| 79| | 35| 1E| 1F| 20| 21| 22| 23| 24| 25| 26| 27| 2D| 2E| 2A| | 49| 4A| 4B| | | | 85| | 54|
|-------| |---------------------------------------------------------| |-----------| |-------------------|
| A3| 7A| | 2B| 14| 1A| 08| 15| 17| 1C| 18| 0C| 12| 13| 2F| 30| 31| | 4C| 4D| 4E| | 5F| 60| 61| 7C| 55|
|-------| |---------------------------------------------------------| ----------- |-------------------|
| A4| 7C| | 39| 04| 16| 07| 09| 0A| 0B| 0D| 0E| 0F| 33| 34| 28| | 52| | 5C| 5D| 5E| | 56|
|-------| |---------------------------------------------------------| ----------- |-------------------|
| A1| 7D| | 64| E1| 1D| 1B| 06| 19| 05| 11| 10| 36| 37| 38| E5| | 50| 62| 4F| | 59| 5A| 5B| | 57|
|-------| |---------------------------------------------------------| |-----------| |-----------| 58|---|
| 7E| 7B| | E0| E3| E2| 2C| E6| E7| 65| E4| |***| 51| 53| | 62| 63| | 67|
------- --------------------------------------------------------- ----------- -------------------
For a Macintosh, since the Print Screen, Scroll Lock, and Pause keys are instead labelled F13, F14, and F15, the keys with the codes 46, 47, and 48 acquire the codes 68, 69, and 6A. Also, while the Windows key is on the outside of the Alt key on a PC keyboard, the Alt (or Option) key is on the outside of the Apple key on a Macintosh keyboard, so the scan codes E2 and E3, as well as the scan codes E6 and E7, need to be swapped with each other.
As for the differences between a Sun keyboard and the 122-key Host Connected Keyboard for the group of ten keys to the left, I'll have to admit that I am unsure on how this is supposed to be properly handled.
Note that a discussion of Chinese-language keyboards formerly on this page has been moved to a page within the previous section, and some additional discussion of the history of the keyboard of the IBM PC has been moved to the page following that.
Copyright (c) 2003, 2005, 2007 John J. G. Savard