HP48 FAQ Section 10: Appendix B: GX Specific Information

Previous Contents Next

10.1 What's new in the HP48 G/GX?

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:

{ 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.
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 } { 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.
The only commands which do not have automatic list processing are:

Sometimes the results are non-obvious, for example:

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
List processing is only recursive for ->Q and ->Qpi.
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:

HP SOLVE EQUATION LIBRARY CARD COMMANDS:

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:

GRAPHICS and PLOTTING COMMANDS:

USER-INTERFACE COMMANDS:

LIST PROCESSING COMMANDS:

SYSTEM COMMANDS:

MATH COMMANDS:

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:

-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
The default setting of all these flags is Clear (as in the S/SX).
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.

10.2 Examples of INFORM, CHOOSE, and MSGBOX

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

10.3 Some useful LIBEVALs

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

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