[comp.sys.handhelds] Libraries on the '48

gingell@aurs01.uucp (Mike Gingell) (05/15/91)

Why is it that every .lib file I have seen so far
gives different and (for me, so far) unworkable instructions
on how to attach a library on the HP48?.  Even the 2 volume
manual with the 48 devotes only 1 page to the subject and
is copletely unhelpful.

For instance the stopwatch library from HP's own bbs tells
you to transfer the file to the 48 using kermit and recall
it in the VAR menu - OK so far. Then it says to enter 0, 1
or 2 and press STO. - WRONG. Whatever I do I get error
messages. The manual implies that you should enter :0:Name
to store a library in the port - that works but seems to be
no good for attaching the library - which the manual does not
explain.

Can some kind soul please explain the correct syntax for
doing this with a WORKING example. Note I have only 32k so
only PORT 0 is valid.

Your undying grateful servant (If you get me out of this) ...


Mike Gingell, Alcatel, Raleigh, NC USA  (919) 850-6444
UUCP:       ...!mcnc!aurgate!aurfs1!gingell
Internet:   gingell%aurfs1%aurgate@mcnc.org

TDSTRONG%MTUS5.cts.mtu.edu@CUNYVM.CUNY.EDU (Tim Strong) (05/16/91)

>
>Why is it that every .lib file I have seen so far
>gives different and (for me, so far) unworkable instructions
>on how to attach a library on the HP48?.  Even the 2 volume
>manual with the 48 devotes only 1 page to the subject and
>is copletely unhelpful.
>
>For instance the stopwatch library from HP's own bbs tells
>you to transfer the file to the 48 using kermit and recall
>it in the VAR menu - OK so far. Then it says to enter 0, 1
>or 2 and press STO. - WRONG. Whatever I do I get error
>messages. The manual implies that you should enter :0:Name
>to store a library in the port - that works but seems to be
>no good for attaching the library - which the manual does not
>explain.
>

There are two kinds of library files.  Those that install themselves (sort
of) and those you have to install.  I believe the Stopwatch library is one
of the former.  Anyway maybe this will shed some light into the darkness....

If a library installs itself you merely have to store it to a port (port0)
if you don't have any memory cards installed.  This is done as follows:

Put the library on the stack and enter

: port number : number of library

for example if you load in the HACKIT library you get a varible called
HACKIT.  Press HACKIT and the following is put on the stack

Library 1214:   HACKIT

now to put in into port 0

:0: 1214

STO

Now you go to the directory you want the library installed and turn the mahine
off.  When you turn the machine on the code in the library that installs it
runs and if you Press LIBRARY menu you get a box called HACKIT  There you are.


If the library doesn't install itself you store it as before.  Turn the
machine off and then back on (I guess it has to update some pointers or
something) then do the following

Let us supposed I store a library labelled 1000 in port 0

then simply

:0: 1000   ATTACH


I hope this helps.  Its kinda hurried because I have a test in a few minutes
If your still stuck I'll give it another shot.

======================================================================
  ___
  I__)  _   _I  _   _   Tim Strong <TDSTRONG@MTUS5.cts.mtu.edu>
  I  \ (_I (_I (_I I    Michigan Tech.    Houghton, Michigan, U.S.A.

======================================================================

akcs.joehorn@hpcvbbs.UUCP (Joseph K. Horn) (05/17/91)

Tim Strong beat me to it, but since I wrote this up last night, here
'tis...

Mike Gingell writes:

> Why is it that every .lib file I have seen so far gives different and
> (for me, so far) unworkable instructions on how to attach a library
> on the HP48?.  Even the 2 volume manual with the 48 devotes only 1
> page to the subject and is completely unhelpful.

> For instance the stopwatch library from HP's own bbs tells you to
> transfer the file to the 48 using kermit and recall it in the VAR
> menu - OK so far. Then it says to enter 0, 1 or 2 and press STO. -
> WRONG. Whatever I do I get error messages. The manual implies that
> you should enter :0:Name to store a library in the port - that works
> but seems to be no good for attaching the library - which the manual
> does not explain.

> Can some kind soul please explain the correct syntax for doing this
> with a WORKING example. Note I have only 32k so only PORT 0 is valid.
> Your undying grateful servant (If you get me out of this) ...

> Mike Gingell, Alcatel, Raleigh, NC USA  (919) 850-6444
> UUCP:       ...!mcnc!aurgate!aurfs1!gingell
> Internet:   gingell%aurfs1%aurgate@mcnc.org

Mike: Did you find the manual totally confusing and frustrating
concerning this business of "attaching libraries"?  I sure did.

The most important concept, "attach", is not explained.  Allow me.

As you know, the HP 48 allows the user to create directories and
subdirectories so that variables can be grouped in logically related
bundles.  For instance, all your financial variables { PV FV PMT ... }
can be cooped up in a directory called FIN.

Libraries by their nature add new features to the HP 48.  Ordinarily
these features are available to you no matter what directory you're in.
That's the beauty of libraries; they magically extend the built-in
language and features of the HP 48.  (They were called "lexfiles" on
the HP-75 and HP-71; it stood for "language extension files".)

But suppose a particular library's features are only needed in a
particular directory.  For example, suppose you only want HP's Finance
Library (library 270, in the EQ Card) to be active when you're in your
FIN directory.  That would be nice, because if you press TVM by mistake
(via key assignment, or custom menu key) it can create a bunch of
financial variables that you don't want anywhere except in your FIN
directory.  (I hate it when variables suddenly appear which I didn't
ask for.)  HP lets you prevent TVM from laying such unwanted eggs
outside its proper henhouse.

This special limiting of a library's features is called "attaching it
to a directory."  If you attach the Finance library to the FIN
directory, then you won't have to worry about the TVM function in the
Finance library laying scrambled eggs.  In fact, the [LIBRARY] menu
won't even show the Finance library when you're not in the FIN
directory!  (You CAN attach it to more than one directory, but that
defeats the whole purpose, and is a Bad Thing.)

Since the basic idea of libraries is to extend the built-in language,
you can attach as many libraries as you want to the HOME directory. 
Unfortunately, you can only attach one library to each directory; if
you try to attach another one, the old one will get detached.  No
problem; make a submenu, and attach it there.

Many libraries contain an "auto-attach" routine that attaches the
library to the HOME directory automatically.  These libraries never
need (nor ought) to be attached to anything else.  But a normal library
needs you to attach it to a directory before it can be used.

How to do it?  Dehydrated instructions: download it; recall it to the
stack; 0 STO; purge it; OFF ON.  If it's not automatically attached,
then go to the directory you want it attached to, and key its ID number
and press [ATTACH].  That's all there is to it.

Here is a step-by-step real-world guaranteed WORKING EXAMPLE:

There is a library on the EduCALC Goodies Disk #1 called 'ROLDX.LIB'. 
(1) Download it.  (2) Press [VAR] [ROLDX] and see "Library 807: ROLDX
:Rolodex ver 1.0". (Press down-arrow to see the whole thing).  (3) Key
[0] [STO].  It'll get stored into port 0.  (4) Press ' [ROLDX] [ENTER]
and see 'ROLDX.LIB' on the stack; now press [PURGE] and it'll get
purged from main memory.  (5) Now press [OFF] and [ON].  The display
will hiccup.  (6) Press [LIBRARY] and you'll see a new entry, [ROLDX].
This library auto-attached to the HOME menu.

Here are the generalized steps required, and the results of each step:

(1) Transfer the library to the HP 48.  Press [VAR] and see the menu
key for the new library object.  It is now residing in a named
variable, but cannot be activated until it resides in a port.

(2) Press its menu key.  See "Library nnnn: ..." on level 1.  It is now
in two places: the named variable, and in the stack.  (This implies
that you cannot load a library bigger than half of available memory.) 
Note!  If you see a string of garbage, or any other kind of object,
then the original file is not a library!  Contrary to millions of
messages here, setting your HP 48's ASCII/binary mode has NOTHING to do
with it, because libraries always get transferred in binary mode,
regardless of the HP 48's setting (see Owner's Manual, page 629, third
paragraph, and page 631, second paragraph).

(3) Key: [0] [STO].  The library will vanish from level 1.  It is now
in two places: the named variable, and in port 0 with no name, but not
activated yet.  (The books and Bill Wickes always specify :0:NAME STO
instead of 0 STO.  They both have the same effect, so why bother keying
a name that's ignored?)

(4) Purge the named variable from main memory (you can do that easily
by pressing ' and then the menu key and then [PURGE]).  The library is
now only in one place: port 0, not yet activated.

(5) Turn the HP 48 off and back on.  The display will hiccup,
indicating that the library is being made "attachable" and (in most
cases) it is automatically attached to the HOME menu.  Press the
[LIBRARY] menu key and then press the [REVIEW] key; you should see your
new library listed there, complete with name and description.  If so,
stop; the process is done.

(6) If you don't, it might not be an auto-attaching library, in which
case you must attach it yourself.  First, decide which directory you
want the library to be active in, and go there.  When you activate a
library, it gets "attached" to whatever directory you happen to be in
at the moment, and the library's commands will only be available in
that directory.  If you want it to be active everywhere, go HOME.  The
manual is a bit unclear about all this.

(7) Key the ID number of the library, and press [MEMORY] [NXT]
[ATTACH].  (If you can't remember the ID Number of the library, press
[LIBRARY] [PORT 0] and see the library on a menu key, but instead of a
name, it only shows a number.  The number is the library's ID.  If you
wish to make sure that it's the correct library, press the menu key,
and the library will be recalled to the stack, where you can see its
name.)

Purging libraries from the HP 48 can be a real chore!  They sometimes
are so tenacious that they seem to be "attached" with superglue!

The easiest way to do it is:

(1) Get into the directory to which it's attached.  You MUST do this,
or you won't be able to purge it!

(2) Press [LIBRARY] [PORT 0] [ENTRY]  (that's the blue-shifted alpha
key), then press the menu key for the library you wish to purge, and
press [ENTER] [ENTER].  See something like 0: 807 twice on the stack.

(3) Press [MEMORY] [NXT] [DETACH] [PURGE].  This violent lobotomy,
performed with the patient fully conscious and without anesthesia,
causes the HP 48's face to momentarily contort in unmistakable anguish. 
Bill Wickes says he likes it.  It gives me the willies.

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