Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!spool.mu.edu!snorkelwacker.mit.edu!ai-lab!rice-chex!bson From: bson@rice-chex.ai.mit.edu (Jan Brittenson) Newsgroups: comp.sys.handhelds Subject: The internal HP-48 catalog [was Re: Matrix Writer] Keywords: hp48 internals Message-ID: <14094@life.ai.mit.edu> Date: 18 Mar 91 17:00:01 GMT Article-I.D.: life.14094 References: <27defe95:2377.1comp <27df194c:2377.2comp.sys.handhelds;1@hpcvbbs.UUCP> <11222@jarthur.Claremont.EDU> Sender: news@ai.mit.edu Organization: nil Lines: 100 In a posting of [14 Mar 91 19:28:26 GMT] bgribble@jarthur.Claremont.EDU (Bill Gribble) writes: > speaking of non-programmable functions, does anybody know how the > catalog environment works? since the same object is probably used by > the stat and plot/solve routines, it looks like some sort of object > filter is passed to the catalog and only certain objects are > displayed. Here are some basics. A basic catalog routine is at #47bf0. It is called with two arguments: 2: menu.program 1: items.list The menu is an internal menu, which basically is a program returning a list, which is the menu list. The menu list is a list of lists, like the CST menu: { { name exec } { name exec } ... } Unlike CST menus, the `name' component can be more than just a 21x8 GROB or a string: - XLIBs result in the corresponding function name. Useful since it's a relatively short form, it uses the banked ROM instead of the main ROM, and changes whenever a function name is changed. I wonder what happens when a new library is installed with new names but old XLIB numbers? My guess is that certain menus will end up looking different. - Programs are evaluated, and return a string or GROB which is used as a label. This is useful for creating the box bullet to indicate a mode (such as in the MODES menu, for instance). There are plenty of functions that take a string, and a true/false value and return a bullet-box GROB label. The program can of course do whatever fancy evaluation it likes to. Since the menu is a program that is called whenever the stack is redisplayed, it can be used to alter the display. Entering a menu can make you enter a new display, just as easily as the opposite, which incidentally, seems to be predominant. To display the current menu, set the menu argument to @#3ac0 (False). [Note: @#3ac0 here means that you put the Prefixed Machine Code routine at #3ac0 on the stack, not the binary #3ac0. #3ac0 EVALs to itself, so #3ac0 SYSEVAL will do the trick.] Some system catalog menus can be found at: PLOT CAT 484fe STAT CAT 48544 TIME CAT 48585 The items list argument in level 1 is a list of global names. Each item is a global name which will appear as a tag to its contents. For instance, "FOO" 'BAR' STO will appear as: A:"FOO" if "slow" catalog mode is enabled, or: BAR if "fast" catalog mode is currently enabled (check to see what system flag this corresponds to). If the global name doesn't exist, "" will be used instead in "fast" catalog mode. Arrays appear as a description of their dimensions. Alarm entries appear as an alarm description. Place the menu program in level 2 and the list of names in level 1 and call #47bf0. There are numerous RAM hooks which are used by the main catalog driver. In fact, #47bf0 only sets up a certain configuration (as well as saves the previous one in a list in a local variable). I'm not sure about the usage of all of these hooks, but it seems possible to create almost any kind of catalog if just properly configured. For instance, 70614 seems to hold the object to be evaluated in case of an error. (Notice I say SEEMS here, the issue is not clear at all.) It seems to me what you would want to do is to create a list of global names corresponding to the file names, using the #5b15 SYSEVAL (string to global name), and then use the "fast" catalog mode for browsing. The functions in the menu are called when the corresponding key is pressed, and the current index is in one of the local variables (I'm not sure which one - you will have to do some experimentation here). Happy hacking! -- Jan Brittenson bson@ai.mit.edu Read my lisp: no new classes!