[comp.sys.handhelds] User-defined libraries: how?

ji@close.cs.columbia.edu (John Ioannidis) (03/14/90)

I'm quoting from the hp-48sx manual, page 651:

	A _library_ is an objet that contains named objects that can act as
	an extension to the built-in command set. you cannot view or change
	the contents of a library. Libraries can exist in application cards,
	or they may be copied into RAM. Howeve, libaries cannot be created by
	the HP48. 
	
Like any self-respecting HP-calculator-old-timer, I take that "cannot
be created" as a challenge. My understanding is that the there is no
*physical* difference between the port ram or rom and the built-in ram
and rom; the address space appears to be linear, and there is probably
some table that defines what part of the memory is rom, what is
"independent" (or whatever they call it) ram and what is user ram.
(in the 41 they were completely disjoint address spaces and they were
accessed using completely different machine instructions). 

My guess is that it should be possible to create an object in ram, then
fiddle with its attributes using the "front panel" hex editor and have
the machine think it's a "library" (since, after all, libraries can be
copied in ram. This could even be a way of getting around the various
bugs in the early releases of the firmware.

Is anyone workign along those lines? Will information like this be
available in the "programmer's reference manual"? 

Speaking of which, can anyone from HP tell us what is expected to be
there? I don't want a hand-holding tutorial on user-level programming,
I want details of how to access low-level features effeciently (like
scrolling regions of the display, defining my own fonts and commands, etc). 

/ji

ge@kunivv1.sci.kun.nl (Ge' Weijers) (03/15/90)

ji@close.cs.columbia.edu (John Ioannidis) writes:

>I'm quoting from the hp-48sx manual, page 651:

>	A _library_ is an objet that contains named objects that can act as
>	an extension to the built-in command set. you cannot view or change
>	the contents of a library. Libraries can exist in application cards,
>	or they may be copied into RAM. Howeve, libaries cannot be created by
>	the HP48. 
>	
(Lost deleted)

What about a 'fix those revision A bugs' library. This might be possible.
Perhaps someone from HP could go talk to the authors of the Macintosh 
operating system, who have made patching ROMs into a fine art :-).
(You did put some vectors in RAM, did you?)

Ge' Weijers
Ge' Weijers                                    Internet/UUCP: ge@cs.kun.nl
Faculty of Mathematics and Computer Science,   (uunet.uu.net!cs.kun.nl!ge)
University of Nijmegen, Toernooiveld 1         
6525 ED Nijmegen, the Netherlands              tel. +3180612483 (UTC-2)

alonzo@microsoft.UUCP (Alonzo GARIEPY) (03/17/90)

In article <6757@columbia.edu| ji@close.cs.columbia.edu (John Ioannidis) writes:
| My guess is that it should be possible to create an object in ram, then
| fiddle with its attributes using the "front panel" hex editor and have
| the machine think it's a "library".

You are entirely correct on all counts.  There are already libraries
you can download from your PC (e.g., stopwatch).  These are just objects
that could be created on the calculator itself.  For any heavy duty
development, it will be much easier to do it on the PC.

Alonzo

billw@hpcvra.CV.HP.COM (William C Wickes) (03/20/90)

Alonzo's reply is a bit overstated.  A library is in effect a compiled
directory, in which variable names have been replaced by a hash table for
faster access.  Access to the library's objects is then provided by
XLIB name objects rather than global names.

Libraries may also contain message tables, nameless objects, and configuration
code.

If you change the "prolog" code of an arbitrary object into that of a library,
the result won't have any useful purpose.

lishka@uwslh.slh.wisc.edu (Chris Lishka (programmer at large) ) (03/24/90)

billw@hpcvra.CV.HP.COM (William C Wickes) writes:

>[...]  A library is in effect a compiled
>directory, in which variable names have been replaced by a hash table for
>faster access.  Access to the library's objects is then provided by
>XLIB name objects rather than global names.

>Libraries may also contain message tables, nameless objects, and configuration
>code.

It would be nice if HP provided a program to create your own XLIB's.
Maybe as part of a "programmer's toolkit" (i.e. I would be willing to
pay some $$'s for it).  I would love to be able to create a library of
my own functions and attach it to the HOME directory. 

Currently my HOME holds all of the functions that I need to be
globally accessible.  This makes HOME sort of a cluttered mess, and I
use another directory "root" as my "virtual HOME" directory. 

-- 
Christopher Lishka 608-262-4485  "Somebody said to me, `But the Beatles were
Wisconsin State Lab. of Hygiene  antimaterialistic.'  That's a huge myth.  John
   lishka@uwslh.slh.wisc.edu     and I literally used to sit down and say `Now,
   uunet!uwvax!uwslh!lishka      let's write a swimming pool'."--Paul McCartney

jc@atcmp.nl (Jan Christiaan van Winkel) (03/25/90)

From article <1990Mar24.150025.3405@uwslh.slh.wisc.edu>, by lishka@uwslh.slh.wisc.edu (Chris Lishka (programmer at large) ):
> Currently my HOME holds all of the functions that I need to be
> globally accessible.  This makes HOME sort of a cluttered mess, and I
> use another directory "root" as my "virtual HOME" directory. 

I have posted the following before, but since you 'problem' can be solved
by the things below, I repost it here:

For routines that any program may need, I have created a special directory
in the top directory called lib. To use the library routine, you push all
the routine's arguments and it's name. the call SVC (stands for SerVice Call)
which also resides in the top directory.

Source for SVC follows:
<<
  PATH -> OWD                        // save the old directory
  << HOME LIB RCL                    // push the library routine on the stack
     1 OWD SIZE FOR I                // now go back to the old directory
	'OWD' I GET EVAL
     NEXT
  >>
  EVAL                               // run the library routine
>>

If you have defined a function, say weekday, that gets a list with the date
(e.g. { 1990 3 26 } ) and returns the day in the week on the stack, you
would store the funtion 'WEEKDAY' in the LIB directory and you would call 
that function as follows:

{ 1990 3 26 }
'WEEKDAY'
SVC

Using this strategy, you don't have to store all you 'globally required'
functions in the home directory.