[comp.sys.handhelds] HP48 - Table of installed Libraries

herman@corpane.uucp (Harry Herman) (06/24/91)

In working with Voyager today, I stumbled across some routines that
Jan Brittenson previously documented as finding the hash table,
message table, link table and configuration routine for a given
library.  Another routine looks in a RAM table to find out if the
given Library is installed.

In looking at the table, it appears to be a counted table of 3 nibble
XLIB numbers followed by the address of the library header for that
library.  The first 3 nibbles is a count of the number of entries in
the table.

The table starts at 707D9h in RAM.
	707D9:	3 nibble entry count
	707DC:  3 nibble Library number
	707DF:  5 nibble address of Library Header
	707E4:	3 nibble Library number
	707E7:	5 nibble address of Library Header
	.
	.
	.

The table appears to be sorted in numeric order by Library Number.

The Library headers that the table points to are examinable with
Voyager V1.0-7's EXAMINE SHORT_LIBRARY command.  The Library Header
consists of a 3 nibble Library number, a 5 nibble offset to the
hash table, a 5 nibble offset to the message table, a 5 nibble offset
to the link table, and a 5 digit offset to the configuration routine.
Note that there is no "Library" prolog, and no name field, and the header
is not immediately in front of the "library".

Based on the table at 707D9h, I found the following Library headers:

	Library Number		Header Address
	000h	  0d		028E5h
	001h	  1d		10F16h
	002h	  2d		189EAh
	003h	  3d		29DB5h
	005h	  5d		35506h
	006h	  6d		2C088h
	00Ah	 10d		32F60h
	00Bh	 11d		0F05Eh
	00Ch	 12d		2D342h
	00Dh	 13d		0CAC0h (same backwards and forwards!)
	019h	 25d		0BE16h (this one has the library ID, but
					all the pointers are empty)
	0F0h	240d		38338h
	(Equation Card libraries go here)
	700h	1792d		22DE7h

As far as I know these are correct, but there could be typo's.  Verify
them before you use them.

I found the address of the table at 707D9h using a memory dump of a Rev B
HP48 that I used to have.  I examined the table with the memory scanner of
a Rev D and used the Rev B memory dump with Voyager to verify that the
addresses from the table in 707D9h were, in fact, library headers.
Therefore, I feel that none of these addresses have changed between Rev B
and Rev D.  I also have a Differences file showing the blocks that have
changed between Rev B and Rev D and Rev B and Rev E, and none of those
addresses appear in those files.  I have never owned a Rev A or Rev C,
so I cannot vouch for those calculators.

				Harry Herman
				herman@corpane

p.s.  Jake, maybe you could add these addresses to the master list.
I don't recall seeing any of them in the list.

ftg0673@tamsun.TAMU.EDU (Rick Grevelle) (06/24/91)

Your explanation of the RAM cache #707D9h is correct.  If you're into
machine language programming, you'll find that the ADDR routine in the
HACKIT library utilizes this cache to determine the location of XLIBs
taken as arguments.  Single stepping the code object that utilizes the
cache would be an excellent example for the application of Jan's MLDL
library.

First it will be necessary to extract the code object from ADDR.  This
is easily done using the ->XLIB, and RCLIB commands also from HACKIT.
Next use the OUT-> command to decompose the RPL object in order for the
code object to be seperated.  Here's how it looks:


			o   Build the XLIB object ADDR.

	_________________________		_________________________
	|{HOME}			|		|{HOME}			|
	|-----------------------|		|-----------------------|
	|4:			|		|4:			|
	|3:			|		|3:			|
	|2:		    1214|		|2:			|
	|1:		      12|		|1:		    ADDR|
	|### ### ### ### ### ###|		|### ### ### ### ### ###|
	-------------------------		-------------------------
      1) Enter the reals 1214, and	      2) Implement ->XLIB to obtian
	 12 in leves one, and two.		 the ADDR command on the stack.


			o   Recall the XLIB's contents.

	_________________________		_________________________
	|{HOME}			|		|{HOME}			|
	|-----------------------|		|-----------------------|
	|1: External External	|		|4:		External|
	|   External Code	|		|3: External <1h> Exte..|
	|   External External	|		|2:		External|
	|   Code External	|		|1:		      11|
	|### ### ### ### ### ###|		|### ### ### ### ### ###|
	-------------------------		-------------------------
      1) Recall the contents of ADDR	      2) Extract the code object from
	 to the stack using RCLIB.		 the RPL object using OUT->.



The code object of interest will now be in level six.  By placing any XLIB
of your choice in level two, and the code object from level six in level one,
the MLDB function from the MLDL library will step through each instruction
of the code object, illustrating just how the data cached at #707D9h is used.

Rick Grevelle