Dr. Reddy's Guide to HP Palmtops

Programming the Palmtop (Part I)

Children's Health Pediatric Resources Fun Sites for Kids HP Palmtops Dr. Reddy's Home Page Feedback Our Real Office

An HP 200 LX HP's Palmtop Home Page

Most Web pages about writing software for the HP DOS Palmtops deal mainly with the use of the Palmtop Applications Library. PAL is a great way to write Palmtop software, but for those of us who actually want (or need) System Manager-compliant applications, it's not quite the same. There are, however, a few available examples and resources on System Manager-compliant Palmtop programming.

Available Palmtop Programming Resources

The key resource for anyone seriously interested in System Manager programming is the HP 100LX/200LX Developer's Guide. This is available from Thaddeus Computing, publisher of the HP Palmtop Paper: you can obtain it in the original hardcopy form, with accompanying floppy disk, or on CD as part of the Palmtop Paper Infobase along with the accompanying software. The Guide is a (pretty) complete source of information on the Palmtop's hardware and software, including the various System Manager built-in functions and the interface functions developed by Lotus for the Palmtop, and you should never write Palmtop software without it. The accompanying software includes various tools developed by HP and Lotus to assemble, compile, and test EXM (System Manager-compliant) programs on a PC, and to convert EXE files to EXM files for execution on the Palmtop itself, as well as one complete sample application (HEXCALC, the hexadecimal calculator that is included on D: drive in the English version of the 200LX). More about these below.

Other resources available on the Web include:

NKIT
a collection of EXM programs in C source code written by Japanese programmers, with a header file similar to the header files supplied by HP but made to be more complete than the HP files (the single file LXAPI.H serves the same function as four or five HP header files) and to allow compilation under the Turbo C or LSI-C86 compilers. Versions of the EXE-to-EXM converter suitable for use with Turbo C or LSI-C86 are also provided, as are compatible versions of the System Manager and interface libraries. The Turbo C library provides support for floating-point arithmetic, which is not provided in the HP toolkit.
BASICEXM
an example EXM program from the HP Palmtop Paper, which was written to be compiled using NKIT.
HandHeld Systems
This is not, strictly speaking, on the Web. Handheld Systems (earlier known as PIE Developers and then as PDA Developers) was a journal for software developers working with various PDAs and handheld computers. It began as a journal for Apple Newton developers (!), but expanded its coverage within a year to include all available handheld computers. The bad news: it ceased publication in early 1999. The good news: Creative Digital Publishing, who published Handheld Systems, made the entire 6 years' (32 issues) of the journal available on CD-ROM for $14.95 (plus $5.00 shipping). The CD-ROM includes all example source code originally supplied with the journal. The articles are comprehensive and well-written, and, at least for the Palmtop, delve into several issues not (well) covered in the Developer's Guide or Development Kit, including the problem of fixing up memory pointers during a program run (made necessary by the architecture of System Manager). The worse news: Creative Digital Publishing says the CD-ROM archive is no longer available from them. (I suppose you could try eBay, or find someone who has the CD-ROM and persuade them to make a copy for you after getting permission from CDP for copying.)
Other People's Software
Many programmers have written System-Manager compliant software for the Palmtop. Several of them (most notably a number of Japanese programmers) have posted their source code on the Web. It's a bit hard to track these down, but some time spent with the HP-LX mailing list and SUPER will be rewarding. (Many of the Japanese sources are posted on Japanese-language Web pages. Fortunately, the source code itself is written in English C.)

Compiling Palmtop Programs

Since the Palmtop is essentially a pocket-size IBM PC/XT, any DOS application program will run on a Palmtop. This includes any compiler that will fit in 640K or less of main memory. It is possible to develop Palmtop apps on a Palmtop... but it's probably a bit inconvenient.

In the Developer's Guide, HP suggests using Microsoft C, version 6.0, for Palmtop C development (and MASM 6.0 for assembler program development). Finding a copy of Microsoft C 6.0 may be a little difficult, though.

However, some versions of Microsoft C beyond 6.0 will work, and there are easy and cheap ways to acquire them. Example: a while back Microsoft published a book titled Learn Visual C++ Now. It can still be found as a remainder in some bookstores. The included CD-ROM contains a copy of Visual C++ 1.0, which in turn contains a (full, working) copy of C 8.0. I have also seen Visual C++ 1.0 included in other publications, including (I'm really dating myself here) a Game Programming Starter Kit published by Sams a few years ago. You can write Palmtop apps in C++ (although I've never tried). The important thing, though, is that you can use the C 8.0 compiler to "make" Palmtop programs. In fact, that is precisely how I do it; I point the HP skeleton app makefile to the C 8.0 compiler, and let nmake do the rest. Note that later versions of Microsoft C will not compile code for anything less advanced than a Pentium and thus won't work for Palmtop programming. An example of an unsuitable compiler is version 11.0, which underlies Visual C++ 5.0.

For those of you who prefer the Turbo C environment for writing and debugging C programs (I usually do myself -- I use the Microsoft route mainly because alternatives weren't available when I started writing Palmtop apps), NKIT (mentioned above) allows you to compile, link, and make EXM versions of C programs. The details, and the modified header, library, and startup files are in the kit with the sample programs. (NKIT also has provision for using LSI C-86, a C compiler available in a freeware trial version in Japan.) I have also heard reports of people using MIX Software's Power C compiler for Palmtop development: I have used, and like, the compiler, but I have not had any experience with it in Palmtop development.

Running (and Debugging) Palmtop Programs on a PC

Any standard DOS application can be run on a Palmtop without modification. It must run in 640K or less of RAM, of course (less if that's where your Palmtop's working RAM is set), but most DOS apps -- including many of the compilers mentioned above -- were written to do just that.

The converse isn't quite true. Since System-Manager compliant programs need to access System Manager services (including System Manager versions of normal DOS calls), you have to arrange for the service routines to be present. Also, the Palmtop display is a non-standard CGA display, and requires special access routines which are also lacking in normal DOS.

HP provides, both in the Developer's Kit and in the Connectivity Pack, two tools to overcome these deficiencies in your desktop PC. The first is TKERNEL.EXE, which is a TSR program that serves INT 7E and 7F as the System Manager does in the Palmtop. The second is CG.COM (a second version, CGAGRAPH.COM, is included in the Developer's Kit), which provides the graphic interface.

There are two ways to invoke these tools and run a Palmtop app in DOS. One is to use the Connectivity Pack Application Manager, which also uses TKERNEL and CG: just add your program to the App Manager application menu, and run it from there. The other is to use the tools directly:

TKERNEL
CG
(or CGAGRAPH)
<your program> (or CV <your program> if you're using CodeView)
CG (to unload the graphic drivers)

The Connectivity Pack also includes a program called UN200 which unloads TKERNEL. If you look at APP200.BAT (the batch file that invokes the App Manager) you will see how the tools interact. You may want to rewrite this batch file to allow you to run a Palmtop program directly from C:>.

Running Your New Palmtop App on the Palmtop

Unfortunately, you can't just move an EXE file to the Palmtop and run it under System Manager. On the Palmtop, under System Manager, System Manager itself does the program loading, and it looks for indicators that the program is indeed System-Manager compliant. The executables have the extension EXM, and are rather different from normal EXE executables. In particular:

HP provides a tool called E2M.EXE which converts an EXE file to EXM format, using information in the compiler-generated MAP file. (The need for the MAP file, which contains information on where the code segment ends and the data segment begins, is one reason that early attempts at Turbo C app development were difficult: the MAP file available from Turbo C is not in the same format as the Microsoft MAP file, and E2M couldn't read the segment information. NKIT contains versions of E2M that work with the Turbo and LSI compilers and their MAP files.) Once the EXM file is created, it can be transferred to a Palmtop and run like any other Palmtop app (you can't directly run an EXM on a desktop PC, even with TKERNEL and CG, although I have heard rumours of recent, successful experiments with doing so).

In Part II I'll talk about how a System-Manager compliant application is structured.



Visit the HP Palmtop Ring Homepage

This HP Palmtop Ring Site is owned by Vinay N. Reddy, M.D. Visit The Webring.

[ Next | Skip Next | Next 5 | Previous | Previous 2 ]


Search the Office for:

Results

See the Detailed Search page for complete instructions on searching the Office.

Back to Dr. Reddy's Guide to HP Palmtops
Back to Dr. Reddy's Pediatric Office on the Web
We welcome your comments and questions.

Copyright © 2002, 2003, 2004 Vinay N. Reddy, M.D. All rights reserved.
Written 01/12/02; last revised 01/15/04 counter