[comp.sys.handhelds] HP 48SX GETKEY

akcs.joehorn@hpcvbbs.UUCP (Joseph K. Horn) (02/08/91)

GETKEY, by Joseph K. Horn

Here's a useful utility for fetching a single key definition, very
much like FETCH KEY on the HP 71.

The following RPL routine works instantly.  Shifted, alpha, and
shifted alpha keys all work.  The only key it won't fetch is ATTN,
which is used to exit the program if desired.

INSTRUCTIONS:  Run it, then press any key.  Its definition will be
recalled to the stack, with its keycode above it.

It is most useful when assigned to a key; fetching a key definition
only takes two keystrokes then.

RPL listing of GETKEY:

02D9D Begin program object
2A2B4 0; for 0 WAIT construct
1A738 Internal WAIT; pause until key press; return rc.p keycode
03188 Internal DUP; float keycode until the end
41CA2 Convert rc.p keycode into <key> <plane> system keycodes
41F3F Recall contents of UserKeys var to the stack
03295 Internal ROT --> { UserKeys } <key>
056B6 Internal GET --> { all 6 definitions on that key } True
03244 Internal DROP; lose the True
63A6F Is the list empty? If so, push a True
6191F If True, DROP2, do next, and end; else skip next
6577B "Undefined"; the entire key is undefined; say so & stop
03223 Internal SWAP --> { the key's 6 definitions } <plane>
056B6 Internal GET --> either the definition or { }, and True
03244 Internal DROP; lose the True
63A6F Is the list empty? If so, push a True
618F7 If True, DROP, do next, and end; else skip next
6577B "Undefined"; that key is undefined; say so & stop
0312B End program; exit with keycode floating above definition.

---- GETKEY in Wickes' ASC format -------------------------------
%%HP:;
"D9D204B2A2837A1881302AC14F3F14592306B65044230F6A36F1916B77563223
06B65044230F6A367F816B7756B2130D94E"
-----------------------------------------------------------------

Before ASC-> conversion: Size 105,  CRC #144Ch.
After ASC-> conversion:  Size 47.5, CRC #E49Dh.

Thanks to Rick Grevelle and Derek Nickel who made this possible.

-- Joseph K. Horn -- Peripheral Vision, Ltd. --