home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / sys / hp48 / 6569 < prev    next >
Encoding:
Text File  |  1992-12-30  |  28.9 KB  |  723 lines

  1. Newsgroups: comp.sys.hp48
  2. Path: sparky!uunet!spool.mu.edu!umn.edu!lynx!triton.unm.edu!meissner
  3. From: meissner@triton.unm.edu (John Meissner)
  4. Subject: FAQ (Part 2)
  5. Message-ID: <_5pr7wk@lynx.unm.edu>
  6. Date: Wed, 30 Dec 92 06:10:30 GMT
  7. Organization: University of New Mexico, Albuquerque
  8. Lines: 713
  9.  
  10.     Saturn
  11.         "Saturn" is the internal code name for the processor used in the
  12.         HP 48SX, HP-28 series, and the HP-75/71B calculators.
  13.  
  14.     STAR
  15.         This is the "Saturn Macro Assembler" (how "STAR" comes from
  16.         this, I don't know), an assembler that mostly uses Alonzo
  17.         Gariepy's mnemonics.  It's written in C and runs on many
  18.         different machines (PCs, Amigas, Unices, etc.).  STAR is
  19.         available via anonymous ftp from ftp.ai.mit.edu in
  20.         "/pub/star-1.04.4.tar.Z".  It's also available from various
  21.         bulletin boards (the HP handhelds forum on CompuServe also has a
  22.         copy).  The latest version is "1.04.4".
  23.  
  24.     SWING
  25.         SWING is a library program that displays a graphical tree
  26.         structure of the directory hierarchy in your HP 48SX, and allows
  27.         you to move from directory to directory using the arrow keys (it
  28.         is supposedly based upon an old PD VMS utility).
  29.  
  30.     System RPL
  31.         This is the name for the custom "operating system/language" used
  32.         to program the CPU used in the HP 48SX calculator.  System RPL
  33.         is a superset of the normal user RPL commands; in addition to
  34.         the normal, user-accessible RPL commands, system RPL includes
  35.         many lower-level functions.  System RPL is a language one step
  36.         higher than assembly language.
  37.  
  38.         HP has released a system development toolkit (for the IBM PC)
  39.         containing a system RPL compiler, assembler, and loader,
  40.         complete with a couple hundred pages of documentation.  This
  41.         toolkit, while copyrighted, is, for the most part, freely
  42.         copyable.  If you can find a BBS or archive site that has it,
  43.         you can download all of the system RPL files and documentation.
  44.  
  45.     USRLIB
  46.         USRLIB is a program that takes the contents of an HP 48SX
  47.         directory and turns it into a library object.  It currently runs
  48.         under MSDOS.
  49.  
  50.     Voyager
  51.         Voyager is an "interactive disassembler" for IBM PC clones that
  52.         disassembles HP 48SX RPL and machine code.  You download a copy
  53.         of the RAM *and* ROM in your HP 48SX to your PC, and run
  54.         Voyager.  Using Voyager, you can then view the disassembled or
  55.         unthreaded code.  Unfortunately (or fortunately), Voyager uses
  56.         the HP mnemonics, and not Alonzo Gariepy's mnemonics.  Voyager
  57.         is available from the HP BBS (I think), via anonymous ftp from
  58.         the HP BBS (hpcvbbs.cv.hp.com [15.255.72.16]), and from various
  59.         bulletin boards (the HP handhelds forum in CompuServe also has a
  60.         copy).  The latest version is "1.07".
  61.  
  62.  
  63. 29. What information is there on the internals of the HP 48SX?
  64.  
  65.     The most important documents are part of the "System RPL" devlopment
  66.     tools, a completely unsupported set of IBM PC tools created by HP
  67.     Corvallis (the creators of the HP 48SX).  The tools, which run on
  68.     MSDOS machines only, contain documentation on:
  69.  
  70.         * System RPL (which includes information on HP 48SX display
  71.           graphics, keyboard control, etc.).
  72.         * Saturn assembly language ("Saturn" is the name of the CPU in
  73.           the HP 48SX), including infomation on a Saturn assembler.
  74.         * A system RPL compiler.
  75.         * A Saturn object file linker.
  76.  
  77.     The completely unsupported system RPL development tools and
  78.     documentation are available to customers free of charge to help them
  79.     in HP 48SX application development, subject to certain legal terms,
  80.     which are given with the toolssites around the Internet (sorry, but I don't
  81.           know where they are).
  82.         * The HP handhelds forum on CompuServe has a copy in the HP 48SX
  83.           download library (DL4).  I think that it's called "48rpl.exe"
  84.           instead of "tools.exe" (this is what HP Corvallis calls it).
  85.  
  86.  
  87. 30. What are the pinouts for the HP 48SX serial connector?
  88.  
  89.     Looking at the pins of the HP 48SX (the following diagram is showing
  90.     the pins on the HP 48SX, as you look *AT* the calculator):
  91.                    _________
  92.                   | o o o o |
  93.                    \_______/
  94.                     ^ ^ ^ ^
  95.                     | | | \------ 4 Signal GND
  96.                     | | \-------- 3 RX (input to the HP 48SX)
  97.                     | \---------- 2 TX (output from the HP 48SX)
  98.                     \------------ 1 SHIELD
  99.  
  100.     Stated another way:
  101.  
  102.         HP48SX                  IBM 9 PIN               IBM 25 PIN
  103.         (From the outside
  104.          edge -> inward)
  105.         SHIELD-------------------  SHIELD----------------  SHIELD
  106.         TX (Output)<-------------2 RX (Input)------------3 RX (Input)
  107.         RX (Input)-------------->3 TX (Output)---------->2 TX (Output)
  108.         SGND---------------------5 GND-------------------7 GND
  109.  
  110.  
  111. 31. Is there any information on interfacing to the HP 48SX?
  112.  
  113.     HP has made available an UNSUPPORTED document called the "HP 48 I/O
  114.     Technical Interfacing Guide", which contains information on the
  115.     wired and serial I/O hardware.
  116.  
  117.     Look in the various HP 48SX archives for a copy.
  118.  
  119.  
  120. 32. Where can I get programs and information for the HP 48SX?
  121.  
  122.     One location is the HP Calculator BBS.
  123.  
  124.     CompuServe has a modest HP 48SX archive in the HP handhelds forum.
  125.     Type "go HPSYSTEMS" to access the forum.  HP 48SX-specific files can
  126.     be found in DL 4.
  127.  
  128.     For those people who have access to the Internet, the following
  129.     sites have HP 28 and HP 48SX information and software:
  130.  
  131.     Site Name           IP address      directory (& other files)
  132.     -----------------   ------------    ---------------------------------------
  133.     hpcvbbs.cv.hp.com   15.255.72.16    /pub
  134.     seq.uncwil.edu      128.109.221.20  (most complete HP 48 archives)
  135.     wuarchive.wustl.edu 128.252.135.4   /systems/hp48sx
  136.     funic.funet.fi      128.214.6.100   /pub/misc/hp48sx pub/misc/hp28s
  137.     faui43.informatik.uni-erlangen.de   /portal/hp48
  138.                         131.188.34.43   (games gnu hp28 irc iso lisp)
  139.                         131.188.31.3    (There seems to have been no
  140.                         131.188.44.43   maintenance since February 1991.)
  141.                         131.188.1.43
  142.     gmuvax2.gmu.edu     129.174.1.8     /new/hp48sx
  143.                                         (gmuvax2 has very few files for
  144.                                         the HP 48SX.)
  145.  
  146.  
  147. 33. How do I get access to the HP Calculator BBS?
  148.  
  149.     You can access the HP Calculator BBS via a modem (note that this is
  150.     a long distance call for most people):
  151.  
  152.         (503)-750-4448          2400 baud, 8N1
  153.         (503)-750-3277          9600 baud, 8N1
  154.  
  155.     For those people who have access to the Internet, you can also
  156.     access the BBS via telnet to hpcvbbs.cv.hp.com [15.255.72.16].
  157.  
  158.  
  159. 34. What Usenet Newsgroups are there for the HP 48SX?
  160.  
  161.         comp.sys.hp48           -- Primary newsgroup
  162.         comp.sources.hp48       -- For HP 48SX programs. (This newsgroup
  163.                                    is moderated by Chris Spell -- send
  164.                                    submissions to hp48@seq.uncwil.edu.)
  165.         comp.sys.handhelds      -- Occasionally, HP 48SX information is
  166.                                    posted to this newsgroup.
  167.  
  168.  
  169. * Appendix A: ASC\-> and \->ASC functions:
  170.  
  171. >From billw@hpcvra.CV.HP.COM Fri Mar  1 17:00:00 1991
  172. From: billw@hpcvra.CV.HP.COM (William C Wickes)
  173. Date: Fri, 17 Aug 1990 22:27:42 GMT
  174. Subject: HP 48 Object Encoding
  175. Organization: Hewlett-Packard Co., Corvallis, OR, USA
  176.  
  177.  
  178.                       ASCII Encoding HP 48SX Objects
  179.  
  180. Sending an HP 48SX object via electronic mail can be difficult if the
  181. object does not have an ASCII form, such as is the case for library
  182. objects.  There are various encoding schemes available on different
  183. computer systems, but these require that the sender and receiver have
  184. similar computers, or at least compatible encode/decode schemes.  The
  185. programs listed below perform the encoding and decoding on the HP 48SX itself,
  186. which has the advantage of being completely independent of any computer.
  187.  
  188. The programs are nominally called \->ASC and ASC\->.  The former takes an
  189. object from the stack and converts it to a string, in which each nibble of the
  190. object and its checksum is converted to a character 0-9 or A-F.  (The object
  191. must be in RAM, otherwise a "ROM Object" error is returned.)  For sake of easy
  192. inclusion in email letters, the string is broken up by linefeed characters
  193. after every 64 characters.
  194.  
  195. ASC\-> is the inverse of \->ASC: it takes a string created by \->ASC and
  196. converts it back into an object.  When you transmit the encoded strings,
  197. be sure not to change the string; ASC\-> uses the checksum encoded in the
  198. string to verify that the decoding is correct.  An "Invalid String" error
  199. is returned if the result object does not match the original object
  200. encoded by \->ASC.  When you upload a string to your computer, use HP 48
  201. translate mode 3 so that the HP 48 will convert any CR/LF's back to LF's
  202. when the string is later downloaded.
  203.  
  204. Two versions of ASC\-> are included here.  The first (P1) is in HP 48 user
  205. language, using SYSEVALs to execute system objects.  P2 is a
  206. string that the setup program uses P1 to decode into an executable
  207. ASC\->--then P1 is discarded.  The second version is more
  208. compact than the first, and also uneditable and therefore safer (but it can't
  209. be transmitted in ASCII form, which helps to make the point of this exercise).
  210.  
  211. Here are the programs, contained in a directory:
  212.  
  213. (start)
  214. %%HP: T(3)A(D)F(.);
  215. DIR
  216. P1              @ ASC\-> Version 1.
  217. \<<
  218.   IF DUP TYPE 2 \=/
  219.   THEN "Not A String" DOERR
  220.   END RCWS \-> ws
  221.   \<< 16 STWS
  222.     #0 NEWOB SWAP DUP SIZE
  223.     IF DUP 4 <
  224.     THEN DROP SWAP DROP "Invalid String" DOERR
  225.     END
  226.     DUP 65 / IP - 4 - # 18CEAh SYSEVAL
  227.     "" OVER # 61C1Ch SYSEVAL
  228.     SWAP # 6641F8000AF02DCCh
  229.     # 130480679BF8CC0h # 518Ah SYSEVAL
  230.     # 19610313418D7EA4h # 518Ah SYSEVAL
  231.     # 7134147114103123h # 518Ah SYSEVAL
  232.     # 5F6A971131607414h # 518Ah SYSEVAL
  233.     # 12EA1717EA3F130Ch # 518Ah SYSEVAL
  234.     # 280826B3012808F4h # 518Ah SYSEVAL
  235.     # 6B7028080BEE9091h # 518Ah SYSEVAL
  236.     # BE5DC1710610C512h # 518Ah SYSEVAL
  237.     # 705D00003431A078h # 518Ah SYSEVAL
  238.     # 3D8FA26058961431h # 518Ah SYSEVAL
  239.     # 312B0514h # 518Ah SYSEVAL
  240.     # 18F23h SYSEVAL
  241.     DUP BYTES DROP 4 ROLL
  242.     IF ==
  243.     THEN SWAP DROP
  244.     ELSE DROP "Invalid String" DOERR
  245.     END ws STWS
  246.   \>>
  247. \>>
  248.  
  249. P2      @ ASC\->  Version 2.  To be converted by ASC\-> version 1.
  250.  
  251. "D9D20D29512BF81D0040D9D20E4A209000000007566074726636508813011920
  252. 140007FE30B9F060ED3071040CA1304EC3039916D9D2085230B9F06C2A201200
  253. 094E66716C696460235472796E676933A1B21300ED30FD5502C230C1C1632230
  254. CCD20FA0008F14660CC8FB97608403104AE7D814313016913213014117414317
  255. 414706131179A6F5C031F3AE7171AE214F8082103B6280821909EEB0808207B6
  256. 215C0160171CD5EB870A13430000D50713416985062AF8D341508813044950B9
  257. F06BBF06EFC36B9F0644230C2A201200094E66716C696460235472796E676933
  258. A1B2130B21300373"
  259.  
  260.  
  261. P3      @\->ASC.     To be converted by ASC\->.
  262. "D9D20D2951881304495032230FD5502C230A752688130ADB467FE30322306AC3
  263. 0CB916E0E30CBD30F6E30C1C1632230CCD20DC0008F14660CC8FB97608403104
  264. AE7D8143130169174147061741431311534AC6B4415141534946908D9B026155
  265. 4A6F53131F3AE731A014C161AE215F08082103A6280821939EEC08082170A621
  266. 4C161170CD56B870A18503430000D5071351796A9F8D2D02639916D9D2085230
  267. C2A209100025F4D402F426A6563647933A1B2130A2116B213033C0"
  268.  
  269. SETUP   @Automatic setup program
  270. \<< P2 P1 'ASC\->' STO
  271.     P3 ASC\-> '\->ASC' STO
  272.     { P1 P2 P3 SETUP } PURGE
  273. \>>
  274.  
  275. END
  276. (end)
  277.  
  278.  
  279. Installation instructions:
  280.  
  281.     1.  Edit the above text between (start) and (end) into a text file
  282.         named CONV (for example).  Be sure that you leave the strings
  283.         exactly as entered above, with no extra spaces or other
  284.         invisible characters at the beginnings or ends of the lines.
  285.     2.  Set the HP 48SX into ASCII transfer mode.
  286.     3.  Using Kermit, download CONV text file to the 48, verify its
  287.         checksum (6C8Ah).
  288.     4.  Execute CONV to make it the current directory.
  289.     5.  Execute SETUP.
  290.     6.  The directory CONV now contains ASC\-> and \->ASC, ready to
  291.         use.
  292.  
  293. To archive the decoded versions of ASC\-> and \->ASC back on your computer,
  294. be sure to set the HP 48SX in binary transfer mode before uploading.
  295.  
  296. Disclaimers:
  297.  
  298. + Use the programs at your own risk.  Any time you delve into the SYSEVAL
  299. world, there are increased dangers.  Archive your 48 memory before
  300. experimenting with these programs!  Also, verify the checksums of objects
  301. defined above to make sure they have been downloaded correctly, before
  302. executing ASC\->.
  303.  
  304. + I will not answer questions about how the programs work.  This is not
  305. because of any great secrecy, but rather because it's hard to give
  306. any answer that doesn't lead to more questions, and more, and more...
  307.  
  308. + 48 hackers are welcome to mine any nuggets they can from the programs,
  309. and from the fact that \->ASC is a convenient way to decompile an object.
  310.  
  311.  
  312. * Appendix B: Using non-HP RAM cards in your HP 48SX:
  313.  
  314.   If you use RAM cards that are NOT designed for the HP 48SX, it is
  315.   possible to severely damage your HP 48SX.  If you want to be safe, you
  316.   should only use RAM cards designed for the HP 48SX.
  317.  
  318.   Here is an edited discussion from comp.sys.handhelds.
  319.  
  320.   From steveh@hpcvra.CV.HP.COM Fri Mar  1 17:00:00 1991
  321.   From: steveh@hpcvra.CV.HP.COM (Steve Harper)
  322.   Date: Thu, 10 May 1990 22:46:09 GMT
  323.   Subject: RE: HP48SX Memory Card Pricing
  324.   Organization: Hewlett-Packard Co., Corvallis, OR, USA
  325.  
  326.   There has been a substantial  amount  of  comment  regarding  the
  327.   memory cards for the HP48SX and their prices.  My purpose in this
  328.   response is not to attempt to justify any particular  price,  but
  329.   rather   to   present  the  technical  reasons  why  there  is  a
  330.   substantial price difference between the memory cards  and  other
  331.   types of expansion memory for PC's, for example, with which users
  332.   are probably more familiar.
  333.  
  334.   Some users have correctly pointed out requires either four transistors
  335.   and two resistors, or six transistors.  The net result is that an
  336.   equivalent amount of static RAM is much larger and therefore much
  337.   more expensive than dynamic RAM.  The advantage  is  that  static
  338.   RAM  doesn't  need  to continually be running and drawing current
  339.   (refresh cycles) to retain the contents of memory.
  340.  
  341.   In addition, the static memory used in the cards is not just  any
  342.   static  memory,  but  is  specially processed and/or selected for
  343.   very low standby current.  This allows the backup battery in  the
  344.   card  to  keep  memory  alive  for  a very long time, rather than
  345.   requiring the user to replace it every few months.   The  special
  346.   processing  and/or  special  testing  to select low current parts
  347.   adds to the already higher cost of the static RAM chips.
  348.  
  349.   The standard molded plastic DIP package used for most  integrated
  350.   circuits,  including  memory  chips,  is  relatively  inexpensive
  351.   because of its simplicity and the huge  volumes.   Unfortunately,
  352.   these  packages  are  too  large  to  put  into  a  memory  card.
  353.   Therefore, the card manufacturer mounts  the  individual  silicon
  354.   memory  chips  directly  on a special thin PC board together with
  355.   the memory support  chips.   Because  multiple  chips  are  being
  356.   placed  in a single hybrid package in a special process which has
  357.   lower volume, yields are lower and this again causes the cost  to
  358.   be  higher.  Indeed, the yield becomes exponentially worse as the
  359.   number  of  chips  and  interconnections  increases  in  such   a
  360.   packaging process.
  361.  
  362.   In addition to the memory chips themselves, two  more  integrated
  363.   circuits  and  several discrete components are required for power
  364.   and logic control.  A bipolar technology chip senses the external
  365.   voltage  and  switches  the  power to the chips from the internal
  366.   keep-alive battery as needed.  A CMOS gate  array  chip  protects
  367.   the memory address and data lines from glitches/ESD when the card
  368.   is not plugged in.  This chip also generates the proper  enabling
  369.   signals  when  there are multiple memory chips in the card, as is
  370.   presently the case with the 128 Kbyte RAM card.  These chips must
  371.   be  designed  for extremely low current, just as the memory chips
  372.   are.
  373.  
  374.   In addition to the battery and  the  battery  holder,  the  other
  375.   mechanical  parts  are  important, too.  The molded plastic frame
  376.   holds the PC board and provides  the  foundation  for  the  metal
  377.   overlays  and the shutter-and-springs assembly which protects the
  378.   contacts from  ESD  and  from  contaminants.   The  write-protect
  379.   switch  is  also an important feature.  It is quite expensive for
  380.   the manufacturer to make the tools necessary to fabricate each of
  381.   these  parts  as  well  as  the  tools  to  assemble and test the
  382.   complete card.  While the volume of memory  cards  is  relatively
  383.   low  this  tooling cost represents a significant part of the cost
  384.   of each card.
  385.  
  386.   Admittedly, there are other alternatives, such as those presently
  387.   used  in  PC's,  to  provide  a  memory expansion capability.  To
  388.   provide that kind of expansion would require the calculator to be
  389.   much  larger  than  it  is  and possibly more expensive.  This is
  390.   clearly very undesirable.
  391.  
  392.   Other features that were felt to be essential were the ability to
  393.   distribute  software applications and to share and archive/backup
  394.   user-created programs and data.  Other expansion alternatives  do
  395.   not provide these important benefits.  The IO capabilities of the
  396.   calculator provide these features only to a limited degree.
  397.  
  398.   One other item bears repeating here: Memory cards for use in  the
  399.   calculator  will  clearly indicate that they are for use with the
  400.   HP48SX.   Other  memory  cards  exist  which   are   mechanically
  401.   compatible  with the HP48S, but these cards cannot be relied upon
  402.   to work electrically in the calculator.   The  HP48SX  cards  are
  403.   designed  for  a  lower  supply  voltage range.  Use of the other
  404.   cards may cause memory loss, and under certain circumstances  may
  405.   even damage your calculator electrically.
  406.  
  407.   From steveh@hpcvra.CV.HP.COM Fri Mar  1 17:00:00 1991
  408.   From: steveh@hpcvra.CV.HP.COM (Steve Harper)
  409.   Date: Fri, 11 May 1990 16:52:07 GMT
  410.   Subject: Re: Memory Card: Give Us *True* Facts!
  411.   Organization: Hewlett-Packard Co., Corvallis, OR, USA
  412.  
  413.   My previous statement that under certain circumstances the
  414.   calculator may even be damaged electrically is not a ploy.
  415.   If the calculator's internal power supply voltage happens to
  416.   be near the low end of the range, say 4.1 V, and the voltage
  417.   at which the card's voltage control chip shuts it down
  418.   happens to be near the high end of its range, say 4.2 V (this
  419.   can and does occasionally occur for the non-HP48SX cards),
  420.   then the calculator will start to drive the memory address
  421.   lines and the card will still have these clamped to ground
  422.   (that's what it does to protect itself when there is not
  423.   sufficient system voltage to run).  This unfortunate situation
  424.   may simply trash your memory, or if the calculator tries
  425.   to drive enough of the lines high at the same time, several
  426.   hundred milliamps may flow...for awhile that is, until something
  427.   gives up...  On the other hand, your calculator and a particular
  428.   non-HP48SX card may work just fine if those voltages happen
  429.   to be at the other end of their ranges.  These voltages are
  430.   also slightly temperature sensitive.  It may work in the
  431.   classroom or office and not at the beach, or vice versa.
  432.   The voltage trip point of the HP48SX cards has been set
  433.   lower (a different voltage control chip) so that this cannot
  434.   occur, regardless of part and temperature vtem was brought to my attention yesterday by
  435.   Preston Brown that I should have included in my original
  436.   posting here.  While most of us recognize that comparing
  437.   ram cards to a handful of dynamic ram chips to plug into
  438.   your PC is apples and oranges, it may be more interesting
  439.   to compare the HP48SX cards with cards for other products,
  440.   like the Atari Portfolio, the Poquet, the NEC Ultralite,
  441.   etc.  I believe you will find that the prices on the
  442.   HP48SX cards are not at all out of line.
  443.  
  444.   Steve
  445.   "I claim all disclaimers..."
  446.  
  447.   the non-HP48SX cards
  448.  
  449.   From prestonb@hpcvra.CV.HP.COM Fri Mar  1 17:00:00 1991
  450.   From: prestonb@hpcvra.CV.HP.COM (Preston Brown)
  451.   Date: Thu, 17 May 1990 17:26:53 GMT
  452.   Subject: Re: Memory Card: Give Us *True* Facts!
  453.   Organization: Hewlett-Packard Co., Corvallis, OR, USA
  454.  
  455.   When the RAM cards detect that voltage is to low to operate they
  456.   clamp the address lines to ground.  This clamping is done by turning
  457.   on the output drivers of a custom chip included on the card.  The
  458.   clamping current is speced at 2mA min at the Vol output level.  Since
  459.   the 48 can be trying to drive the line all the way high even more
  460.   current is typical.  10mA per fight is not uncommon with totals of
  461.   several hundred mAs.
  462.  
  463.   The VDD power supply is regulated at 4.1 - 4.9 with typical
  464.   parts at the low end (4.3).  The power to the cards is switched
  465.   thru a transistor, creating up to a 0.1V drop.  Standard Epson
  466.   cards have a significant chance of seeing this voltage as
  467.   to low and shutting down.  We have seen cards do this in the lab.
  468.   When it occurs the calculator locks up with VDD pulled down
  469.   to about 2.5V and 250mA being drawn from the batteries.  This
  470.   current drain greatly exceeds the ratings for the power supply
  471.   and can damage your calc.  The least that will happen is a loss
  472.   of memory.
  473.  
  474.   Now, why didn't we regulate VDD higher?
  475.   The 48 has two power supplies VDD at 4.3 and VH at 8.5.  VH
  476.   cannot be regulated higher without exceeding the spec for
  477.   our CMOS IC process.  VH is used as the + voltage for the I/O.
  478.   In order to meet a +3V output level VH must be more then 3.6V
  479.   above VDD.  (VDD is used as I/O ground). Our power supply
  480.   system increase the battery life and reduces the cost greatly
  481.   for the wired I/O.
  482.  
  483.   Preston
  484.  
  485.  
  486. * Appendix C: Compact Data Storage:
  487.  
  488.   From Jim Donnelly (jimd@cv.hp.com):
  489.  
  490.         A simple length-encoding technique can be put to use for a
  491.         free-format, very compact multi-field data storage system.
  492.         Two tiny programs, SUBNUM and STRCON are here to help the
  493.         process, and are listed near the end of this note.  At the
  494.         end of the note is a directory that may be downloaded into
  495.         the HP 48 that contains the examples.
  496.  
  497.         The principle is to store starting indices in the beginning
  498.         of a string that point to fields stored subsequently in the
  499.         string.  The indices are stored in field order, with an
  500.         additional index at the end to accommodate the last field.
  501.         There are several small points worth mentioning:
  502.  
  503.         1) Fields may be 0-length using this technique.
  504.         2) The execution time is uniform across all fields.
  505.         3) This technique saves about 4 bytes per field after
  506.            the first field, because the string prolog and length
  507.            are omitted for fields 2 -> n.
  508.  
  509.  
  510.         EXAMPLE:
  511.         --------
  512.  
  513.                          Indices  |          Fields
  514.           Character               |     1 11111111 12222222222
  515.           Position :   1  2  3  4 |567890 12345678 90123456789
  516.                       +--+--+--+--+------+--------+-----------+
  517.           String :    | 5|11|19|30|Field1| Field2 |  Field 3  |
  518.                       +--+--+--+--+------+--------+-----------+
  519.  
  520.         This is a string that contains 3 fields, and therefore 4
  521.         index entries.  The first field begins at character 5, the
  522.         second field begins at character 11, and the third field
  523.         begins at character 19. To keep the pattern consistent,
  524.         notice that the index for field 4 is 30, which is one more
  525.         than the length of the 29 character data string.
  526.  
  527.         To extract the second field, place the string on the stack,
  528.         use SUBNUM on character 2 to extract the starting position,
  529.         use SUBNUM on character 3 to extract the (ending position +1),
  530.         subtract 1 from the (ending position+1), then do a SUB to
  531.         get the field data.  NOTE: The index for field 1 is stored
  532.         as character code 5, NOT "5"!  To place the field index for
  533.         field 1 in the string, you would execute "data" 1 5 CHR REPL.
  534.  
  535.  
  536.         PROGRAM:
  537.         --------
  538.  
  539.         The following program accepts an encoded data string in
  540.         level 2 and a field number in level 1:
  541.  
  542.         DECODE   "data"  field#  -->  "field"
  543.  
  544.         <<  --> f
  545.           <<
  546.             DUP f SUBNUM                ; "data" start -->
  547.             OVER f 1 + SUBNUM           ; "data" start end+1 -->
  548.             1 -                         ; "data" start end -->
  549.             SUB                         ; "field" -->
  550.           >>
  551.         >>
  552.  
  553.  
  554.         DATA ENCODING
  555.         -------------
  556.  
  557.         The following program expects a series of 'n' strings on
  558.         the stack and encodes them into a data string suitable
  559.         for reading by the first example above.
  560.  
  561.         The programs SUBNUM and STRCON are used to assemble the
  562.         indices.
  563.  
  564.         ENCODE      field n  ...  field 1   n   -->  "data"
  565.  
  566.         << DUP 2 + DUP 1 - STRCON --> n  data
  567.           <<
  568.             1 n
  569.             FOR i
  570.               data i SUBNUM OVER SIZE   ; ... field index fieldsize
  571.               + data SWAP               ; ... field "data" index'
  572.               i 1 + i + SWAP CHR REPL   ; ... field "data"'
  573.               SWAP + 'data' STO         ; ...
  574.             NEXT
  575.             data                        ; "data"
  576.           >>
  577.         >>
  578.  
  579.         In this example, four strings are encoded:
  580.  
  581.         Input:  5: "String"
  582.                 4: "Str"
  583.                 3: "STR"
  584.                 2: "STRING"
  585.                 1:         4
  586.  
  587.         Output: "xxxxxSTRINGSTRStrString"      (23 character string)
  588.         (The first five characters have codes 6, 12, 15, 18, and 24)
  589.  
  590.  
  591.  
  592.         VARIATION:
  593.         ----------
  594.  
  595.         The technique above has a practical limit of storing
  596.         up to 254 characters of data in a string.  To overcome
  597.         this, just allocate two bytes for each field position.
  598.         The code to extract the starting index for becomes a
  599.         little more busy.  In this case, the index is stored as
  600.         two characters in hex.
  601.  
  602.                       Indices  |          Fields
  603.        Character               | 11111 11111222 22222223333
  604.        Position :   12 34 56 78|901234 56789012 34567890123
  605.                    +--+--+--+--+------+--------+-----------+
  606.        String :    |09|0F|17|21|Field1| Field2 |  Field 3  |
  607.                    +--+--+--+--+------+--------+-----------+
  608.  
  609.            <<  --> f
  610.              <<
  611.                 DUP f 2 * 1 -           ; "data" "data" indx1 -->
  612.                 SUBNUM 16 *             ; "data" 16*start_left_byte  -->
  613.                 OVER f 2 * SUBNUM +     ; "data" start
  614.                 OVER f 2 * 1 + SUBNUM   ; "data" start end_left_byte -->
  615.                 16 * 3PICK f 1 + 2 *
  616.                 SUBNUM + 1 -            ; "data" start end -->
  617.                 SUB                     ; "field"  -->
  618.              >>
  619.            >>
  620.  
  621.  
  622.  
  623.         TWO VERY TINY HELPFUL PROGRAMS
  624.         ------------------------------
  625.  
  626.         SUBNUM          "string"  position  -->  code
  627.  
  628.         << DUP SUB NUM >>
  629.  
  630.  
  631.  
  632.         STRCON          code  count  -->  "repeated string"
  633.  
  634.         << -->  code count
  635.           << "" code CHR 'code' STO
  636.              1 count START code + NEXT
  637.           >>
  638.         >>
  639.  
  640.  
  641.         A DIRECTORY YOU CAN DOWNLOAD
  642.         ----------------------------
  643.  
  644.         This is a directory object.  Cut after the === to the end of
  645.         the file and download to your HP 48 using the ASCII transfer.
  646.  
  647. ========================================================================
  648. %%HP: T(3)A(D)F(.);
  649. DIR
  650.   DECODE
  651.     \<< \-> f
  652.       \<< DUP f
  653. SUBNUM OVER f 1 +
  654. SUBNUM 1 - SUB
  655.       \>>
  656.     \>>
  657.   ENCODE
  658.     \<< DUP 2 + DUP 1
  659. - STRCON \-> n data
  660.       \<< 1 n
  661.         FOR i data
  662. i SUBNUM OVER SIZE
  663. + data SWAP i 1 +
  664. SWAP CHR REPL SWAP
  665. + 'data' STO
  666.         NEXT data
  667.       \>>
  668.     \>>
  669.   STRCON
  670.     \<< \-> code count
  671.       \<< "" code CHR
  672. 'code' STO 1 count
  673.         START code
  674. +
  675.         NEXT
  676.       \>>
  677.     \>>
  678.   SUBNUM
  679.     \<< DUP SUB NUM
  680.     \>>
  681. END
  682.  
  683.  
  684. * Appendix D: Various useful functions
  685.  
  686.      (Shamelessly lifted from the HP-41C manual:)
  687.  
  688.      The LASTX function is useful in calculations where a number occurs
  689.      more than once.  By recovering a number using LASTX, you do not
  690.      have to key that number into the calculator again.
  691.  
  692.      For example, calculate:
  693.  
  694.                 96.704 + 52.394706
  695.                --------------------
  696.                      52.394706
  697.  
  698.         Keystrokes:                     Stack:
  699.        ------------------              --------------------
  700.         96.704 ENTER                    96.704
  701.  
  702.         52.304706 +                     149.098706
  703.  
  704.         LASTX                           149.098706
  705.                                         52.304706
  706.  
  707.         /                               2.84568265351
  708.  
  709. @
  710. @ This is a version of LASTX for the HP 48SX
  711. @
  712. %%HP: T(3)A(D)F(.);
  713. \<< DEPTH \-> n
  714.   \<< LASTARG DEPTH n
  715. - DUP \-> s
  716.     \<< ROLLD s 1 -
  717. DROPN
  718.     \>>
  719.   \>>
  720. \>>
  721.  
  722.  
  723.