From: meissner@triton.unm.edu (John Meissner)
Subject: FAQ (Part 2)
Date: Wed, 30 Dec 92 06:10:30 GMT
Organization: University of New Mexico, Albuquerque

    Saturn
        "Saturn" is the internal code name for the processor used in the
        HP 48SX, HP-28 series, and the HP-75/71B calculators.
 
    STAR
        This is the "Saturn Macro Assembler" (how "STAR" comes from
        this, I don't know), an assembler that mostly uses Alonzo
        Gariepy's mnemonics.  It's written in C and runs on many
        different machines (PCs, Amigas, Unices, etc.).  STAR is
        available via anonymous ftp from ftp.ai.mit.edu in
        "/pub/star-1.04.4.tar.Z".  It's also available from various
        bulletin boards (the HP handhelds forum on CompuServe also has a
        copy).  The latest version is "1.04.4".
 
    SWING
        SWING is a library program that displays a graphical tree
        structure of the directory hierarchy in your HP 48SX, and allows
        you to move from directory to directory using the arrow keys (it
        is supposedly based upon an old PD VMS utility).
 
    System RPL
        This is the name for the custom "operating system/language" used
        to program the CPU used in the HP 48SX calculator.  System RPL
        is a superset of the normal user RPL commands; in addition to
        the normal, user-accessible RPL commands, system RPL includes
        many lower-level functions.  System RPL is a language one step
        higher than assembly language.
 
        HP has released a system development toolkit (for the IBM PC)
        containing a system RPL compiler, assembler, and loader,
        complete with a couple hundred pages of documentation.  This
        toolkit, while copyrighted, is, for the most part, freely
        copyable.  If you can find a BBS or archive site that has it,
        you can download all of the system RPL files and documentation.
 
    USRLIB
        USRLIB is a program that takes the contents of an HP 48SX
        directory and turns it into a library object.  It currently runs
        under MSDOS.
 
    Voyager
        Voyager is an "interactive disassembler" for IBM PC clones that
        disassembles HP 48SX RPL and machine code.  You download a copy
        of the RAM *and* ROM in your HP 48SX to your PC, and run
        Voyager.  Using Voyager, you can then view the disassembled or
        unthreaded code.  Unfortunately (or fortunately), Voyager uses
        the HP mnemonics, and not Alonzo Gariepy's mnemonics.  Voyager
        is available from the HP BBS (I think), via anonymous ftp from
        the HP BBS (hpcvbbs.cv.hp.com [15.255.72.16]), and from various
        bulletin boards (the HP handhelds forum in CompuServe also has a
        copy).  The latest version is "1.07".
 
 
29. What information is there on the internals of the HP 48SX?
 
    The most important documents are part of the "System RPL" devlopment
    tools, a completely unsupported set of IBM PC tools created by HP
    Corvallis (the creators of the HP 48SX).  The tools, which run on
    MSDOS machines only, contain documentation on:
 
        * System RPL (which includes information on HP 48SX display
          graphics, keyboard control, etc.).
        * Saturn assembly language ("Saturn" is the name of the CPU in
          the HP 48SX), including infomation on a Saturn assembler.
        * A system RPL compiler.
        * A Saturn object file linker.
 
    The completely unsupported system RPL development tools and
    documentation are available to customers free of charge to help them
    in HP 48SX application development, subject to certain legal terms,
    which are given with the toolssites around the Internet (sorry, but I don't
          know where they are).
        * The HP handhelds forum on CompuServe has a copy in the HP 48SX
          download library (DL4).  I think that it's called "48rpl.exe"
          instead of "tools.exe" (this is what HP Corvallis calls it).
 
 
30. What are the pinouts for the HP 48SX serial connector?
 
    Looking at the pins of the HP 48SX (the following diagram is showing
    the pins on the HP 48SX, as you look *AT* the calculator):
                   _________
                  | o o o o |
                   \_______/
                    ^ ^ ^ ^
                    | | | \------ 4 Signal GND
                    | | \-------- 3 RX (input to the HP 48SX)
                    | \---------- 2 TX (output from the HP 48SX)
                    \------------ 1 SHIELD
 
    Stated another way:
 
        HP48SX                  IBM 9 PIN               IBM 25 PIN
        (From the outside
         edge -> inward)
        SHIELD-------------------  SHIELD----------------  SHIELD
        TX (Output)<-------------2 RX (Input)------------3 RX (Input)
        RX (Input)-------------->3 TX (Output)---------->2 TX (Output)
        SGND---------------------5 GND-------------------7 GND
 
 
31. Is there any information on interfacing to the HP 48SX?
 
    HP has made available an UNSUPPORTED document called the "HP 48 I/O
    Technical Interfacing Guide", which contains information on the
    wired and serial I/O hardware.
 
    Look in the various HP 48SX archives for a copy.
 
 
32. Where can I get programs and information for the HP 48SX?
 
    One location is the HP Calculator BBS.
 
    CompuServe has a modest HP 48SX archive in the HP handhelds forum.
    Type "go HPSYSTEMS" to access the forum.  HP 48SX-specific files can
    be found in DL 4.
 
    For those people who have access to the Internet, the following
    sites have HP 28 and HP 48SX information and software:
 
    Site Name           IP address      directory (& other files)
    -----------------   ------------    ---------------------------------------
    hpcvbbs.cv.hp.com   15.255.72.16    /pub
    seq.uncwil.edu      128.109.221.20  (most complete HP 48 archives)
    wuarchive.wustl.edu 128.252.135.4   /systems/hp48sx
    funic.funet.fi      128.214.6.100   /pub/misc/hp48sx pub/misc/hp28s
    faui43.informatik.uni-erlangen.de   /portal/hp48
                        131.188.34.43   (games gnu hp28 irc iso lisp)
                        131.188.31.3    (There seems to have been no
                        131.188.44.43   maintenance since February 1991.)
                        131.188.1.43
    gmuvax2.gmu.edu     129.174.1.8     /new/hp48sx
                                        (gmuvax2 has very few files for
                                        the HP 48SX.)
 
 
33. How do I get access to the HP Calculator BBS?
 
    You can access the HP Calculator BBS via a modem (note that this is
    a long distance call for most people):
 
        (503)-750-4448          2400 baud, 8N1
        (503)-750-3277          9600 baud, 8N1
 
    For those people who have access to the Internet, you can also
    access the BBS via telnet to hpcvbbs.cv.hp.com [15.255.72.16].
 
 
34. What Usenet Newsgroups are there for the HP 48SX?
 
        comp.sys.hp48           -- Primary newsgroup
        comp.sources.hp48       -- For HP 48SX programs. (This newsgroup
                                   is moderated by Chris Spell -- send
                                   submissions to hp48@seq.uncwil.edu.)
        comp.sys.handhelds      -- Occasionally, HP 48SX information is
                                   posted to this newsgroup.
 
 
* Appendix A: ASC\-> and \->ASC functions:
 
>From billw@hpcvra.CV.HP.COM Fri Mar  1 17:00:00 1991
From: billw@hpcvra.CV.HP.COM (William C Wickes)
Date: Fri, 17 Aug 1990 22:27:42 GMT
Subject: HP 48 Object Encoding
Organization: Hewlett-Packard Co., Corvallis, OR, USA
 
 
                      ASCII Encoding HP 48SX Objects
 
Sending an HP 48SX object via electronic mail can be difficult if the
object does not have an ASCII form, such as is the case for library
objects.  There are various encoding schemes available on different
computer systems, but these require that the sender and receiver have
similar computers, or at least compatible encode/decode schemes.  The
programs listed below perform the encoding and decoding on the HP 48SX itself,
which has the advantage of being completely independent of any computer.
 
The programs are nominally called \->ASC and ASC\->.  The former takes an
object from the stack and converts it to a string, in which each nibble of the
object and its checksum is converted to a character 0-9 or A-F.  (The object
must be in RAM, otherwise a "ROM Object" error is returned.)  For sake of easy
inclusion in email letters, the string is broken up by linefeed characters
after every 64 characters.
 
ASC\-> is the inverse of \->ASC: it takes a string created by \->ASC and
converts it back into an object.  When you transmit the encoded strings,
be sure not to change the string; ASC\-> uses the checksum encoded in the
string to verify that the decoding is correct.  An "Invalid String" error
is returned if the result object does not match the original object
encoded by \->ASC.  When you upload a string to your computer, use HP 48
translate mode 3 so that the HP 48 will convert any CR/LF's back to LF's
when the string is later downloaded.
 
Two versions of ASC\-> are included here.  The first (P1) is in HP 48 user
language, using SYSEVALs to execute system objects.  P2 is a
string that the setup program uses P1 to decode into an executable
ASC\->--then P1 is discarded.  The second version is more
compact than the first, and also uneditable and therefore safer (but it can't
be transmitted in ASCII form, which helps to make the point of this exercise).
 
Here are the programs, contained in a directory:
 
(start)
%%HP: T(3)A(D)F(.);
DIR
P1              @ ASC\-> Version 1.
\<<
  IF DUP TYPE 2 \=/
  THEN "Not A String" DOERR
  END RCWS \-> ws
  \<< 16 STWS
    #0 NEWOB SWAP DUP SIZE
    IF DUP 4 <
    THEN DROP SWAP DROP "Invalid String" DOERR
    END
    DUP 65 / IP - 4 - # 18CEAh SYSEVAL
    "" OVER # 61C1Ch SYSEVAL
    SWAP # 6641F8000AF02DCCh
    # 130480679BF8CC0h # 518Ah SYSEVAL
    # 19610313418D7EA4h # 518Ah SYSEVAL
    # 7134147114103123h # 518Ah SYSEVAL
    # 5F6A971131607414h # 518Ah SYSEVAL
    # 12EA1717EA3F130Ch # 518Ah SYSEVAL
    # 280826B3012808F4h # 518Ah SYSEVAL
    # 6B7028080BEE9091h # 518Ah SYSEVAL
    # BE5DC1710610C512h # 518Ah SYSEVAL
    # 705D00003431A078h # 518Ah SYSEVAL
    # 3D8FA26058961431h # 518Ah SYSEVAL
    # 312B0514h # 518Ah SYSEVAL
    # 18F23h SYSEVAL
    DUP BYTES DROP 4 ROLL
    IF ==
    THEN SWAP DROP
    ELSE DROP "Invalid String" DOERR
    END ws STWS
  \>>
\>>
 
P2      @ ASC\->  Version 2.  To be converted by ASC\-> version 1.
 
"D9D20D29512BF81D0040D9D20E4A209000000007566074726636508813011920
140007FE30B9F060ED3071040CA1304EC3039916D9D2085230B9F06C2A201200
094E66716C696460235472796E676933A1B21300ED30FD5502C230C1C1632230
CCD20FA0008F14660CC8FB97608403104AE7D814313016913213014117414317
414706131179A6F5C031F3AE7171AE214F8082103B6280821909EEB0808207B6
215C0160171CD5EB870A13430000D50713416985062AF8D341508813044950B9
F06BBF06EFC36B9F0644230C2A201200094E66716C696460235472796E676933
A1B2130B21300373"
 
 
P3      @\->ASC.     To be converted by ASC\->.
"D9D20D2951881304495032230FD5502C230A752688130ADB467FE30322306AC3
0CB916E0E30CBD30F6E30C1C1632230CCD20DC0008F14660CC8FB97608403104
AE7D8143130169174147061741431311534AC6B4415141534946908D9B026155
4A6F53131F3AE731A014C161AE215F08082103A6280821939EEC08082170A621
4C161170CD56B870A18503430000D5071351796A9F8D2D02639916D9D2085230
C2A209100025F4D402F426A6563647933A1B2130A2116B213033C0"
 
SETUP   @Automatic setup program
\<< P2 P1 'ASC\->' STO
    P3 ASC\-> '\->ASC' STO
    { P1 P2 P3 SETUP } PURGE
\>>
 
END
(end)
 
 
Installation instructions:
 
    1.  Edit the above text between (start) and (end) into a text file
        named CONV (for example).  Be sure that you leave the strings
        exactly as entered above, with no extra spaces or other
        invisible characters at the beginnings or ends of the lines.
    2.  Set the HP 48SX into ASCII transfer mode.
    3.  Using Kermit, download CONV text file to the 48, verify its
        checksum (6C8Ah).
    4.  Execute CONV to make it the current directory.
    5.  Execute SETUP.
    6.  The directory CONV now contains ASC\-> and \->ASC, ready to
        use.
 
To archive the decoded versions of ASC\-> and \->ASC back on your computer,
be sure to set the HP 48SX in binary transfer mode before uploading.
 
Disclaimers:
 
+ Use the programs at your own risk.  Any time you delve into the SYSEVAL
world, there are increased dangers.  Archive your 48 memory before
experimenting with these programs!  Also, verify the checksums of objects
defined above to make sure they have been downloaded correctly, before
executing ASC\->.
 
+ I will not answer questions about how the programs work.  This is not
because of any great secrecy, but rather because it's hard to give
any answer that doesn't lead to more questions, and more, and more...
 
+ 48 hackers are welcome to mine any nuggets they can from the programs,
and from the fact that \->ASC is a convenient way to decompile an object.
 
 
* Appendix B: Using non-HP RAM cards in your HP 48SX:
 
  If you use RAM cards that are NOT designed for the HP 48SX, it is
  possible to severely damage your HP 48SX.  If you want to be safe, you
  should only use RAM cards designed for the HP 48SX.
 
  Here is an edited discussion from comp.sys.handhelds.
 
  From steveh@hpcvra.CV.HP.COM Fri Mar  1 17:00:00 1991
  From: steveh@hpcvra.CV.HP.COM (Steve Harper)
  Date: Thu, 10 May 1990 22:46:09 GMT
  Subject: RE: HP48SX Memory Card Pricing
  Organization: Hewlett-Packard Co., Corvallis, OR, USA
 
  There has been a substantial  amount  of  comment  regarding  the
  memory cards for the HP48SX and their prices.  My purpose in this
  response is not to attempt to justify any particular  price,  but
  rather   to   present  the  technical  reasons  why  there  is  a
  substantial price difference between the memory cards  and  other
  types of expansion memory for PC's, for example, with which users
  are probably more familiar.
 
  Some users have correctly pointed out requires either four transistors
  and two resistors, or six transistors.  The net result is that an
  equivalent amount of static RAM is much larger and therefore much
  more expensive than dynamic RAM.  The advantage  is  that  static
  RAM  doesn't  need  to continually be running and drawing current
  (refresh cycles) to retain the contents of memory.
 
  In addition, the static memory used in the cards is not just  any
  static  memory,  but  is  specially processed and/or selected for
  very low standby current.  This allows the backup battery in  the
  card  to  keep  memory  alive  for  a very long time, rather than
  requiring the user to replace it every few months.   The  special
  processing  and/or  special  testing  to select low current parts
  adds to the already higher cost of the static RAM chips.
 
  The standard molded plastic DIP package used for most  integrated
  circuits,  including  memory  chips,  is  relatively  inexpensive
  because of its simplicity and the huge  volumes.   Unfortunately,
  these  packages  are  too  large  to  put  into  a  memory  card.
  Therefore, the card manufacturer mounts  the  individual  silicon
  memory  chips  directly  on a special thin PC board together with
  the memory support  chips.   Because  multiple  chips  are  being
  placed  in a single hybrid package in a special process which has
  lower volume, yields are lower and this again causes the cost  to
  be  higher.  Indeed, the yield becomes exponentially worse as the
  number  of  chips  and  interconnections  increases  in  such   a
  packaging process.
 
  In addition to the memory chips themselves, two  more  integrated
  circuits  and  several discrete components are required for power
  and logic control.  A bipolar technology chip senses the external
  voltage  and  switches  the  power to the chips from the internal
  keep-alive battery as needed.  A CMOS gate  array  chip  protects
  the memory address and data lines from glitches/ESD when the card
  is not plugged in.  This chip also generates the proper  enabling
  signals  when  there are multiple memory chips in the card, as is
  presently the case with the 128 Kbyte RAM card.  These chips must
  be  designed  for extremely low current, just as the memory chips
  are.
 
  In addition to the battery and  the  battery  holder,  the  other
  mechanical  parts  are  important, too.  The molded plastic frame
  holds the PC board and provides  the  foundation  for  the  metal
  overlays  and the shutter-and-springs assembly which protects the
  contacts from  ESD  and  from  contaminants.   The  write-protect
  switch  is  also an important feature.  It is quite expensive for
  the manufacturer to make the tools necessary to fabricate each of
  these  parts  as  well  as  the  tools  to  assemble and test the
  complete card.  While the volume of memory  cards  is  relatively
  low  this  tooling cost represents a significant part of the cost
  of each card.
 
  Admittedly, there are other alternatives, such as those presently
  used  in  PC's,  to  provide  a  memory expansion capability.  To
  provide that kind of expansion would require the calculator to be
  much  larger  than  it  is  and possibly more expensive.  This is
  clearly very undesirable.
 
  Other features that were felt to be essential were the ability to
  distribute  software applications and to share and archive/backup
  user-created programs and data.  Other expansion alternatives  do
  not provide these important benefits.  The IO capabilities of the
  calculator provide these features only to a limited degree.
 
  One other item bears repeating here: Memory cards for use in  the
  calculator  will  clearly indicate that they are for use with the
  HP48SX.   Other  memory  cards  exist  which   are   mechanically
  compatible  with the HP48S, but these cards cannot be relied upon
  to work electrically in the calculator.   The  HP48SX  cards  are
  designed  for  a  lower  supply  voltage range.  Use of the other
  cards may cause memory loss, and under certain circumstances  may
  even damage your calculator electrically.
 
  From steveh@hpcvra.CV.HP.COM Fri Mar  1 17:00:00 1991
  From: steveh@hpcvra.CV.HP.COM (Steve Harper)
  Date: Fri, 11 May 1990 16:52:07 GMT
  Subject: Re: Memory Card: Give Us *True* Facts!
  Organization: Hewlett-Packard Co., Corvallis, OR, USA
 
  My previous statement that under certain circumstances the
  calculator may even be damaged electrically is not a ploy.
  If the calculator's internal power supply voltage happens to
  be near the low end of the range, say 4.1 V, and the voltage
  at which the card's voltage control chip shuts it down
  happens to be near the high end of its range, say 4.2 V (this
  can and does occasionally occur for the non-HP48SX cards),
  then the calculator will start to drive the memory address
  lines and the card will still have these clamped to ground
  (that's what it does to protect itself when there is not
  sufficient system voltage to run).  This unfortunate situation
  may simply trash your memory, or if the calculator tries
  to drive enough of the lines high at the same time, several
  hundred milliamps may flow...for awhile that is, until something
  gives up...  On the other hand, your calculator and a particular
  non-HP48SX card may work just fine if those voltages happen
  to be at the other end of their ranges.  These voltages are
  also slightly temperature sensitive.  It may work in the
  classroom or office and not at the beach, or vice versa.
  The voltage trip point of the HP48SX cards has been set
  lower (a different voltage control chip) so that this cannot
  occur, regardless of part and temperature vtem was brought to my attention yesterday by
  Preston Brown that I should have included in my original
  posting here.  While most of us recognize that comparing
  ram cards to a handful of dynamic ram chips to plug into
  your PC is apples and oranges, it may be more interesting
  to compare the HP48SX cards with cards for other products,
  like the Atari Portfolio, the Poquet, the NEC Ultralite,
  etc.  I believe you will find that the prices on the
  HP48SX cards are not at all out of line.
 
  Steve
  "I claim all disclaimers..."
 
  the non-HP48SX cards
 
  From prestonb@hpcvra.CV.HP.COM Fri Mar  1 17:00:00 1991
  From: prestonb@hpcvra.CV.HP.COM (Preston Brown)
  Date: Thu, 17 May 1990 17:26:53 GMT
  Subject: Re: Memory Card: Give Us *True* Facts!
  Organization: Hewlett-Packard Co., Corvallis, OR, USA
 
  When the RAM cards detect that voltage is to low to operate they
  clamp the address lines to ground.  This clamping is done by turning
  on the output drivers of a custom chip included on the card.  The
  clamping current is speced at 2mA min at the Vol output level.  Since
  the 48 can be trying to drive the line all the way high even more
  current is typical.  10mA per fight is not uncommon with totals of
  several hundred mAs.
 
  The VDD power supply is regulated at 4.1 - 4.9 with typical
  parts at the low end (4.3).  The power to the cards is switched
  thru a transistor, creating up to a 0.1V drop.  Standard Epson
  cards have a significant chance of seeing this voltage as
  to low and shutting down.  We have seen cards do this in the lab.
  When it occurs the calculator locks up with VDD pulled down
  to about 2.5V and 250mA being drawn from the batteries.  This
  current drain greatly exceeds the ratings for the power supply
  and can damage your calc.  The least that will happen is a loss
  of memory.
 
  Now, why didn't we regulate VDD higher?
  The 48 has two power supplies VDD at 4.3 and VH at 8.5.  VH
  cannot be regulated higher without exceeding the spec for
  our CMOS IC process.  VH is used as the + voltage for the I/O.
  In order to meet a +3V output level VH must be more then 3.6V
  above VDD.  (VDD is used as I/O ground). Our power supply
  system increase the battery life and reduces the cost greatly
  for the wired I/O.
 
  Preston
 
 
* Appendix C: Compact Data Storage:
 
  From Jim Donnelly (jimd@cv.hp.com):
 
        A simple length-encoding technique can be put to use for a
        free-format, very compact multi-field data storage system.
        Two tiny programs, SUBNUM and STRCON are here to help the
        process, and are listed near the end of this note.  At the
        end of the note is a directory that may be downloaded into
        the HP 48 that contains the examples.
 
        The principle is to store starting indices in the beginning
        of a string that point to fields stored subsequently in the
        string.  The indices are stored in field order, with an
        additional index at the end to accommodate the last field.
        There are several small points worth mentioning:
 
        1) Fields may be 0-length using this technique.
        2) The execution time is uniform across all fields.
        3) This technique saves about 4 bytes per field after
           the first field, because the string prolog and length
           are omitted for fields 2 -> n.
 
 
        EXAMPLE:
        --------
 
                         Indices  |          Fields
          Character               |     1 11111111 12222222222
          Position :   1  2  3  4 |567890 12345678 90123456789
                      +--+--+--+--+------+--------+-----------+
          String :    | 5|11|19|30|Field1| Field2 |  Field 3  |
                      +--+--+--+--+------+--------+-----------+
 
        This is a string that contains 3 fields, and therefore 4
        index entries.  The first field begins at character 5, the
        second field begins at character 11, and the third field
        begins at character 19. To keep the pattern consistent,
        notice that the index for field 4 is 30, which is one more
        than the length of the 29 character data string.
 
        To extract the second field, place the string on the stack,
        use SUBNUM on character 2 to extract the starting position,
        use SUBNUM on character 3 to extract the (ending position +1),
        subtract 1 from the (ending position+1), then do a SUB to
        get the field data.  NOTE: The index for field 1 is stored
        as character code 5, NOT "5"!  To place the field index for
        field 1 in the string, you would execute "data" 1 5 CHR REPL.
 
 
        PROGRAM:
        --------
 
        The following program accepts an encoded data string in
        level 2 and a field number in level 1:
 
        DECODE   "data"  field#  -->  "field"
 
        <<  --> f
          <<
            DUP f SUBNUM                ; "data" start -->
            OVER f 1 + SUBNUM           ; "data" start end+1 -->
            1 -                         ; "data" start end -->
            SUB                         ; "field" -->
          >>
        >>
 
 
        DATA ENCODING
        -------------
 
        The following program expects a series of 'n' strings on
        the stack and encodes them into a data string suitable
        for reading by the first example above.
 
        The programs SUBNUM and STRCON are used to assemble the
        indices.
 
        ENCODE      field n  ...  field 1   n   -->  "data"
 
        << DUP 2 + DUP 1 - STRCON --> n  data
          <<
            1 n
            FOR i
              data i SUBNUM OVER SIZE   ; ... field index fieldsize
              + data SWAP               ; ... field "data" index'
              i 1 + i + SWAP CHR REPL   ; ... field "data"'
              SWAP + 'data' STO         ; ...
            NEXT
            data                        ; "data"
          >>
        >>
 
        In this example, four strings are encoded:
 
        Input:  5: "String"
                4: "Str"
                3: "STR"
                2: "STRING"
                1:         4
 
        Output: "xxxxxSTRINGSTRStrString"      (23 character string)
        (The first five characters have codes 6, 12, 15, 18, and 24)
 
 
 
        VARIATION:
        ----------
 
        The technique above has a practical limit of storing
        up to 254 characters of data in a string.  To overcome
        this, just allocate two bytes for each field position.
        The code to extract the starting index for becomes a
        little more busy.  In this case, the index is stored as
        two characters in hex.
 
                      Indices  |          Fields
       Character               | 11111 11111222 22222223333
       Position :   12 34 56 78|901234 56789012 34567890123
                   +--+--+--+--+------+--------+-----------+
       String :    |09|0F|17|21|Field1| Field2 |  Field 3  |
                   +--+--+--+--+------+--------+-----------+
 
           <<  --> f
             <<
                DUP f 2 * 1 -           ; "data" "data" indx1 -->
                SUBNUM 16 *             ; "data" 16*start_left_byte  -->
                OVER f 2 * SUBNUM +     ; "data" start
                OVER f 2 * 1 + SUBNUM   ; "data" start end_left_byte -->
                16 * 3PICK f 1 + 2 *
                SUBNUM + 1 -            ; "data" start end -->
                SUB                     ; "field"  -->
             >>
           >>
 
 
 
        TWO VERY TINY HELPFUL PROGRAMS
        ------------------------------
 
        SUBNUM          "string"  position  -->  code
 
        << DUP SUB NUM >>
 
 
 
        STRCON          code  count  -->  "repeated string"
 
        << -->  code count
          << "" code CHR 'code' STO
             1 count START code + NEXT
          >>
        >>
 
 
        A DIRECTORY YOU CAN DOWNLOAD
        ----------------------------
 
        This is a directory object.  Cut after the === to the end of
        the file and download to your HP 48 using the ASCII transfer.
 
========================================================================
%%HP: T(3)A(D)F(.);
DIR
  DECODE
    \<< \-> f
      \<< DUP f
SUBNUM OVER f 1 +
SUBNUM 1 - SUB
      \>>
    \>>
  ENCODE
    \<< DUP 2 + DUP 1
- STRCON \-> n data
      \<< 1 n
        FOR i data
i SUBNUM OVER SIZE
+ data SWAP i 1 +
SWAP CHR REPL SWAP
+ 'data' STO
        NEXT data
      \>>
    \>>
  STRCON
    \<< \-> code count
      \<< "" code CHR
'code' STO 1 count
        START code
+
        NEXT
      \>>
    \>>
  SUBNUM
    \<< DUP SUB NUM
    \>>
END
 
 
* Appendix D: Various useful functions
 
     (Shamelessly lifted from the HP-41C manual:)
 
     The LASTX function is useful in calculations where a number occurs
     more than once.  By recovering a number using LASTX, you do not
     have to key that number into the calculator again.
 
     For example, calculate:
 
                96.704 + 52.394706
               --------------------
                     52.394706
 
        Keystrokes:                     Stack:
       ------------------              --------------------
        96.704 ENTER                    96.704
 
        52.304706 +                     149.098706
 
        LASTX                           149.098706
                                        52.304706
 
        /                               2.84568265351
 
@
@ This is a version of LASTX for the HP 48SX
@
%%HP: T(3)A(D)F(.);
\<< DEPTH \-> n
  \<< LASTARG DEPTH n
- DUP \-> s
    \<< ROLLD s 1 -
DROPN
    \>>
  \>>
\>>
 
 
Newsgroups: comp.sys.hp48