**HP48 FAQ Section 10: Appendix B: GX Specific Information**

Previous | Contents | Next |

From: Joe Horn

**AUTOMATIC LIST PROCESSING**Almost all commands that did not accept list(s) as their arguments can do so now. Here are just a few examples:

Since + has always been used to concatenate lists, a new ADD function exists to add the elements of two lists, like this:{ 1 2 3 } SF sets flags 1, 2, and 3 { 1 2 3 } SQ --> { 1 4 9 } { 2 4 } 10 / --> { .2 .4 } 10 { 2 4 } / --> { 5 2.5 } { 10 12 } { 2 4 } / --> { 5 3 } { .1 .2 .5 } ->Q --> { '1/10' '1/5' '1/2' } { freq freq ...} { dur dur ... } BEEP can play a song with no audible hiccup between tones.

The only commands which do not have automatic list processing are:{ 1 2 3 } { 4 5 6 } ADD returns { 5 7 9 }, whereas { 1 2 3 } { 4 5 6 } + returns { 1 2 3 4 5 6 } as it did before.

- those which never get a Bad Argument Type error (like DUP),
- meta-object commands (like ROLL),
- program branch structures (like FOR), and
- commands that specifically work on lists (like GET).

Sometimes the results are non-obvious, for example:

List processing is only recursive for ->Q and ->Qpi.5 { A B C } STO --> A=5, B=5, C=5 { 5 6 7 } 'A' STO --> A={ 5 6 7 } (same as on SX) { 5 6 7 } { A B C } STO --> A=5, B=6, C=7

**PORTS AND MEMORY**The HP48 G, like the 48 S, only has 32K RAM. The GX, unlike the SX, has 128K RAM built-in. Card slot 1 can contain another 128K (maximum), but card slot 2 can contain up to 4 megabytes of RAM.

Only port 1 can be merged in the GX. Card slot 2, which is intended for large-capacity RAM cards, is permanently "free", and is automatically divided up into 128K "ports", each of which becomes Port 2, Port 3, Port 4, etc. Up to 4 Megabytes can be plugged into slot 2, which would then become Port 2 through Port 33. (Although the FREE and MERGE commands were kept for HP48 SX compatibility, GX users will prefer the new FREE1 and MERGE1 commands). Therefore the maximum amount of merged main memory is 256K (unlike the SX which allowed up to 288K) after MERGE1; the maximum amount of fully online free independent memory is 4224K after FREE1.

**LOCAL VARIABLES**Variable names prefixed with a <- (backarrow character) are compiled as local (temporary) variable name objects even if they're not explicitly after FOR or ->. This allows programs to share values through local variables, which is much faster than sharing values through global variables, and they get purged automatically.

**SPEED**CPU clock speed is double the S/SX's, but throughput is estimated to be only 40% faster, primarily due to the fact that all RAM & ROM is now bankswitched (on the S/SX only a 32K portion of the ROM required bank switching), and it still has the same 4-bit bus bottleneck.

**IMPROVED COMMANDS:**- AXES can now also specify the spacing of the tick marks.
- DEPND can now also specify the initial values and tolerance for the new DIFFEQ plot type.
- REPL and SUB now work on arrays.

**HP SOLVE EQUATION LIBRARY CARD COMMANDS:**- AMORT, amortization calculations
- CONLIB, starts Constants Library catalog
- CONST, returns value of a named CONLIB constant
- DARCY, calculates Darcy friction factor
- EQNLIB, starts Equation Library catalog
- F0lambda, calculates black-body power fraction
- FANNING, calculates Fanning friction factor
- LIBEVAL is a generalized form of the EQ card's ELSYSEVAL; it executes any XLIB by its library number
- MCALC, marks an MSOLVR variable as "not user-defined"
- MINEHUNT, starts the "Minehunt" video game
- MINIT, initializes Mpar from 'EQ' for MSOLVR
- MITM, customizes title & menu of MSOLVR's screen
- MROOT, solve for variable(s) in MSOLVR
- MSOLVR, shows Multiple Equation Solver menu
- MUSER, marks an MSOLVR variable as "user-defined"
- SIDENS, density of silicon as function of temperature
- SOLVEQN, starts solver for specified EqLib equation(s)
- TDELTA, subtracts temperatures like "-" ought to but doesn't
- TINC, adds temperatures like "+" ought to but doesn't
- TVM, shows the financial calculator (Time Value of Money) menu
- TVMBEG, sets payments-at-beginning-of-periods mode
- TVMEND, sets payments-at-end-of-periods mode
- TVMROOT, solves for a TVM variable
- ZFACTOR, calculates gas compressibility factor Z

Note: The EQ Card's Periodic Table and Tetris game are not in the HP48 G/GX, but the EQ Card can be used in the GX if those applications are needed. Tetris was not included because no agreement on royalty was reached. The Periodic Table is available separately as freeware on HPCVBBS.

**NEW ARRAY COMMANDS:**- COL+, inserts a column vector into a matrix or a number into a vector (like INSCOL/PUTCOL in Donnelly's Tool Library)
- COL-, deletes a column from a matrix or number from a vector (identical to DELCOL in Donnelly's Tool Library)
- COL->, combines multiple column vectors into a matrix
- ->COL, breaks a matrix into multiple column vectors (like repeated GETCOL in Donnelly's Tool Library)
- COND, column norm condition number of a square matrix
- CSWP, swaps two columns in a matrix (like EXCOL in Donnelly's Tool Library)
- ->DIAG, returns vector of major diagonal elements of a matrix
- DIAG->, creates matrix with specified diagonal elements
- EGV, eigenvalues and right eigenvectors of a square matrix
- EGVL, eigenvalues of a square matrix
- FFT, discrete Fourier transform
- IFFT, inverse discrete Fourier transform
- LQ, returns the LQ factorization of a matrix
- LSQ, minimum norm least-squares solution to an ill-determined system of linear equations
- LU, returns the Crout LU decomposition of a square matrix
- PCOEF, returns polynomial with given roots (inverse of PROOT)
- PEVAL, evaluates polynomial at x
- PROOT, finds all roots of polynomial (inverse of PCOEF)
- QR, returns QR factorization of a matrix
- RANK, rank of a rectangular matrix (uses flag -54)
- RANM, creates matrix with random elements
- RCI, multiplies elements in one row of a matrix by a scalar
- RCIJ, does RCI then adds the result to a row
- ROW+, inserts a row vector into a matrix or a number into a vector (like INSROW/PUTROW in Donnelly's Tool Library)
- ROW-, deletes a row from a matrix or number from a vector (identical to DELROW in Donnelly's Tool Library)
- ROW->, combines multiple row vectors into a matrix
- ->ROW, breaks a matrix into multiple row vectors (like repeated GETROW in Donnelly's Tool Library)
- RSWP, swaps two rows in a matrix (identical to EXROW in Donnelly's Tool Library)
- SCHUR, computes the Schur decomposition of a square matrix
- SNRM, spectral norm of an array
- SRAD, spectral radius of a square matrix
- SVD, singular value decomposition of a matrix
- SVL, computes the singular values of a matrix
- TRACE, sum of diagonal elements of a square matrix

**GRAPHICS and PLOTTING COMMANDS:**- ANIMATE, displays grobs on the stack sequentially. You can use the defaults, or specify your own delay between frames (can be very fast), the number of times to repeat the sequence, and even the pixel coordinates. It's just like a ROLL REPL loop... except very fast. Note: Charlie Patton converted 17 seconds of the Apollo moon-walk video into HP48 GROBs and ran them with ANIMATE, and it looked very good!
- ATICK, specifies tick spacing on plot axes
- EYEPT, specifies the eye-point coordinates in a perspective plot
- GRIDMAP, selects the new "gridmap" plot type
- PARSURFACE, selects the new "parametric surface" plot type
- PCONTOUR, selects the new "pcontour" plot type
- PICTURE, same as GRAPH command
- SLOPEFIELD, selects the new "slopefield" plot type
- WIREFRAME, selects the new "wireframe" plot type
- XVOL, sets the width of the 3D plotting volume
- XXRNG, sets the width of the 3D target mapping range for gridmap and parametric surface plots
- YSLICE, selects the new "yslice" plot type
- YVOL, sets the depth of the 3D plotting volume
- YYRNG, sets the depth of the 3D target mapping range for gridmap and parametric surface plots
- ZVOL, sets the height of the 3D plotting volume

**USER-INTERFACE COMMANDS:**- CHOOSE, displays a point-and-click menu "dialog box"
- INFORM, formatted multi-line input with named fields (nice!!)
- MSGBOX, displays text in a centred box with shadow, then WAITs
- NOVAL, placeholder for unspecified values in INFORM argument list

**LIST PROCESSING COMMANDS:**- ADD, adds lists element-wise (see section above)
- DOLIST, evals an object on multiple lists
- DOSUBS, evals a program or command taking arguments from a list
- ENDSUBS, returns the number of loops the current DOSUBS will do
- HEAD, first element in a list or first char in a string (identical to CAR in Donnelly's Tool Library)
- DeltaLIST, list of first finite differences of list objects
- SigmaLIST, sum of the elements in a list
- PiLIST, product of the elements in a list
- NSUB, returns the current list pointer value during a DOSUBS
- REVLIST, reverses the order of the objects in a list (like REVERSE in Donnelly's Tool Library)
- SEQ, list of results from repeated execution of an object (like a FOR/STEP loop but the results go into a list)
- SORT, sorts elements in a list into ascending order, or sorts a list of lists using each list's first element as the key (can be done with LSORT/QSORT in Donnelly's Tool Library)
- STREAM, executes an object on first two elements of a list, then again on the result and the 3rd element, etc. Allows easy creation of things similar to SigmaLIST and PiList.
- TAIL, returns a decapitated list or string (see HEAD above) (identical to CDR in Donnelly's Tool Library)

**SYSTEM COMMANDS:**- CLTEACH, clears the 'EXAMPLES' directory created by TEACH
- CYLIN, sets polar/cylindrical coordinate mode
- FREE1, like 1 FREE (see section above)
- MERGE1, like 1 MERGE (see section above)
- PINIT, port initialize, esp. important for 4-Meg RAM card users
- RECT, sets rectangular coordinate mode
- SPHERE, sets polar/spherical coordinate mode
- TEACH, loads the Owner's Manual examples into a dir in HOME
- VERSION, returns the operating system ROM version string and a
copyright notice, like this:
2: "Version HP48-R" <-- means version "R" 1: "Copyright HP 1993"

- XRECV, X-Modem protocol receive (binary mode only)
- XSEND, X-Modem protocol send (binary mode only)

**MATH COMMANDS:**- LININ, tests whether an equation is linear in a given variable
- NDIST, normal probability density
- PCOV, population covariance of SigmaDAT
- PSDEV, population standard deviation of SigmaDAT
- PVAR, population variance of SigmaDAT
- RKF, solves initial value problem using Runge-Kutta-Fehlberg
- RKFERR, change in solution and absolute error using RKF
- RKFSTEP, next solution step with given error tolerance using RKF
- RRK, solves initial value problem using Rosenbrock & RKF
- RRKSTEP, next solution step with given error tolerance using RRK
- RSBERR, change in solution and absolute error using Rosenbrock

**MENU NUMBERS and KEY CODES**Many menu numbers have changed, so software that uses # MENU or # TMENU may not work the same as in the HP48 S/SX. (Specifically, only menu numbers 0-3, 28, 30, and 42-59 are the same). Likewise, almost all of the shifted keycodes correspond to new commands and menus, which programmers must take into account; for example, the "RAD" key on the S/SX had the keycode 82.2, but it's 21.2 on the G/GX. The left-shift key, which was orange on the S/SX, is now purple [officially "lavender"], and the right-shift key which was blue on the S/SX is now green [officially "teal"] on the G/GX. Also, the digit-key menus can be activated by both shift keys; left-shift gives the softkey menus like in the S/SX, but the right-shift gives the new user-friendly full-screen menus. The unshifted keys remain identical to the S/SX, except for a cosmetic colour change to match the very dark green of the calculator case.

**MANUALS**The G/GX comes with two manuals, a "Quick Start Guide" for beginners, and a cost-cutting, slimmer owner's manual called the "User's Guide" which has only 21 pages about programming, since HP figures that the huge majority of all 48 owners never program it anyway. The power users can buy the optional "Advanced Users Reference Manual" (similar to the S/SX's "Programmer's Reference Manual") which covers programming and the many commands that are not mentioned in the User's Guide. There is no "Quick Reference Guide" like the S/SX came with, although the case still has a pocket for one.

Jim Donnelly has marketed a nice pocket guide, but it's too wide to fit in the case's pocket. The User's Guide is not spiral bound, but is made to open fully and last a long time, since it's not just glued but has sewn signatures like real books, and is printed on quality paper.

Another possibility is "The HP 48G/GX Pocket Guide" by Chris Coffin and Thomas Dick (Grapevine Publications). It's 80 pages long, contains a complete command reference (with input/output stack diagrams), alpha keyboard description, system flag description, as well as examples of how to use various calculator features. This guide is designed to fit nicely in the pocket of the HP case.

**FLAGS**Some previously "unused" flags are now used. They are:

The default setting of all these flags is Clear (as in the S/SX).-14 Clear = end-of-period payment mode (for TVM calculations) Set = beginning-of-period payment mode -27 Clear = display symbolic complex numbers in coordinate form e.g. '(X,Y)' Set = display symbolic complex numbers using 'i' e.g. 'X+Y*i' -28 Clear = plot multiple equations like the S/SX does (serially) Set = plot multiple equations simultaneously -29 Clear = include axes in plots (like the S/SX does) Set = omit axes from 2D and statistics plots -30 is no longer used (it never did anything useful anyhow) -54 Clear = tiny matrix elements get rounded to zero Set = leaves matrix elements alone

**FLAG BROWSER**There is a System Flag browser which shows the flag number, shows whether it's set or clear, lets you toggle it, and shows in English what the current setting means.

**CHARACTER BROWSER**While programming, if you want to type any character at all, press CHARS and a screenful of ASCII characters is displayed that you can browse with the arrow keys, and not only does the screen also show the ASCII code (NUM value) and even the shortcut keyboard key sequence (if any) for each character, but if you press ECHO, it will be "typed" into your program. There's no need any more for the alpha keyboard table.

**DIRECTORY MAINTENANCE**Press right-shift VAR to launch a Variable Browser which is a complete memory manager. You can tag multiple objects and copy, move, or delete them all with a single keystroke; there's even a Mark All and an Unmark All, like a real computer. It's slow, however, and has been obsoleted by the very fast PCT library.

**FRACTIONAL UNIT POWERS**The S/SX only handled integer powers of units correctly, but the G/GX can use any real number as a unit power.

**NAME PLATE**The case has a rectangular indentation in the back like the HP 95LX and 100LX, and it comes with an adhesive metal nameplate that you can get engraved with your name.

**XLIB NAMES**All of the new commands in the GX are XLIB names, and therefore take 5.5 bytes in programs. The commands common to the SX and GX take 2.5 bytes each, as they did in the SX.

**INPUT FORMS and CHOOSE BOXES**Many operations have two menu types: the old SX style, and a new "drop-down" menu and "input forms" that have the feel of computer dialog boxes. Especially useful for the HP48 beginner.

**ENHANCED PRECISION**The internal precision of at least some of the matrix routines has been improved; INV gets better answers on square matrices than the SX did. HP has not released information about which routines were improved, how, and by how much.

**IMPROVED DISPLAY**The LCD introduced with revision M of the G/GX is easier to read since it has higher contrast between on/off pixels. It has a slower cycle response time, however, making it difficult to use for rapid-motion video games or any other rapid animation.

From: Jarno Peschier

Some examples of INFORM, CHOOSE and MSGBOX on the HP48 GX. Just download the entire directory to your calculator and try the programs, change them, modify them and do everything else with them you can think of.

**SIMPLE:**This program will demonstrate a simple INFORM input screen with 3 fields (one without type restrictions, one for real or complex numbers and one for strings) with some additional layout. MSGBOX and CHOOSE (with the third parameter equal 0) are used to show what the results of the INFORM command are. The list the INFORM command returns is left on stack so you can see what it looks like.

**ANGLE:**This program will demonstrate the use of CHOOSE. It lets you choose between the three possible angle modes (DEG, RAD, GRAD) and when you choose one of them, the corresponding mode is set by evaluating a tiny program containing the right command.

**ISOLATE:**This program will demonstrate the use of INFORM in ways that it is used in the calculator itself. It is a very simple shell around the ISOL command (isolation of a variable from an algebraic). It remembers it's settings in a variable called IPAR and the next time the program is run this will be the default values of the INFORM command, so you can isolate for a different variable using the same algebraic you used before, without retyping it. MSGBOX is used for error messages.

**TYPELIST:**This program will again demonstrate the use of CHOOSE. It extracts the names of all the internal types of the HP48 GX from ROM and shows them in a CHOOSE-box (alphabetically sorted by name). If you choose one of them, its TYPE number is shown in a MSGBOX.

**MATHQUIZ:**This final program will demonstrate the use of INFORM with variable field descriptions and default/reset values. It's will show you 8 fields that are simple math questions for you to solve (addition and subtraction). You can enter all the results and then you will see if your answers were correct (in a MSGBOX). You must fill all the fields. Hint: you can cheat by resetting a field (or all fields).

%%HP: T(3)A(D)F(.); DIR SIMPLE \<< IF "AN EXAMPLE OF INFORM" { { } { } { } { "OBJECT:" "ALL OBJECTS ARE ALLOWED HERE" } { } { "NUM:" "ENTER A (COMPLEX) NUMBER" 0 1 } { "NAME:" "ENTER YOUR FULL NAME" 2 } { } { } } { 3 1 } { \<< 440 1 BEEP \>> (0,1) "JARNO PESCHIER" } { NOVAL 0 "N.N." } INFORM THEN DUP "YOU ENTERED:" SWAP 0 CHOOSE DROP "The list that INFORM produced is still on the stack." ELSE "You cancelled the INFORM." END MSGBOX \>> ANGLE \<< IF "ANGLE MEASURE" { { "Degrees" DEG } { "Radians" RAD } { "Grads" GRAD } } 1 CHOOSE THEN EVAL END \>> ISOLATE \<< IF "A VERY SIMPLE VARIABLE ISOLATOR" { { } { "EXPR:" "ENTER THE EXPRESSION" 9 } { "VARIABLE:" "ENTER VARIABLE TO ISOLATE" 6 } } { } { } IF 'IPAR' VTYPE 5 \=/ THEN { } ELSE 'IPAR' RCL END INFORM THEN DUP 'IPAR' STO IF DUP NOVAL POS THEN DROP "You must enter an expression and a variable!" MSGBOX ELSE OBJ\-> DROP IFERR ISOL THEN DROP2 "Error: " ERRM + MSGBOX END END END \>> TYPELIST \<< IF "ALL HP48 TYPES (IN ROM)" 0 27 FOR msg IFERR msg 263 + DOERR THEN ERRM END msg 2 \->LIST NEXT 28 \->LIST SORT 1 CHOOSE THEN "That one has type number " SWAP + "." + MSGBOX END \>> MATHQUIZ \<< IF "A SIMPLE MATH QUIZ" 1 8 FOR i "'" RAND 100 * IP + IF RAND 0.75 < THEN "+" ELSE "-" END + RAND 100 * IP + "'" + "ENTER RESULT #" i + 0 3 \->LIST NEXT 8 \->LIST DUP \<< \-> X \<< X HEAD 2 OVER SIZE 1 - SUB "=" + X 1 ROT PUT \>> \>> DOLIST SWAP \<< \-> X \<< X HEAD OBJ\-> EVAL \>> \>> DOLIST 3 ROLLD { 2 5 } 4 PICK { } INFORM THEN IF DUP NOVAL POS THEN DROP2 "You didn't fill all the blanks." ELSE IF SAME THEN "All answers were correct!" ELSE "Not all answers were correct." END END MSGBOX ELSE DROP END \>> END

From: Joe Horn

Note well: backup memory before using any of the following! LIBEVAL can clear memory if used incorrectly. Warning to the clueless: LIBEVAL, NOT SYSEVAL!!! If you don't know what a "bint" is, don't use the ones that mention bints.

Example usage: "OUT OF RANGE Try Again" #B0091h LIBEVAL. Try it!

```
```-----------------------------------------------------+----------
Function | LIBEVAL
-----------------------------------------------------+----------
Displays message box with grob | #B1000h
CMD last command window | #B2000h
CHARS application | #B2001h
MODES application input form | #B41C1h
flag browser (returns t/f to level 1, just drop it) | #B41CFh
MEMORY application (aka variable browser) | #B41D7h
SOLVE application choose box | #B4000h
solve equation input form | #B4001h
solve difeq input form | #B4017h
solve polynomial input form | #B402Ch
solve linear systems of equations input form | #B4033h
solve TVM input form | #B4038h
PLOT input form | #B4045h
SYMBOLIC application choose box | #B4113h
integrate input form | #B4114h
differentiate input form | #B4122h
Taylor polynomial expansion input form | #B412Bh
Isolate a variable input form | #B412Dh
solve quadratic input form | #B4130h
manipulate expression input form | #B4131h
TIME application choose box | #B4137h
Set alarm input form | #B4138h
Set time and date input form | #B415Bh
Alarm browser (aka alarm catalog) | #B416Eh
STAT application choose box | #B4175h
single-var stat input form | #B4176h
frequencies input form | #B417Dh
fit data input form | #B417Fh
summary stat input form | #B418Fh
I/O application choose box | #B4192h
Send to HP48 input form | #B4193h
Print input form | #B4197h
Transfer input form | #B41A8h
Get from HP48 (immediate) | #B50FFh
recalls the contents of the reserve variable Mpar | #E4012h
-----------------------------------------------------+----------

```
```LIBEVAL : stack diagram / what it does
------- -----------------------------------------------------------
#B0091h : $ --> makes a message box with an alert symbol in it
#E0044h : $ --> displays a title line, top center (follow with
1 FREEZE if you want it to stay there after program ends)
#B2000h : launches the Last Command choose-box
#B2001h : launches the CHARS application; returns nothing if user does
not press ECHO
#B2002h : launches the CHARS application; returns "" if user does not
press ECHO
#B41CFh : launches Flag Browser; leaves a True or False on stack, so
follow this LIBEVAL with a DROP.
#B50A3h : --> current time as hour, min, sec separately, plus an XLIB
that represents AM/PM/24-hr (just DROP it)
#B50A4h : hh.mmss --> hh mm ss xlib (the xlib represents AM,PM, or
24-hr mode; just DROP it)
#B50A6h : --> current date as month, day, year (always that order, and
a two-digit year)
#B50A7h : mm.ddyyyy (or dd.mmyyyy) --> month, day, yr
#B50A9h : #month #yr --> #days_in_that_month (inputs and output are
bints; year is two digits, interpreted as between 1991 &
2090 only)
#B50AAh : #yr --> %0.00yyyy (input is two-digit bint interpreted as
between 1991 and 2090; output is a real number)
#B50ABh : #mon #day #yr --> #day_of_week (inputs & output are bints;
year is two digits interpreted as between 1991 & 2090;
Sunday is #7; if you're in DMY mode, then the input order is
#day #mon #yr)
#B50B2h : --> { 1 2 3 ... 59 } (not very fast)
#B50B3h : --> { 1 2 3 ... 10 } (very fast)
#B50B4h : --> { 0 1 2 ... 23 } (very fast)
#B50B9h : --> { " 1 January" " 2 February" ... "12 December" }
#B50D5h : --> number of alarms currently set (as a bint)
#E3063h : hxs --> grob (this is an RLL packed-grob uncompressor, used
by EQ LIB and MINEHUNT; for example, try this:
#E202Bh LIBEVAL 3 GET #E3063h LIBEVAL PICT STO PICTURE)
#E202Bh : the first of the packed EQ LIB grobs (see above)
#E2069h : the last of the packed EQ LIB grobs (see above)
#E7039h : MINEHUNT packed grob (left screen border)
#E703Ah : MINEHUNT packed grob (right screen border)
#E801Eh : obj --> obj T/F (tests whether object is in temporary memory
or not; returns System-RPL True or False)

Previous | Contents | Next |