[comp.sys.handhelds] hp28s tricks

lien@plains.UUCP (Craig Lien) (01/11/90)

During the long Christmas vacation I was at my cousins house in Arizona.
He had an hp-28S and I also have one, so I looked at his and man did he have
some neat stuff!  But when I asked how he did it he said "It took many
hours of screwing around and typing stuff in again, also some of the stuff
is kind of dangerous."  I tried to look at some of the stuff and there were
chr(0)'s everywhere so I couldn't look at things (even in the names) so RCL
wouldn't work very well.

1. He had directories that would automatically run ".profile" (like ksh on
unix) ".profile" would set all the modes and setup the custom menu.

2. He had a directory to string program to move a directory anywhere.
I could use a program like that because I have physics class directory
and a common functions directory (i.e. volumes and what not) but I would
like the physics directory to be inside the functions directory.

3. He had ".." and ".".  The ".." is like the "UP" that originated in the
manual and amended by many people on this group.  The "." would go to home
and return everything back to his defaults.  

I've read some of the stuff that has been posted to this group and have
found it interesting.  If anyone has any ideas on how this is done, could
I get your help?  I understand that most of the programs will be in
machine language.

Thanks,
Craig.

-- 

           We've come a long way since the world was flat.
                       lien@plains.nodak.edu 

jrl@images.Waterloo.NCR.COM (john Latala) (01/12/90)

In article <3109@plains.UUCP> lien@plains.UUCP (Craig Lien) writes:
...
>2. He had a directory to string program to move a directory anywhere.
>I could use a program like that because I have physics class directory
>and a common functions directory (i.e. volumes and what not) but I would
>like the physics directory to be inside the functions directory.
...

I had the same problem of moving things around in your HP28s. You put things
where you think they should be and a couple of days later you want to
(have to) move it.

What I came up with is two programs PACK and UNPACK. PACK takes a list
of objects and packs those objects, and their names into another list.

If you had the list:

	{ PACK UNPACK } 

on the stack, then ran the PACK program you would end up with the list:

	{ << code for PACK >> PACK << code for UNPACK >> UNPACK }

left on the stack. You then move to the destination directory and run
UNPACK to recreate the original variables. Once you have everything
UNPACKed then go back to the source directory and purge the originals. 

UNPACK does its thing by exploding the list to get:

	<< code for PACK >> 
	'PACK'
	<< code for UNPACK >> 
	'UNPACK'

and then executing the correct number of STO commands.

It's not really tricky, but it does work.

Checksums for the programs are:

	PACK	85D5
	UNPACK	5DC6

-------------------- Start of PACK and UNPACK --------------------

;------------------------------------------------------------------------------
;
;>>> PACK - pack a number of objects that should be packed into a single
;		list. PACK will ignore any directories in the list so it
;		can be given the output of a VARS command.
;
;	Takes one arguments:
;
;		v - a list of objects to pack
;
;	Returns:
;
;		a list that has all the objects packed inside it along 
;		with those object's names.
;
;------------------------------------------------------------------------------

<< 
  { } 
  -> v list
  <<
    WHILE v SIZE 0 != REPEAT	; as long as there's things to pack
      v 1 GET			; get a name from the list
      DUP ->STR DUP SIZE 1 - 2 SWAP SUB	; get objects name as a string
      "Packing: " SWAP + 1 DISP	; display it pn the first line

      ; if it's not a directory add it to the list

      IFERR DUP RCL SWAP 2 ->LIST list SWAP + 'list' STO THEN
        DROP DROP		; it was a directory, ignore it
      END
      v 2 v SIZE SUB		; remove the name of the object we just packed.
      'v' STO
    END
    list			; return the PACKed list
    CLMF
  >>
>>

;------------------------------------------------------------------------------
;
;>>> UNPACK - unpack a list packed by PACK
;
;	Takes one argument:
;
;		list - a PACKed list
;
;	Returns:
;
;		all the packed objects in the list recreated in variables
;		in the current directory.
;
;------------------------------------------------------------------------------

<< 
  LIST-> 2 / IP 1 SWAP		; how many PACKed objects in the list?
  START
    DUP ->STR DUP SIZE 1 - 2 SWAP SUB ; get the objects name as a string
    "Unpacking: " SWAP + 1 DISP	; display it
    STO				; store the object
  NEXT
  CLMF
>>

-------------------- End of PACK and UNPACK --------------------

TIP:

After I've made my list of objects that I want to move ( a lot of times
is just a VARS command) before I run the PACK program I do an ENTER to
duplicate the name list. I leave it on the stack and when I want to
delete the originals I just go back to the correct directory and then
use the PURGE command.
-- 
john.Latala@Waterloo.NCR.COM