HP48 FAQ Section 8: Questions about programming and advanced user functions

Previous Contents Next

8.1 I've heard the names RPL, Saturn, STAR, GL etc... What are they?

ASAP

This is a simple Saturn assembler, written in the Perl language.

Chip8, Chip48, Schip, Schip8

This is a machine-code program that was inspired by the chip8 video game interpreter for the RCA CDP1802 microprocessor several years back. Chip8 allows you to write a simple graphics-based video game for the HP48 SX. Among the games written are "clones" of Breakout, PacMan, and Pong, to name a few.

Chip48, Schip and Schip8 are two different names for an enhanced version of chip8 specifically designed for the HP48 SX. People have written programs to assemble Schip assembly language into a form directly usable by Schip on an HP48. Schip interpreters are available for both G and S series.

GL

GL (Game Language) is a language for the programmer who wants almost the speed of assembly, but who doesn't want to spend a lot of time and effort to learn all the tricks of assembly programming on the HP48. GL has an assembly-like syntax, and there is an assembler for PC and one for the HP48 itself. Since GL is an interpreter, the GL library (3 KB in size) must be installed on the HP48 to run GL programs. The instruction set is powerful, with sprites and pixel based graphics, scrolling, sound, keyboard control, and more. There are 256 1-byte registers which can be used in pairs as 2-byte words. A GL program can be up to 64 KB in size. GL was inspired by SCHIP, but it is much better in all aspects. It is suitable for many applications, not only games, that require high speed. Of course it works on both the HP48 S/SX and the G/GX. GL is written by Erik Bryntse.

Java

Java is a library that displays an improved 5 level stack. It combines the best of SOL, HPSauce, EQStk, and others. Plus there are several new features and improvements! The intent of Java is to provide a more useful and faster stack environment for HP48 calculators.

The HP48 Java library has no connection at all to the Sun Microsystems product of the same name. Since the Java library is not a commercial product, we do not expect this to a problem.

Jazz

This is best System RPL and Machine Language development library that runs right on your HP48! Written by Mika Heiskanen. The Jazz library provides commands for assembling, disassembling and debugging both System RPL and machine language.

ML

Machine Language. This is usually used in reference to HP48 assembly language programming.

MLDL

Machine Language Development Library. This is a library that allows you to debug machine language programs with only an HP 48.

PDL

"Program Development Link". This is an DOS program, sold by Hewlett-Packard, that allows you to write and develop HP48 applications from your IBM PC clone. Programs are written on your PC, transferred to the HP48, and tested from your PC (and not the HP48).

RPL

RPL is the name of the language used to program the HP48 and HP-28 series calculators. RPL stands for "Reverse Polish Lisp". It's interesting to note that an HP Journal article incorrectly described RPL as "ROM-based Procedural Language".

From Bill Wickes:

RPL stands for Reverse Polish Lisp. In the early days of RPL development, we got tired of calling the unnamed system "the new system," and one of the development team came up with "RPL," both as a play on "RPN" which has been the loved/hated hallmark of HP calcs forever, and as an accurate indication of the derivation of the language from Forth and Lisp.

RPL was never particularly intended to be a public term; at the time of the HP Journal article (August 1987) on the HP 28C there was an attempt to create a less whimsical name--hence "ROM-based procedural language," which preserved the initials but had a more dignified sound. The development team never calls it anything but (the initials) RPL. You can choose either of the two full-word versions that you prefer. Or how about 'Rich People's Language?'

SASS

SASS is a simple Saturn assembler, written in C/yacc (BSD Unix & Bison). It uses Alonzo Gariepy's mnemonics.

Saturn

"Saturn" is the internal code name for the processor used in the HP48, HP-28 series, and many other calculators (just about all HP calculators since the HP 18/28 series).

STAR

This is the "Saturn Macro Assembler" (how "STAR" comes from this, I don't know), an assembler that uses mostly Alonzo Gariepy's mnemonics. It's written in C and runs on many different machines (PCs, Amigas, Unix, etc.). STAR is available via anonymous ftp from ftp://ftp.hp.com/pub/calculators/unix/star-1.04.4.tar.gz

System RPL

This is the name for the custom "operating system/language" used to program the CPU used in the HP48 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 HP48 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 HP48 SX RPL and machine code. You download a copy of the RAM and ROM in your HP48 SX 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 ftp://ftp.hp.com/pub/calculators/, and from various bulletin boards (the HP handhelds forum in CompuServe also has a copy). The latest version is "1.07".

8.2 Is there a C compiler for the HP48?

Yes. Alex Ramos has written a GNU C back end for the Saturn processor. Binaries are available for both Linux and Windows 95/NT, and source is available for compilation on other platforms.

Check http://www.cris.com/~ramos/hp48/hp48xgcc.htm for the latest version.

8.3 Why do SysRPL programs run faster than UserRPL programs?

SysRPL is the built in language, custom designed for the Saturn processor used the HP48 family. UserRPL is a "subset" of SysRPL. The main reason for the speed difference is the fact that UserRPL commands have built in argument and error checking. In SysRPL, the programmer is responsible for all error checking to avoid memory clears.

Note that System RPL is a compiled language and that therefore you need a program like Jazz or GNU-Tools to create it. This means you can't edit or view SysRPL on the HP48 directly, unlike UserRPL. However both can be run the same way.

8.4 What is a good reference for learning SysRPL and ML?

Jim Donnelly's book "An Introduction to HP48 System RPL and Assembly Language Programming" provides 230 pages of step by step instructions for new programmers with plenty of examples. It also comes with a 3.5 inch disk containing the examples in source form and HP's development tools for DOS. It was previously available from EduCalc, I'm not sure if it is available elsewhere.

The ISBN number is: 1-879828-06-5

Also useful are RPLMAN.DOC and SASM.DOC available on Goodies Disk 4. See Appendix E-5 for more information. You might want to also have a look at the following URL: http://titan.cs.uni-bonn.de/~wolfrum/hpbooks.html

Examples of ML programming can be found at:

8.5 Can I make my own libraries? Can I split others?

Yes, you can either use USRLIB in HP's development tools to create libraries in DOS, or you can make them right on your HP with hacking utilities like Rick Grevelle's D->LIB and L->DIR which can both create and split libraries from/to directories. These can be found in Mika Heiskanen's HACK library at http://www.engr.uvic.ca/~aschoorl/

8.6 How do I know what library ID number to use for my program?

Note: While this document says HP48 SX, it is also valid for GX.

HP48 SX Library ID Numbers Paul Swadener, HP Developer Support. 03 Sep 1993

The HP48 will become confused if two or more libraries currently in the machine have the same ID numbers. To help third party developer efforts, HP maintains a list of HP48 Allocated Library ID Numbers.

Below are the "rules." The penalty suffered from not following these rules is that your library may not work if another library is in the machine with the same number.

  1. Don't use any number in the range 000h through 300h. These are reserved for HP's use.
  2. Don't use any number in the range 301h through 5A0h unless you have been assigned that number by HP. These numbers are reserved for developers who are in the business of distributing their software, that is, Independent Software Developers. To apply for the allocation of an ID# contact Paul Swadener, Hewlett-Packard Company, 1000 NE Circle Blvd., Corvallis, OR 97330, fax number 541-715-2192, internet address paul_swadener@hp6400.desk.hp.com. You must be a registered developer and supply the name/nature of your product, and current shipping address and phone/fax/internet add./etc.
  3. Use a number in the range 5A1h through 600h for experimental work and software. HP does not track the use of these numbers.
  4. Use a number in the range 601h through 6F6h for your personal applications, those which you will share, if at all, only to a known set of other users for personal uses. HP does not track the use of these numbers.
  5. Don't use any number in the range 6F7 through 6FF, as these numbers were allocated before the formal allocation process in was instituted.
  6. Don't use any number above 700h. These are also reserved for use by HP.

Hope this helps clear up how library numbers work.

8.7 What information is there on the internals of the HP48?

The most important documents are part of the "System RPL" development tools, a completely unsupported set of IBM PC tools created by HP Corvallis (the creators of the HP48). The tools, which run on DOS machines only, contain documentation on:

However the documentation is also useful for some of the newer program development tools such as Jazz and GNU-Tools. (See the next question on where to obtain these).

8.8 Where can I get some programming development tools?

HP's unsupported System RPL development tools and documentation are available to customers free of charge to help them in HP48 application development, subject to certain legal terms, which are given with the tools (they're too long and detailed to give here).

You can get a copy in one of the following ways:

Alternatively, you can use one of the packages put together by members of the HP community. In particular, Jazz is a library by Mika Heiskanen which allows you to program in System RPL and Machine Language directly on your HP48! It requires either an SX with a RAM card, or a GX.

Jazz is available at http://www.engr.uvic.ca/~aschoorl/

There also is GNU-Tools by Mario Mikocevic (Mozgy) which is set of replacements for HP's development tools that not only runs on DOS, but also typical Unix systems such as Linux and Solaris. It is distributed in both source and binary form.

GNU-Tools is available at:

8.9 I know UserRPL. How do I get started in SysRPL?

Here is a quick guide to learning System RPL. See the other questions for more information on where to obtain the items below.

8.10 Are there any viruses for the HP48?

There are several, and most are French. In the United States, a virus called the "Michigan virus" erupted a couple of years ago. There is a program on Goodies Disk 8 that checks for the Michigan Virus. Currently, viruses do not pose an appreciable threat on HP48's.

8.11 How do I store fields of variable length effectively?

See Appendix A-5 near the end of this file.

8.12 What is "Vectored Enter", and how do I use it?

From: Bill Wickes

The HP48 manuals do not document a very powerful feature that we call "Vectored ENTER," that allows you in effect to redefine or bypass the command line parser and to have a shot at the stack etc. after the command line has been executed.

Keys that execute an automatic ENTER perform a two-step process:

  1. The command line is parsed and evaluated.
  2. The key definition is executed.
When flags -62 and -63 are both set, the system extends this process as follows:
  1. The current path is searched for a global variable named *aENTER (where "*a" is the Greek alpha character--character 140). If present, the command line is entered as a string object and *aENTER is executed. If absent, the command line is parsed and evaluated normally.
  2. The key definition is executed.
  3. The current path is searched for a global variable named *bENTER ("*b" is Greek beta--character 223). If present, then a string representing the key definition is put on the stack, and *bENTER is executed. The string is the key definition object's name if it is a command, XLIB name, global or local name, or an empty string for other object types; its primary purpose is to implement things like the TRACE mode on other calcs, where you can print a running record of what you do.
A simple example of the use of *aENTER is to create a more convenient binary calculator, where *aENTER slaps a "#" on the front of the command line so you don't have to bother when entering numbers.

8.13 What is "WSLOG"?

It is an until recently undocumented feature which stands for "Warm Start Log" (it is listed in the command appendix of newer G manuals, as well as being fully explained in the AUR).

Type in WSLOG in caps, and calc will list the time and cause of the last four warm starts. This feature helps HP technical support to fix your HP48 in case it crashes.

0 - log cleared by <ON> <SPC> then <ON>
1 - low battery condition, auto deep sleep mode invoked to save battery
2 - hardware failed during IR (time out)
3 - run through address 0
4 - system time corrupt
5 - deep sleep mode wake up (alarm?)
6 - unused
7 - CMOS test word in RAM was corrupted
8 - abnormality was detected about device config
9 - corrupt alarm list
A - problem with RAM move
B - card module pulled
C - hardware reset
D - system RPL error handler not found in run stream
E - corrupt config table
F - system RAM card pulled

8.14 What are SYSEVALs?

SYSEVALs are addresses that point directly to a location in the HP48's ROM. Many SYSEVAL hex strings are System-RPL commands. Because there is no argument checking, it very easy to clear your HP48's memory.

In the file SYMBOLS.GX, HP designates three types of entries. The first type is "supported." This means that a particular entry will work on ALL versions of the HP48 and HP supports the use of this entry.

The second type of entry is "unsupported." This means that HP does not support the use of this entry and it will not be the same on all versions of the HP48.

The third type is "unsupported-static." This is an entry to HP does not support the use of, but it is the same for all versions.

8.15 What are some useful SYSEVALs?

For a complete list of supported entry points, see http://www.engr.uvic.ca/~aschoorl/

In System-RPL, different HP object types are referred to by symbols. These symbols are used to construct stack diagrams, which tell the user how to use System-RPL commands. Here are some of the symbols:

Symbol  Type                        Example
------  --------------------        -----------------
$       string                      "ABCDEFG"
id      Global Name                 'A'
arry    Array                       [[ 1 2 ] [ 3 4 ]]
grob    HP48 Graphics Object        Graphic 131x64
#       Binary Number               <1h>
symb    Symbolic Object             'A^2+B^2'
To interpret the stack diagram:

Everything on the left of the -> arrow is the input. That needs to be on the stack before executing the SYSEVAL. The symbols show you which kinds of data to put on the stack. Once you execute the syseval (see next paragraph), the HP will return the data back that is indicated on the right side of the arrow.

To use the following entries, do the following:

  1. Make sure (triple check) that the appropriate arguments are on the stack.
  2. Push Right-shift /, you should get a # on the command line.
  3. Enter the hex string exactly as shown in the hex string column.
  4. Put an small case h at the end of the hex string.
  5. Press enter.
  6. Type SYSEVAL.
Here are just a few examples:
Hex    Sys-RPL Name    Category            Stack Diagram
---    ------------    --------            -------------

15777  NULLID          Supported           ( -> '' )
30794  VERSTRING       Supported           ( -> "HPHP48-?" )
3A328  MakeStdLabel    Supported           ( $ -> grob )
3A3EC  MakeDirLabel    Supported           ( $ -> grob )
3A38A  MakeBoxLabel    Supported           ( $ -> grob )
3A44E  MakeInvLabel    Supported           ( $ -> grob )
3A1FC  DispMenu.1      Supported           ( -> )
05F42  GARBAGE         Supported           ( -> )
41F65  WaitForKey      Supported           ( -> #KeyCode #Plane )
353AB  SYMB>IDS        Unsupported-Static  ( symb -> list )
40D25  LockAlpha       Supported           ( -> )
40D39  UnlockAlpha     Supported           ( -> )
3AA0A  1A/LockA        Supported           ( -> )
44C31  DoNewMatrix     Supported           ( -> arry )
44FE7  DoOldMatrix     Supported           ( arry -> arry' T/F )
1314D  TOADISP         Supported           ( -> )
13135  TOGDISP         Supported           ( -> )
39531  ClrDA1IsStat    Supported           ( -> )
130AC  RECLAIMDISP     Supported           ( -> )
4E347  TURNMENUON      Supported           ( -> )
05B15  $>ID            Supported           ( $ -> id )
05BE9  ID>$            Supported           ( id -> $ )
3A1E8  DispMenu        Supported           ( -> )
39BAD  DispStack       Unsupported-Static  ( -> )

8.16 What are LIBEVALs?

From: Joe Horn (Copied from "libeval.doc" on GD 9)

The G/GX has a new command: LIBEVAL. It's sort of like SYSEVAL, but instead of taking a memory address (which could be ambiguous due to the G/GX's massive need for bank switching), it takes XLIB numbers. It's a "back door" for us hackers. Unlike the ELSYSEVAL command in the HP Solve Equations Library Card, which only worked for the libraries in that card, LIBEVAL works for any library, including the hidden ones in the operating system.

CAUTION: LIBEVAL, like SYSEVAL, is both powerful and dangerous. If used with incorrect input(s) and/or in the wrong environment, it can nuke your memory.
LIBEVAL takes a single user binary integer of the form #LLLFFFh, where LLL is the library ID (hex), and FFF is the three-digit function number (hex, with leading zeros if necessary).

For example, the R->B command is XLIB 2 9. So you can perform a R->B by executing #2009h LIBEVAL. Try it: 10 #2009h LIBEVAL -> #Ah.

Using it for named commands is unnecessary, but the G/GX is highly XLIB oriented (again, due to the need for bank switching), and there are many useful and interesting features accessible only through LIBEVAL.

A prime example is the G/GX's inability to programmatically launch the new "dialog boxes". Suppose a program needs to print things; it would be awfully nice to be able to throw the I/O PRINT dialog box onto the screen. The User's Guide is no help here, and in fact it would seem impossible to do. But #B4197 LIBEVAL is all it takes! Try it. Cool, huh?

8.17 What are some useful LIBEVALs? (GX)

See Appendix B-3 for a few GX LIBEVALs.

8.18 What is the format of a GROB object?

Note: I received two very good answers to this question, and each cater to a different kind of user, so I will include them both.

The easy way:

First, add pixels to the right-hand edge to make the horizontal dimension a multiple of 8, then separate the object horizontally into groups of four pixels. Suppose, for example, you want to make this into a 22x8 GROB:

---------****---------
--------**--**--------
-------**----**-------
********------********
********------********
-------**----**-------
--------**--**--------
---------****---------
You would break it up like this:
 
---- ---- -*** *--- ---- ----
---- ---- **-- **-- ---- ----
---- ---* *--- -**- ---- ----
**** **** ---- --** **** **--
**** **** ---- --** **** **--
---- ---* *--- -**- ---- ----
---- ---- **-- **-- ---- ----
---- ---- -*** *--- ---- ----
Notice, I've added two columns of pixels to make it 24x8. Now, each group of four can be represented by a hexadecimal digit.
---- 0          --*- 4          ---* 8          --** C
*--- 1          *-*- 5          *--* 9          *-** D
-*-- 2          -**- 6          -*-* A          -*** E
**-- 3          ***- 7          **-* B          **** F

Now, replace each group of four pixels with its corresponding hexadecimal digit: 00E100 003300 081600 FF0CF3 FF0CF3 081600 003300 00E100.

So, your final grob is:

GROB 22 8 00E100003300081600FF0CF3FF0CF308160000330000E100 
The technical way:

  1. Every HP object format is described in RPLMAN.DOC, see this file for more info.
  2. All HP objects are (of course) nibble based. When viewing them on the PC, which is byte based, the low order nib is always read and written first.
  3. HP objects begin with a 5 nib prologue which identifies the object type (and other things). This is the prologue for a grob object..
    02B1E pr HP:DOGROB
    02B1E @  Graphic prologue (/U GROB)
    
  4. Every 5 nib sub field of an object, such as prologue, length, etc., is read in reverse order (low nib first). The grob prologue would appear E1B20, or 1E 2B x0 in a hex dump on a PC. The least significant nibble of the next field begins right at the x in x0.
  5. It is customary to always work with HP objects on the PC with the HPHP48-E header (substitute your favourite rom version letter) preceeding the prologue. This gives no hassles when downloading via Kermit or X-Modem.

PC hex dump of a grob object.. ( remember each 5 nib field is reverse order )

  1. "HPHP48-E" 8 byte ascii string with msb off
  2. 5 nib prologue, 02B1E (hex)
  3. 5 nib length field, includes length of body AND length and height fields! does not include 5 nib prologue. So, the total #nibs the grob object takes in HP memory is this number + 5. Important!
  4. 5 nib height field ( yes, it is height then width )
  5. 5 nib width field
  6. body (described below)
The grob object looking at it using command line EDIT on the HP..

GROB <width (dec)> <height (dec)> < body >

The body is exactly the same looking at it on a PC hex dump or on the command line EDIT. Just remember to read low nibble first for hex dump.

Because of hardware restrictions, the number of nibs required to represent one horizontal line must be even (byte aligned). So, use this method to calculate the number of nibs in one line.. (pascal example)

nibs := width div 4;
if nibs mod 4 <> 0 then nibs := nibs + 1;
if odd(nibs) then nibs := nibs + 1;
Then to get the #nibs in the entire body, multiply it by the height. Remember, the length field must be this total body length + 15 !

For example, a 131 wide grob requires 34 nibs for one horizontal line, where 5 of the bits are unused. The first nib in the second line begins at nib 35 for this grob, etc... If the grob is 64 lines, then the body is 2176 nibs. Add 5 for the prologue, 5 for the length field, 5 for height, and 5 for width. Total object size (on the HP) is 2196 nibs, or 1098 bytes. The length field should contain 2196 minus 5 for prologue = 2191 (0088F hex)

Note that for each nib, the right-most bit is the left-most pixel on the screen. This is nearly always the case for graphic memory.

8.19 What is the AUR and what information does it contain?

From: Jarno Peschier <jpeschie@cs.ruu.nl>

In this text I will try to answer a number of frequently asked questions about the HP48 G Series Advanced User's Reference Manual. In the remainder of this text I will use the common abbreviation AUR when referring to this book.

A good link for AUR information is at: http://www.contrib.andrew.cmu.edu/~drury/hp48gaur/

The questions I will try to answer are:

What is the AUR?

The AUR is just what it's name tells you it is: it's a reference manual for the HP48 G Series. It has the same outside appearance as the HP48 G Series User Guide (the manual you get with your HP48 G or HP48 GX when you buy it), except that it's much thicker (just under 4 cm). The AUR contains about 650 pages of useful information about your calculator.

What information does the AUR contain?

The AUR contains information about UserRPL programming, quite a lot of programming examples, a complete command reference for all the (UserRPL) commands the G Series knows and reference lists about all equations, error and status messages, units, etc... Of course it has an extensive index at the back of the book.

Chapter 1: Programming

Contains: Understanding Programming, Entering and Executing Programs, Viewing and Editing Programs, Creating Programs on a Computer, Using Local Variables, Using Tests and Conditional Structures, Using Loop Structures, Using Flags, Using Subroutines, Single-Stepping through a Program, Trapping Errors, Input, Stopping a Program for Keystroke Input, Output, Using Menus with Programs, Turning Off the HP48 from a Program.

Chapter 2: Programming Examples

Contains: Fibonacci Numbers, Displaying a Binary Integer, Median of Statistics Data, Expanding and Collecting Completely, Minimum and Maximum Array Elements, Applying a Program to an Array, Converting Between Number Bases, Verifying Program Arguments, Converting Procedures from Algebraic to RPN, Bessel Functions, Animation of Successive Taylor's Polynomials, Programmatic Use of Statistics and Plotting, Trace Mode, Inverse-Function Solver, Animating a Graphical Image.

Chapter 3: Command Reference

This chapter contains one entry for every command (except for RULES) from ABS to ZVOL and + to ->. Each entry contains:

  • A description of what the command does (with stack diagrams).
  • Ways in which you can access it from the keyboard (with submenu you need, or if you can only type it in in Alpha-mode).
  • Which flags the command is affected by.
  • Remarks, and a list of related commands.
Often a command has one or more example programs too. This chapter is the bulk of the whole book; it's 424 pages thick.

Chapter 4: Equation Reference

This chapter contains one entry for every section in the built in Equation Library (EQLIB). Each entry contains: a table of used variables and then for every set of equations an entry with some more info about the equation set, the picture that goes with it (if any), all the equations and one or more sets of example numbers and solutions. The end of the chapter has a list of references from which all the equations were taken.

Appendix A: Error and Status Messages

This chapter contains two tables with all possible messages. The first has them sorted alphabetically and shows the message, the meaning and the ERRN number in hex. The second has them sorted on ERRN number (and thus on category) and only contains the number in hex and the message itself.

Appendix B: Table of Units

This chapter contains a table with all units the HP48 G Series knows. It contains the unit (both the name you use on the calculator as well as the full name) and the value it represents in SI units.

Appendix C: System Flags

This chapter contains a table with all the system flags of the HP48 G Series. The table contains the number followed by a description of it's use and the results you get when the flag is set or clear.

Appendix D: Reserved Variables

This chapter contains a table with all the reserved variables of the HP48 G Series (ALRMDAT, CST, "der"-names, EQ, EXPR, IOPAR, MHpar, Mpar, n1/n2/..., Nmines, PPAR, PRTPAR, s1/s2/..., VPAR, ZPAR, SigmaDAT and SigmaPAR) with complete information about what they are used for and about all possible parameters that can be put into them.

Appendix E: New Commands

This chapter lists all the commands that are new to the HP48 G Series, with a brief description of what the commands do. A list like this can be found elsewhere in the HP48 FAQ list as well.

Appendix F: Technical Reference

Contains: Object sizes, Mathematical simplification rules used by the HP48, Symbolic differentiation patterns used by the HP48, the EquationWriter's expansion rules, References used as sources for constants and equations in the HP48 (other than those in the Equation Library).

Appendix G: Parallel Processing with Lists

This chapter contains info on parallel processing that makes UserRPL look even more like a real functional programming language by letting (almost) all the commands function on lists of parameters as well (i.e. adding map capabilities to all internal commands).

Do I need the AUR?

Yes, you do. In my humble opinion the AUR is just "The Manual, Part II" and every owner of a HP48 G or HP48 GX should have it, especially if you are (going to be) programming in UserRPL for any reason. A lot of the frequently asked questions that pop up on comp.sys.hp48 are simply questions that are meant to be answered by the AUR.

Why didn't HP supply the AUR with every HP48?

Since you're reading this FAQ, you're probably gifted: you are not an average HP48 user. The set of "average users" probably consists mostly of people that simply never program their HP48 in any way ("Wow, can it do that too?!"). In this case, they will never take one look at the AUR ever again, and since this is quite a thick book it would be a waste of money, trees, the environment, transportation costs, etc... to supply the AUR in every box. This is probably why HP made it an extra accessory for those people that "really need" it. I think...

Where can I get the AUR?

You should be able to buy (or order) it from the same shop where you purchased your calculator. The HP part number is 00048-90136. The book does not seem to have an ISBN; it's a HP part, not a book.

Does the AUR contain any SYSEVALs or LIBEVALs?

Yes, it contains exactly one. The example for the SYSEVAL command tells you that #30794h SYSEVAL gives you the version of your HP48. My HP48 GX rev. P gives "HPHP48-P".

Does the AUR say anything about SysRPL or ML?

No, it doesn't.

8.20 What is the syntax for INFORM, CHOOSE, and MSGBOX? (GX)

Based on a posting on HPCVBBS by Cary McCallister. Revised by Joe Horn. Re-formatted by Andre Schoorl.

INFORM - Create a Custom Input Form

INPUT:

5: "title"
4: { fields }
3: <format>
2: { reset_values }
1: { initial_values }
  
OUTPUT:

Either: 2: { new_values }
        1: 1

or:     1: 0
  
PURPOSE:

INFORM creates full-screen custom input forms, similar to those of the built-in applications.

ARGUMENTS:

title

Is displayed in font 1 (small) at the top centre of the screen. It may contain any number of characters, including 0, but, at most, 31 characters will be displayed. Strings longer than 31 character will be truncated to 30 characters and displayed with a trailing ellipsis. Line feed characters are displayed as boxes.

{ fields }

Is a list of the form { field1 field2 ... fieldn } where each field is any one of these forms:

1.    "label"
2.    { "label" "help" }
3.    { "label" "help" type1 type2 ... typen }
4.    { }
The "label" is a string of arbitrary text from 0 to 26 characters long (longer strings will be truncated to 25 characters with a trailing ellipsis). The "help" is displayed immediately above the menu area as a helpful prompt for the user. The object type specifications list the one or more object types allowed in the field, in the form the TYPE command returns. If unspecified, the default help text is blank and the field will accept all object types. If a field specification is an empty list, no field is produced; instead, the field to the immediate left (if any) is expanded to fill the omitted field's space. This allows further customization of form layout; for example, to have two fields in one row and three fields in the next.
<format>

May be any one of the following objects:

1.    { }
2.    columns
3.    { columns }
4.    { columns widths }
Where <columns> is the number of columns that the display will be divided into e.g., if <columns> is 2 and there are two fields, they will be displayed side by side rather than one above the other. <widths> is the tab width between the left edge of each title and its field; this makes vertical alignment of fields possible. Titles longer than one tab width will cause the tab to be repeated automatically. If unspecified, the default column count is one and the default tab stop width is three.
{ reset_values }

Is a list of values one per input field which replace the values of all fields when the {RESET} key is pressed and "Reset all" is selected. This list must either be empty or have exactly one item per field corresponding to the { fields } list above. If empty, then all fields are deemed unspecified (i.e., blank). Each reset value must match the type require by the form field. Selected fields may be marked as unspecified by using NOVAL as the reset value.

{ initial_values }

is a list of values one per input field which specify the start-up values of all fields when the INFORM command is invoked. This list must either be empty or have exactly one item per field corresponding to the { fields } list above. If empty, then all fields are deemed unspecified (i.e., blank). Each initial value must match the type require by the form field. Selected fields may be marked as unspecified by using NOVAL as the initial value.

RESULTS:

INFORM returns the new field values { new_values } as a list to level 2 and the real value 1 to level 1 if the user completes the input form by pressing {OK} or [ENTER]. The list will contain one item per field. Each item will either be the last input value for the corresponding field, or NOVAL if the field was unspecified.

INFORM returns the real value 0 to level 1 if the user terminates the input form by pressing {CANCL} or [CANCEL].

REMARKS:

NOVAL is basically a command (an XLIB name) that does nothing when evaluated. It can, however, be compared via ==, SAME and POS.

CHOOSE - Create a User-Defined Choose-Box

INPUT:

3: "title"
2: { items }
1: <initial_item_number>
  
OUTPUT:

Either: 2: { chosen_item }
        1: 1

or:     1: 0
  
PURPOSE:

CHOOSE creates a user-defined "choose-box": a displayed box containing items from which the user can choose one.

CHOOSE displays a standard choose box (normal, not maximized; single-pick, not multi-pick) with an optional title line.

ARGUMENTS:

title

If any, is displayed in font 1 (small) in the top centre of the box. It may contain any number of characters, including 0, but, at most, 22 characters will be displayed. Strings longer than 22 character will be truncated to 21 characters and displayed with a trailing ellipsis. Line feed characters are displayed as boxes. If there are more than four items such that the scroll arrows are displayed, the maximum number of title characters is reduced to 21. The title text is displayed in the title area in character font 1 (the menu font). If the title string is empty, no title area will be created in the choose box, and the whole box will be devoted to the items.

{ items }

Is a list of arbitrary objects. Each item occupies one line in the choose box and is displayed in its command line form. Only the first 14 characters of the displayed object will be shown (13 if the scroll arrows are present). If an item contains more than 14 (13) characters, it will be truncated to 13 (12) and the final character will be replaced by an ellipsis. If every item is a list of exactly two objects, the first object will be displayed and the second returned if the item is selected. If the number of items exceeds 4 with a title and 5 without, scroll arrows will be displayed, and moving the highlight past the top or bottom of the box will scroll through the undisplayed items.

<initial_item_number>

Specifies the initial field to be highlighted when the display first comes up (ordinarily 1). A value of 0 indicates that no field is to be highlighted and that the {CANCL} key is to be omitted from the menu, making the choose box act as an informational display without user selection.

RESULTS:

CHOOSE returns the chosen item (or the second object in a two-element item list) and the real number 1 if the user completes the choose box by pressing {OK} or [ENTER]. CHOOSE returns the real number 0 if the user terminates the choose box by pressing {CANCL} or [CANCEL].

MSGBOX - Create a Simple Message Box

INPUT:

1: "Message_string"
  
OUTPUT:

None
  
PURPOSE:

MSGBOX creates a simple pop-up message box over the current display, with a 3D shadow to make it easy to recognize, and containing any arbitrary text.

ARGUMENTS:

Message_string

Is any string of characters. The text is displayed in font 2 (medium size), left justified, with a maximum line length of 15 characters. Longer lines are broken into multiple lines automatically, at word breaks when possible, up to a maximum of 5 lines. Line feeds may be included to force line breaks. The minimum number of lines is 2, so single-line messages will have a blank line at the bottom of the box.

RESULTS:

None. MSGBOX is exited when the user presses CANCEL, ENTER, or OK, but nothing is returned to the stack.

For examples of INFORM, CHOOSE, and MSGBOX see Appendix B-2.

8.21 How do I put checkfields in my INFORM menus?

From: Matt Willis

You can't normally do this directly in User RPL. You can do it in System RPL (see Jim Donnelly's book for details), or you can use the library at http://www.hpcalc.org/hp48/programming/misc/infm2v1.zip

I figured that the System RPL version of DoInputForm was unpleasant enough to use on a casual basis so I wrote a simple library that lets you use check boxes and choose lists from User RPL.

All it does is stop execution of INFORM just before DoInputForm, then search the stack and change object types to check and choose objects. Then it restarts the INFORM command. At the end, it tidies up TRUE/FALSE to 1/0 etc...

Example syntax:

"Test" {
"A" "B" "C" } 1 {} { :CHECK: 1  :CHOOSE: { 1 2 3 }  NOVAL }
IF INFORM2 THEN
   ...insert code here...
END

8.22 What is the syntax for the INPUT command?

From: John Meyers

INPUT allows you to display a message and then edit a given string using the command line editor; the edited string is its result.

Arguments:

Level 2:

"message"

The message is displayed in "medium font" in the upper part of the "stack display area" (the stack itself is not visible during the INPUT command). The message may be an empty string, or may contain newlines for a multiple-line message.

Level 1:

The most general format is a non-empty list containing up to three optional specifications, which may appear in any order:

{ "string" { row column } mode(s) }

"String" is the initial text which will appear in the command line; it may be an empty string, or may contain newlines for a multiple- line text. If you do not need to specify any other of the optional arguments, you may omit the list itself and supply only the string on level 1. If the string is omitted from an argument list, the default is an empty string.

Mode(s) are zero or more of the following special reserved names:

If the user presses CANCEL during INPUT when there is some text in the command line, all the text will be erased without canceling INPUT; if CANCEL is pressed again (or with no text), then INPUT is canceled.

Examples of use in a program:

"Enter A, B, C" {
":A:
:B:
:C:" { 1 0 } V } INPUT

Note: Put newlines between the three lines of the initial string.

When executed, the screen shows:

Enter A, B, C
:A:(cursor appears here)
:B:
:C:

If you now press 1 DownArrow 2 DownArrow 3 ENTER, the string returned on the stack is:

":A:1
:B:2
:C:3"

If you then do OBJ-> on this string, you get (on separate stack levels):

:A: 1
:B: 2
:C: 3

The optional "tags" do not interfere with using the numeric values in functions, or storing them (tags are automatically removed in each case).

Another example:

"Type a new notecard" { Alpha-symbol } INPUT

This allows the user to type any free-form text, which is returned as a string upon pressing ENTER.

Simplest possible example:

"" "" INPUT  (no message, empty initial command line)

Potential problems with INPUT (if OBJ-> is to be used afterwards to get the values entered):

For applications expecting non-text values to be entered, the HP48G/GX INFORM command is more immune to these problems, and affords much tighter control over what is entered, in addition to providing a more beautified display form, a separate prompt for each input field, etc. The syntax for INFORM is detailed elsewhere in the FAQ.


Previous Contents Next

Part of the HP Calculator Archive - http://www.hpcalc.org/