The Columbia Crown The Kermit Project | Columbia University
612 West 115th Street, New York NY 10025 USA • kermit@columbia.edu
…since 1981

HP-48 Kermit Hints and Tips

The HP-48 calculator includes its own built-in Kermit protocol implementation allowing for transfer of programs and data between the calculator and a computer, such as a PC or a UNIX workstation. Instructions for using HP-48 Kermit are included in the HP-48 Owner's Manual.

Various products for transferring data between PCs and the HP-48 have appeared that include our MS-DOS Kermit software without our permission. People often complain to us that these products stopped working when they upgraded their PCs to Windows 9x, ME, NT, 2000, or XP. That is because MS-DOS Kermit is a DOS program, not a Windows program. The Kermit software for Windows 95/98/ME/NT/2000/XP is Kermit 95. See:

  http://www.columbia.edu/kermit/msk95.html
  http://www.columbia.edu/kermit/k95.html

The following hints come from discussions on the comp.sys.hp48 newsgroup, and seem to reflect a consensus among HP-48 users (but with no guarantees). Special thanks to Andy Fox, John H. Meyers, Skip Collins, Diego Berge, Eric Rechlin, Joe Horn, Dan Kirkland, and David Porter.

CONTENTS

COMMUNICATIONS SETTINGS
PROTOCOL SETTINGS
PROGRAMS VERSUS DATA
WINDOWS TAPI
HP-48 KERMIT PROTOCOL NOTES
SUMMARY
FURTHER INFORMATION

COMMUNICATIONS SETTINGS

The maximum speed of the HP-48's built-in Kermit program is 9600 bps, and this is also its default speed. By default, it also uses 8 data bits, no parity, 1 stop bit, and no flow control. In case the defaults have been changed, they can be restored by deleting the IOPAR variable in the HP-48 HOME directory.

The IOPAR variable contains six fields (perhaps fewer in earlier models):

  1. Data rate
  2. Parity (0 = none)
  3. Receive data pacing (1 = Xon/Xoff, 0 = no flow control)
  4. Send data pacing (ditto)
  5. Checksum type (1, 2, or 3)
  6. Translation option (0, 1, 2, or 3; might be new to G series).

The instructions below apply to MS-DOS Kermit, C-Kermit, and Kermit 95 when used with a COM port (as opposed to a Windows TAPI device). For Windows TAPI instructions, see the TAPI section.

Modem
The connection from the computer to the HP-48 is usually a direct serial connection, so no modem is involved. Kermit programs which expect to use modems (Kermit 95, C-Kermit) should be told that the connection is direct:
  SET MODEM TYPE DIRECT ; (C-Kermit or Kermit 95 only)

Port
Choose the Kermit client's communication port:
  SET PORT COM1         ; (Or other communication port)

Speed
Both the HP-48 and the Kermit client should be set to a serial-port speed of 9600 bps. Client example:
  SET SPEED 9600  

Modem Signals
The HP-48 does not supply or use any modem signals. Therefore the Kermit client must be instructed not to require the Carrier Detect (CD) signal:
  SET CARRIER-WATCH OFF

Flow Control
The HP does not use any form of flow control unless you go to extraordinary efforts to enable it, and even then there is speculation that it is not used (and not needed) during Kermit protocol anyway, so tell the Kermit client to:
  SET FLOW NONE

Parity
The HP-48 allows transmission and reception of 8-bit data, so:
  SET PARITY NONE

PROTOCOL SETTINGS

Most users recommend that the HP-48 Kermit program be run in server mode. In the following discussion, we assume the HP-48 is the server, and the other Kermit program (on the computer to which the HP-48 is connected by its serial cable) is the client. (We do not recommend configuring the HP-48 as the client; some of its client commands, such as REMOTE DIRECTORY, might not work as expected.)
Packet Length and Window Size
The HP-48 does not support long packets or sliding windows. But this is negotiated automatically, so the client setting does not matter.

Block Check (Checksum)
The HP-48 supports Kermit block check types 1, 2, and 3. Type 1 is a 6-bit checksum; Type 2 is a 12-bit checksum; Type 3 is a 16-bit CRC. Most models (e.g. HP-48GX, HP-48SX Revision D) use Type 3 by default, but earlier models might use Type 1, in which case if you want to use 2 or 3, you must make this change in HP-48 Kermit's setup menu. If necessary, also tell the Kermit client to:
  SET BLOCK 3 ; (or 2)
Otherwise, the two Kermits automatically fall back to Type 1.

Control Character Unprefixing
The HP-48 does not allow incoming control characters to be unprefixed. Most Kermit clients prefix all control characters by default; Kermit 95 is an exception. Tell the Kermit client to:

  SET CONTROL PREFIX ALL

The remaining settings depend on the type of file that is being transferred and the direction of transfer.

PROGRAMS VERSUS DATA

The HP-48 Kermit implementation embeds two extra services not normally considered part of Kermit; if the HP-48 is told to send in "ASCII mode," it both "decompiles" (translates an internal binary object into ASCII words) and translates some or all of the ASCII characters having decimal value 128-255 into "backslash-prefixed" codes (some digraphs, some numeric codes); carriage returns may also be inserted before linefeeds as this occurs.

Conversely, if the HP-48 is told to receive in "ASCII mode," it performs character translation (backslash-prefixed codes into single characters) and then also "compiles" on the fly (translating text words into binary internal objects), in which case any syntax error terminates the transfer immediately (thus compiling is performed per packet, rather than after receipt of the entire file). Therefore, it is not possible to send an arbitrary file to the HP-48 in text mode.

The HP-48 allows you to select the "character translation mode": 0, 1, 2, or 3, which determines how the HP-48 should apply backslash notation during ASCII (text-mode) sends. The translation modes are:

Numbers are decimal values. The bold numbers are the ones used in IOPAR, and the text in parentheses after it are what the 48G series calls it in the I/O window. The default character translation mode is 1, for newline translation only. When receiving, the format in which the file was sent originally (stored in the header of the ASCII file) is used automatically. Binary transfers are not affected.

Options 1, 2 and 3 cause each ASCII 10 (Linefeed) to be converted to a 10 and a 13 (Carriage Return and Linefeed). Options 2 and 3 convert one backslash character to two backslash characters. Option 2 translates characters 128 through 159, while option 3 translates characters 128 through 255. The actual translation characters are in the Owner's Manual.

When sending in "binary mode," no translation occurs, and no slowdown occurs. When receiving in "binary" mode, the entire file is received as a string; however, the appending of each new packet to the string, copying the entire received string each time, causes a slowdown (every now and then it may suddenly revert to the original speed, perhaps after storing a large chunk of the received string, or else after an internal "garbage collection").

Only after the entire "binary" file is received does the HP-48 take one more step, unrelated to Kermit, in which it checks to see whether the received file begins with a specific prefix "HPHP48-x" and if so, whether all the rest of the received bytes constitutes a valid internal HP-48 binary object; if so, the HP-48 delivers the extracted binary object as its result, and otherwise it leaves the received string as the result (thus allowing any computer file to be received literally as a string, even if it does not represent anything meaningful to the HP-48).

Because the HP-48 slows down when receiving data, it might be necessary to tell the client to increase its timeout, and/or to pause before sending each packet, for example:

  SET SEND TIMEOUT 20  ; Number of seconds
  SET SEND PAUSE 100   ; Number of milliseconds

WINDOWS TAPI

To connect Kermit 95 with Windows Telephony (TAPI) to the HP-48, install a modem with the type "Dial-Up Networking Serial Cable between 2 PCs" into the Modems Control Panel. Then set the Properties:

In the K95 Dialer, create a Modem Object for the "Dial-Up Networking Serial Cable between 2 PCs" modem and then select that modem in the connection entry you define for use with the HP-48.

Or from the K95 command prompt:

  SET TAPI LINE Dial-Up_Networking_Serial_Cable_between_2_PCs

HP-48 KERMIT PROTOCOL NOTES

Reportedly the following command, rather than REMOTE CD, must be given to the Kermit client to change the HP-48 Kermit server's working directory:
  REMOTE HOST { relative_directory_name } EVAL

(The remainder of this section is from Joe Horn, http://holyjoe.net/hp/HP48.htm).

The Owner's Manual is sparse regarding the HP 48's response to Kermit packets when in Server Mode. It's even sparser regarding Server Mode's response from MS-DOS Kermit. So here's the whole scoop. This will let you use the HP 48's PKT command to control another HP 48 or a PC. Note: Set a TIO mode > 0 for proper CR/LF translation.

HP48 Kermit SERVER Mode responses:

"name" "R" PKT
tells server to send file, but it arrives in "PC" format as a string. Not very useful. Use KGET to tell the server to send things correctly.

"command(s)" "C" PKT
server performs OBJ-> on "command(s)" and after it's all done it ships the current stack (as a single string) back, or the string "Empty Stack". This is the principal way of controlling another HP 48. Do not include commands that would interrupt Kermit, such as OFF or any programs that perform I/O.

"L" "G" PKT -or- "F" "G" PKT
Tells server to exit Server Mode. Not very useful; use the FINISH command instead.

"D" "G" PKT
tells server to send a "directory" which is a single string containing information about the current VARS list, to wit: name; byte size (including name); object type (in English); and checksum (as a decimal real).

The "I", "S", and "E" packet types generate useless responses.

No other packet types or "G"-type commands are recognized.

MS-DOS Kermit Server responses (when MS-DOS Kermit is in server mode and the HP-48 is the client):

"init-string" "I" PKT
Initializes Kermit's parameters. Each byte of the init-string stands for and sets the following:
  1. max packet length (0-94) + 32
  2. timeout in seconds (0-94) + 32
  3. number of pad chars (0-94) + 32
  4. pad char ascii code + 32
  5. packet terminator ascii code + 32
  6. control prefix char, literal
  7. eighth-bit prefix char, literal
  8. block checksum type (0-3) char, literal
  9. repeat count prefix, literal
Subsequent bytes control Kermit functions that the HP 48 can't use (like sliding windows and long packets), so they may be omitted.

"name" "R" PKT
same as HP 48 response. Not useful.

"command" "C" PKT
same as typing command at the DOS prompt. Output, if any, gets sent back to the HP 48 as a single string. This is the principle way of controlling a PC from an HP 48.

"I" "G" PKT
PC sends " Kermit-MS Server ready"

"C" "G" PKT
PC sends current directory; use "CD " "C" PKT instead.

"F" "G" PKT -or- "L" "G" PKT
PC sends " Goodbye!" and exits Kermit.

"D" "G" PKT
PC sends a file directory. Use "DIR options" "C" PKT instead.

"U" "G" PKT
PC sends free bytes on current drive or a report that the current drive is not ready.

"W" "G" PKT
PC sends " Just this Server"

"M" "G" PKT
PC clears the "Last message" line

"M:text" "G" PKT
PC displays "text" on "Last message" line

"H" "G" PKT
PC sends list of MS-DOS Kermit server commands

The "S" and "E" packet types generate useless responses.

The "GE" and "GT" commands work, but require length encoding for the filename. It is easier to use "DEL options" "C" PKT and "TYPE options" "C" PKT instead, respectively.

No other packet types or "G"-type commands are recognized.

Note: MS-DOS Kermit sends "C" commands to the DOS command-line interpreter. If you have something other than DOS's COMMAND.COM running as your primary shell (such as 4DOS, which I use), then you can use whatever commands it can handle.

SUMMARY

Put the HP-48 in Kermit server mode. Set up the Kermit client like this:
  SET MODEM TYPE DIRECT   ; (C-Kermit or Kermit 95)
  SET PORT COM1           ; (Or other communication port)
  SET SPEED 9600          ; (Serial port speed)
  SET CARRIER-WATCH OFF   ; (Don't require carrier)
  SET FLOW NONE           ; (Don't use flow control)
  SET PARITY NONE         ; (8 data bits, no parity)
  SET BLOCK 3             ; (if desired, or 2)
  SET CONTROL PREFIX ALL  ; (Necessary in Kermit 95)

For file transfer, use binary mode unless you are exporting or importing HP-48 objects:

  SET FILE TYPE BINARY

To transfer files:

  SEND filename           ; Send file(s) to the HP-48
  GET filename            ; Get file(s) from the HP-48

To change directory on the HP-48:

  REMOTE HOST { relative_directory_name } EVAL

To shut down the HP-48 Kermit server:

  FINISH

If file transfers fail, try:

  SET SEND TIMEOUT 20     ; (Or other number of seconds)
  SET SEND PAUSE 100      ; (Or other number of milliseconds)

FURTHER INFORMATION

If you have corrections or additional information to contribute, please send them to kermit@columbia.edu.


HP-48 Kermit Info / Columbia University / kermit@columbia.edu / 4 May 1999 (updated 22 July 2011)