HP48 GX

File Transfer Guide

HP48 GX Emulator and File Transfer Guide

This document outlines the process for transferring files between a PC and an HP48 GX calculator emulator, using c-kermit for communication. The emulator in question is x48, and file transfers are facilitated through c-kermit.

Configuration for the emulator can be set in ~/.Xdefaults as follows:


*iconic:        False
*visual:        Default
*mono:          False
*gray:          False
*monoIcon:      False

*useXShm:       False

*smallLabelFont:    -*-fixed-bold-r-normal-*-14-*-*-*-*-*-iso8859-1
*mediumLabelFont:   -*-fixed-bold-r-normal-*-15-*-*-*-*-*-iso8859-1
*largeLabelFont:    -*-fixed-medium-r-normal-*-20-*-*-*-*-*-iso8859-1
*connectionFont:    -*-fixed-medium-r-normal-*-12-*-*-*-*-*-iso8859-1

!
! informative stuff
!
*verbose:       False
*quiet:         False

*printVersion:      False
*printCopyright:    False
*printWarranty:     False

!
! resources controlling the connections
!
!*useTerminal:      True
!*useSerial:        True
!*serialLine:       /dev/ttys006
*useTerminal:       False
*useSerial:     False

!
! stuff controlling initialization
!
*completeInitialize:    False
*resetOnStartup:    False
*romFileName:       rom
*homeDirectory:     .hp48

!
! resources controlling the debugger
!
*useDebugger:       True
*disassemblerMnemonics: class

Structure of HP48 ASCII headers

This section is an FAQ from here.

ASCII file headers such as %HPHP: T(3)A(D)F(.); are created by the HP48 when an ASCII file is sent to the PC and read when a HP48 ASCII file is received from the PC. They serve to preserve various settings on the HP that affect ASCII transfers. They do not affect binary mode transfers.

Three parameters are saved: (T)ranslation Mechanism, (A)ngle Mode, and (F)raction Mark.

Translation Mechanism:

The possible ASCII translation schemes are as follows:


T   HP48 -> PC                  PC -> HP48
---------------------------------------------------------
0   No translation              No translation

1   char 10 -> chars 10,13      chars 10,13 -> char 10

2   Action 1 & translate        Action 1 & translate
    chars 128 - 159             \000 - \159 to HP48 chars

3   Action 1 & translate        Action 1 and translate
    chars 128 - 255             \000 - \255 to HP48 chars

To choose the favorite set, it is needed to type the number followed by the command TRANSIO on the HP48 command line (it is the parameter translate in the IOPAR screen).

Depending on which translation scheme is being used, the HP48 converts a different set of characters to PC ASCII format.

Option 3 is recommended, since this forces the calculator to translate all symbols to pure ASCII (as in the table in page 27 - 16 of the HP48G series user’s guide). Choosing option 0 or 1, all characters from code 128 to 255 would be interpreted following the current code page of the PC setup - it will be then unreadable.

Also, receiving ASCII files on the pc with black squares, it is fairly certain translation mode is set to 0, which makes the HP receive and store all newline characters (instead of eliminating them).

Angle Mode:

  • A(D) stands for degrees.
  • A(R) stands for radians.
  • (G) stands for gradians.

Fraction Mark:

The HP48 can handle two types of fractions marks - the decimal dot or comma.

This option is available from the MODES input form (48G/GX) or menu 64.01.

With regards to the ASCII header:

  • F(.) means the format is dot.
  • F(,) means the format is comma.

Trying manually editing an ASCII file on the PC without a header, then try to send it to the HP48 using Kermit, the following results may be obtained:


Number format     Text sent       Result (object stored)
     .               3.4             3.4
     .               3,4             3 4
     ,               3.4             3 4
     ,               3,4             3,4

As would be expected, sending files with ASCII headers to the HP48 with mismatching fraction mark settings, leads to an "Invalid Syntax" error during transfer.

Looking at rows 2 and 3 of the table above - the object received by the HP48 is stored as a program object without the `<< and >> composed by two real numbers that normally can’t be done in User RPL.

In fact the resulting object is a very simple System RPL program object (the internal language of the HP48). The conclusion is that when a file is sent without an ASCII header, the HP48 translates numbers with mismatching formats into System RPL secondaries (programs) of the form:


:: %IntegerPart %FractionalPart ;

Transfer from HP48 GX to PC

To transfer a file from the HP48 GX emulator to a PC, follow these steps:

  1. Launch the HP48 GX emulator with the terminal flag if it’s not set in the config:

hp48gx --terminal
  1. Note the communication port listed under wire on the HP48 GX emulator, for example, /dev/ttys004.

  2. Prepare the HP48 GX for transfer:

    • Press [R-S] then I/O -> Transfer ...
    • Set Port to Wire, Type to Kermit, and FMT to ASC.
    • Select the variable you wish to transfer, for example, MYVAR in {HOME}.
  3. Start Kermit from the terminal and configure it for the transfer:


set line /dev/ttys004
ROBUST
server
  1. Send MYVAR from the HP48 GX.

Transfer from PC to HP48 GX

To transfer a file from the PC to the HP48 GX emulator, you might create a file containing variables or a program. For example, a file named singlevariable or constants with the following content:


%%HP: T(3)A(R)F(.);
\<<
  2.99792458E8 'C' STO
  1.0545718E-34 'HBAR' STO
  6.62607015E-34 'H' STO
  9.10938356E-31 'ME' STO
  1.602176634E-19 'EV' STO
\>>
  1. Start Kermit from the terminal and set it up for the transfer:

set line /dev/ttys004
SET SPEED 9600
SET STREAMING OFF
SET PARITY SPACE
ROBUST
  1. On the HP48 GX, prepare to receive the file:
    • Press [R-S] then I/O -> Start the server.
  2. Send the file from the PC:

send singlevariable
send constants

After sending, the file constants can be executed on the HP48 GX with EVAL.