[comp.sys.handhelds] HP48SX UP function for Built in Menus

Jake-S@cup.portal.com (Jake G Schwartz) (03/04/90)

                   HP48 UP Key For Built-In Menus

     The folks at HP took a lesson from the 28S and gave us the badly-
needed "UP" function on the HP48 keyboard for moving from a RAM subdirectory
to its parent directory.  However several of the built-in (ROM) menus in the
machine are nested in a tree structure as low as three levels deep.  The
user manual on page 56 advises that one doesn't traverse these like a tree;
one should simply go to the new one.  In many cases, this requires more than
a keystroke or two.
     The HP48 has a function RCLMENU which returns a value containing the
number (in its integer part) and page (in its 2-digit decimal fractional
part) of the currently displayed menu.  (See page 697 of the user manual
for the complete list of numbered menus.)  We may utilize RCLMENU in con-
junction with UPDIR (the programmable version of the keyboard UP function)
to traverse the built-in menu trees as well as the RAM subdirectories.
     Here is a short routine called UP which allows automatic movement from
a RAM or ROM menu to its parent (if one exists), and which is based on a 59-
element list called PARENT.  Element n of the list has the value of the 
menu number and page of the parent corresponding to menu n for menus 1 
through 59.  (Since menu 0 is the LAST menu, it is not considered to be the
current menu for purposes here.)  Note that if the parent menu key leading
to the currently displayed menu is on a page beyond page 1 (such as in the
UNITS submenus which have parents in pages 1 through 3 of the main UNITS
menu), this routine will return to the correct originating page of the
parent.  For menus which do not have a parent, the list element is 0, 
allowing the UP routine to perform a LAST MENU function rather than alter-
nately being a "do nothing" condition.
     IF UP is assigned to the UP keyboard key, its use becomes transparent
when the HP48 is in USER mode.  In the first weeks of calculator use, ROM
menu tree traversal is helpful in order to get a feel for where the 
literally hundreds of functions reside in the machine.

                                           Jake Schwartz
                                           135 Saxby Terrace
                                           Cherry Hill, NJ 08003

                                           609-751-1310 home
                                           609-866-6268 work


PARENT   (59-element list)  443 bytes    #755Dh checksum

{ 0     0     0     3     3     3     3     3     3     0
  10    10    10    10    10    10    0     0     18    0
  0     0     0     0     24    24    24    0     0     29
  0     31    32    0     0     35    35    37    35    0
  40.04 0     42    42    42    42    42    42    42.02 42.02
  40.02 40.02 42.02 42.02 42.03 42.03 42.03 42.03 42 }


UP   78.5 bytes    #3F92h checksum

<< PARENT RCLMENU IP DUP
   IF 2 ==
   THEN DROP DROP UPDIR
   ELSE DUP SUB OBJ-> DROP MENU
   END
>>


Rules:
-----

If the current        The action of 
menu is:              UP is:
-----------------------------------
Menu with no          LAST MENU
parent

Menu with a           Moves to parent
parent                menu, page of
                      parent key

RAM directory         UPDIR

Custom Menu           LAST MENU

Note: if the current menu is one of the manually-entered unnumbered ones,
RCLMENU returns the value of the last numbered menu that was active.  Thus,
UP will move to the parent of THAT menu.



Jake Schwartz