[comp.sys.handhelds] Arrays of Strings

CW%APG.PH.UCL.AC.UK@pucc.PRINCETON.EDU (03/30/91)

     Hi everybody,

     I'm pretty excited!!!!

     If you have the equation library card, then try the following
     (If you haven't then still read on)

             267 ATTACH       @ Attaches what is called'Equation Reference'
                                in the EQ Lib manual pg213.

             #267d            @ Binary integer 267d
             #5A03h SYSEVAL   @ Convert binary to short (You should have
                                <267d> or equivalent on the stack
             #3d
             #5A03h SYSEVAL   @ Gives you <3d>

    So just to make sure you shold have,

                2:                   <273d>
                1:                     <3d>

        on the stack. Then do


             #7E50h SYSEVAL

        This gives you the corresponding XLIB. You should have
        on the stack

                1:               XLIB 267 3


         Then press EVAL

       You get

                  1:           Array of String


       OK Impressed Huh! No! Yeah we've all seen arrays of strings before
       haven't we and there never seemed to be much point to them, Right

        (Sorry there is a lot of point to Arrays of Strings, I was just
        trying to inject a little humour (or was it something else?))

       The only reason I took you through this was to get an array of
       string on the stack that has been correctly created. The fun begins
       next. I have made a discovery!! At least I think its a discovery
       since the machine code at 371Dh is not commented in any of the listings
       I have seen. Store the Array of String in a variable called ArrStr or
       whatever you want, Then you can play with it safely.

           Recall the array of string to the stack and execute SIZE , you
         get

           1:                      { 19 }


         So we can assume there are 19 strings in the array (I hope)

             Now a side step: A quick way to get a System binary on to the
                              stack is to type

                                   :&: Real ENTER EVAL

                               eg, :&: 3 ENTER gives you

                                   1:               &: 3

                                 and EVAL gives you

                                   1:                <3d>

                              This does not work if the real number is the
                              number of an attached library in any port. In
                              that case it tries to recall the library to the
                              stack (wierd undocumented behaviour Huh!). I
                              Can't remember who discovered this but my thanks
                              goes out to that person.


         Anyway back to the example in hand. Assuming you have <3d> in
         level 1 of the stack then recall Array of String to the stack, so
         you have


               2:               <3d>
               1:    Array of String

         Then type the magic incantation


                  #371Dh SYSEVAL and you get

               2:             "Fluids"
               1:             External

        So a string has been extracted!! Try it with any <1d> to <19d>
        and you get the string stored in the array at that point. I
        Think the External might be a True or False for success or failure
        but if you get the twentieth string in the Array it still comes back
        with a string (of garbage) and an external. To be investigated!!

          So to put it more formally,

              1:           System Binary
              2:         Array of String

                    #371Dh SYSEVAL

           Will extract the <System Binary>'th string in the array (as far
       as i can tell).

-------------------------Comments Plus a few extra bits +questions-------------

           All this comes from a mad frenzied attack on dissassembling my
         Equation library ROM (Version A) with a Version D HP48sx. It
         could not be done without Voyager!!!!! Thanks Derek. A few more
         little discoveries so far are

           XLIB 273 78        Centers string for display on screen
           XLIB 266 86     Graphic 7x4   Up arrow in catalog
           XLIB 266 87     Graphic 7x4   Down Arrow in catalog
           XLIB 266 88     Graphic 7x4   Blank

       So some questions,

       Could this address be commented in later version of the internals
       list? Can anybody find a store routine for strings into arrays of string?
       Wheres my coffee?

           I hope this is of some use,

       More later

           Conrad

waterman@engg.ucalgary.ca (jason waterman) (03/31/91)

>       So some questions,
>
>       Could this address be commented in later version of the internals
>       list? Can anybody find a store routine for strings into arrays of string
>       Wheres my coffee?
>
>           I hope this is of some use,
>
>       More later
>
>           Conrad

Two programs were posted about 2 months ago in a set of library and m-code
tools written by Frank Ochoa.  They are ARRAY->S and S->ARRAY.

S->ARRAY takes a list of objects as an arguement and converts them to strings
and then places them into an array of string.

ARRAY->S takes an array of string and converts it to a list of strings.

I will try to post these routines soon, just in case the previous posting can't
be found.

The m-code tools can be found on Wayne Scott's mail server.  It's
in the hardware directory and called tools.Z .

Hope this helps!

-------------------------------------------------------------------------------
Jason Waterman
The University of Calgary
Calgary, Alberta, Canada
Email: waterman@engg.ucalgary.ca
-------------------------------------------------------------------------------