Macintosh Keyboards: Enter Key Problems Are Key Code Difference


I am experiencing a problem with the Macintosh Portable. It seems that the
Enter key on my Macintosh Portable does not act like an Enter key on any of
our other keyboards.

I am using terminal software that requires the Enter key. Under MacWrite
II, the Enter key causes a page advance. Can you explain?

The ASCII code generated by the Enter key is $03, which is consistent with
all of Apple's keyboards that have Enter keys. The virtual key code,
however, is not the same on all Apple keyboards. Here is a list of
Macintosh keyboards and the virtual key codes their Enter keys return:


Macintosh Keyboard Virtual Key Code
------------------ ----------------
Macintosh 128K, 512K Keyboard $34
Macintosh 128K, 512K Numeric Keypad $4C
Macintosh Plus Keyboard $4C
Macintosh Standard Keyboard (ADB) $4C
Macintosh Extended Keyboard (ADB) $4C
Apple Keyboard II $4C
Apple Extended Keyboard II $4C
Macintosh Portable Keyboard $34
Macintosh Portable Numeric Keypad $4C
Macintosh PowerBook 100 Keyboard $34
Macintosh PowerBook 140 and 170 Keyboard $34

The fact that the Enter key next to the Space bar on the Macintosh Portable
returns a virtual key code of $34 is most likely the reason the terminal
software is having a problem.

These keys have different virtual key codes because it is possible to have
two different Enter keys with these keyboards. The authors of the terminal
software are not taking into account the possibility of a different virtual
key code for the Enter key -- they are looking at the ASCII code of the key
being pressed.


Published Date: Feb 18, 2012