KYLIB, Key Assignments Utility Library, by Simone Rapisarda A Subset of the SmartKeys Library (on GD7 & GD9), extracted by Joseph K. Horn For S/SX/G/GX! (Works okay in a GX high port). Finally! GX owners can use key assignments as easily as variables! [Note: Simone never updated his SmartKeys library to work on the GX. I missed its basic commands. So I yanked them out, modified them to work on any version HP48, and made this new, tiny library. The credit for the original code goes entirely to Simone. The blame for any errors introduced afterwards lies entirely with me. -jkh-] Description of each command (in order of appearance) +------+ | ASNK | (Assign Key) +------+ This is a dual command: (1) When executed from the keyboard: Needs one argument: (1:Any). Waits for a key to be pressed and assigns the object in level one to that key. If an object is already assigned to that key, the command LASTARG, if active, will push to level one the old assignment. To abort the command execution you can press any key two times quickly. (2) When executed by a running program (or from the command line): Needs two arguments: (2:Any, 1:Real). When the Real on level one is a 0 the object in level two must be a List, it is passed to a program that behaves like the built-in command STOKEYS that is documented on the HP48 User's Manual. For any other Real ASNK behaves just like the built-in command ASN. ASNK accepts an empty List instead of the Global Name 'SKEY' (to force a key to have its standard definition) in order to save keystrokes. +------+ | RCLK | (Recall Key) +------+ This is a dual command: (1) When executed from the keyboard: Needs no arguments. Waits for a key to be pressed and recalls to level one the object assigned to that key. If no object is assigned to that key, the HP48 will just beep. To abort the command execution you can press any key two times quickly. (2) When executed by a running program (or from the command line): Needs one argument: (1:Real). Recalls to level two the object assigned to the key specified by the Real in rc.p format and pushes the Real 1 on level one. If no object is assigned to that key, only the Real 0 is pushed on level one. If the argument is the Real 0 all the assignments of the current User Keyboard are recalled as the built-in command RCLKEYS does. NOTE: When recalling all the assignments RCLK is three times faster than RCLKEYS. This happens because RCLK uses a stack based algorythm instead of the local_variables based algorythm used by RCLKEYS (strangely the size of both programs is the same). +------+ | DELK | (Delete Key) +------+ This is a dual command: (1) When executed from the keyboard: Needs no arguments. Waits for a key to be pressed and deletes the assignment of that key. If no object is assigned to that key, the HP48 will just beep. If an object is assigned to that key, the command LASTARG, if active, will push to level one the old assignment. To abort the command execution you can press any key two times quickly. (2) When executed by a running program (or from the command line): Needs one argument: (1:Real/List/Global_Name/Local_Name). Same syntax as the built-in HP48 command DELKEYS; for details, see your HP48 manual. +----------+ | PACKKEYS | (Pack Key Assignments) +----------+ Needs no arguments. Packs the User key assignments into their most compact form to save memory. As User key assignments are made or deleted (using the built-in commands ASN, STOKEYS, and DELKEYS) a certain amount of memory is wasted. You can free this memory for other uses by packing the User key assignment with PACKKEYS. Note: You don't need to PACKKEYS after using ASNK or DELK; they automatically pack the assignments. NOTE: The command sequence described in the HP48 manual (RCLKEYS 0 DELKEYS STOKEYS) has a little bug/feature: if the unassigned keys are disabled (by 'S' DELKEYS), after its execution they will all be re-enabled. The command PACKKEYS, instead, does not change the unassigned keys state. It also packs the User key assignments into a more compact form almost immediately, unlike the HP48 manual's routine, which is very slow.