|Everything HP200LX: Knowledge, Products, Service|
Which Programming Language is for You?
The HP Palmtops provide a portable programming platform. Here are some of the more popular programming languages that work on either the HP 95LX, the 100LX or both.
By Ed KeefeA few common questions pop into the minds of programmers when they first see an HP Palmtop: "I wonder if anyone has tried writing programs on this little Palmtop? Which language works and which doesn't? Which is the best programming language for creating programs FOR the HP palmtops?"
Almost any programming language that works on a standard PC will let you develop programs that run on the HP 95LX or the HP 100LX. However, which language is best for you depends largely upon the programming job you want to accomplish.
For example, if you want to develop true, System-Manager compliant programs for either Palmtop, you'll have to use Assembler, C, or Swift!BASIC. Hewlett-Packard used Microsoft C (versions 5.1 and 6.0) and Microsoft Assembler to create all of the applications that run on these machines.
We've prepared a Summary Chart (page 32) to help you decide which language is for you. It gives information on some of the more popular languages that have been tried on the HP palmtop computers.
If you're familiar with the various languages, the chart may be all you need. If you're new to programming, the rest of the article may give you a little more to go on. (For more on programming, see "Programming Tools for the HP 95LX" on pages 49-51 of the May/June 93 issue. Also, a number of related files are found in PRGTOOL1. ZIP (ON DISK) & PRGTOOL2.ZIP(ON DISK).)
Computer programming is a way to tell a computer how to rewire itself so that it can perform a particular task. If you're the kind of person who wants total control over the way your computer is "rewired", then Assembler may appeal to you.
Assembler has fallen out of favor in the past couple of years. People claim that C or Pascal can do everything that Assembler can do. They continue to make that claim until they discover something that C or Pascal can't do gracefully. Then, even the most die-hard opponents "bite-the-bullet" and start using Assembler in parts of their programs.
Assembler does force you to learn more than you ever wanted to know about how a computer works. In addition, programming in Assembler is a task that most people can't handle at first. The task is somewhat like trying to manage the electrical power for an entire city by running all over town turning switches on and off. It can be done, but not by a beginner.
To gain an appreciation of what can be accomplished by expert Assembler programmers, take a look at 95BUDDY (ON DISK) by Jeff Mattox or ZIP .COM (ON DISK) and VDE (ON DISK) by Eric Meyer. (VDE has been customized for the HP Palmtops and is available as the commercial product FastCOMM.) Keep in mind that the largest of these examples, the VDE editor, has taken Eric Meyer more than ten years to develop.
Those who want to try their hand at using Assembler on the HP 95LX or 100LX should take a look at Microsoft Assembler (MASM) and Borland's Turbo Assembler (TASM). Both work well on the HP 95LX. The HP Independent System Developers documentation gives examples of how to use Microsoft's MASM to write System Manager Compliant programs.
For the small Assembler programs I write, I've found that the built-in DEBUG program works quite well (see article, page 42 of the July/August 1993 issue). DEBUG takes up no disk space and creates the smallest executable programs of any Assembler. DEBUG on the 100LX even contains a single "help" screen. (Start the DEBUG program on the 100LX and press ? at the dash (-) prompt.)
The Aho, Weinberg and Kernigan language (AWK) is a high-level language created by some of the same people who created the C programming language. "High level" languages let the programmer think more about the operation he wants to accomplish and less about which switches to turn on and off. AWK is available both as shareware and as a commercial product.
The version of AWK (ON DISK) mentioned in the chart is a shareware product available on CompuServe as well as many Electronic BBSs.
Palmtop Paper subscriber George Coleman uses a commercial version (Thompson-AWK) on his 95LX. He mentioned that AWK originated as a pattern-matching utility and is most useful for viewing or manipulating parts of text files as well as performing simple computations.
If your programming task involves translating data from a mainframe computer to be used in Lotus 1-2-3 or in a database application. You owe it to yourself to take a look at AWK.
BASIC (Beginners All-purpose Symbolic Instruction Code) was designed almost 30 years ago to be used by novice programmers.
Since that time BASIC's popularity has waxed and waned. Older forms of BASIC, the kinds with line numbers and GOTO statements are out. Newer varieties, such as QuickBASIC and Visual BASIC are in.
GW-BASIC, an older form of BASIC, will work on the HP 95LX and 100LX. However, on the 95LX, if you use any of the graphics, sound, or printer commands, you run the risk of locking the computer up. This is not the case on the 100LX. GW-BASIC came with MS-DOS 3.x. It has since been replaced by Microsoft Quick BASIC, which works on the 100LX.
Swift!BASIC is a programming environment designed to work exclusively on the HP 95LX. Of all the different programming languages, Swift!BASIC is the only one that is System-Manager Compliant. And, it is the only programming language that will let you create SMC programs "out-of-the-box." The language also includes graphics, sound and print commands that work exclusively on the HP 95LX.
Mark Scardina, the author of many articles in the Palmtop Paper, used this language to develop the first version of SWITCH! for the 95LX. The only drawback to Swift!BASIC is the need to distribute a 45K byte run- time module along with your program.
The HP Independent Software Developers documentation refers only to Microsoft C (MS-C) and Microsoft Assembler. For this reason, many of the commercial programs for the HP 95LX have been written in MS-C.
Some programmers have been successful in getting a subset of MSC 5.1 to run on the HP 95LX. Even a subset of the language takes up almost all the space on a 1 Megabyte RAM card. Beyond this, MSC 5.1 is hard to find. MSC 6.0 and 7.0 take up even more room. In addition, I believe that MSC 7.0 and the newer Visual C++ require machines with 80286/386 processors.
Nowadays, many C/C++ programmers prefer Borland's C/C++. If you want to use this language to create System-Manager Compliant programs, you may find a file named E2M (ON DISK) useful.
Both MSC and BC++ come with a complete Integrated Development Environment (IDE), but putting either IDE on the 95LX is a real challenge.
If you're thinking of using Borland's C on the HP 95LX or 100LX, then you'll need to track down a copy of version 2.0. This was the last version of the language that would run on an XT computer.
I did not try BC++ on the 95LX. However, it is installed on my 100LX. I tried using the IDE but soon gave up on that. The operation of the IDE was slow, and for anything but the smallest of programs, it required an even slower process of swapping all of the memory to the disk before the compiler would work.
Another factor to consider when writing graphics-oriented programs is that the graphics screen on the 95LX is non-standard. For this reason, the Borland Graphic Interface (BGI) is useless. On the other hand, BGI drivers work quite well on the HP 100LX.
If you want to use C++ to write Object Oriented Programs, forget about making such programs System Manager Compliant. Due to the way that most C++ compilers link objects into the code, there is no way to convert the resulting files into EXM programs. The best advice here is to stay with pure C code.
Another version of the C language that has gained wide-spread use on the HP palmtops is the Personal C Compiler (PCC (ON DISK)) from DeSmet Software. This is a shareware product. The registration fee is small and gains you a respectable debugging tool. PCC is the smallest of the C compilers. It is not the fastest and it is not compatible with the current ANSI standards. This means that, if you want to convert a C program written in Borland or Microsoft C to PCC, you'll spend a lot of extra time learning the idiosyncrasies of PCC.
Finally, MIX Software sells a language product called Power C. It works well on the HP 100LX and on the HP 95LX, if you have sufficient disk space. It is in the same league as PCC. However, Power C does conform to most of the ANSI standards. The cost is about the same as the registration fee for PCC. It has one of the best User's Manuals of any of the language products mentioned here. If I'm in doubt about how to use a function in C, I'll look it up in the Power C manual first.
In general, C and C++, are the most popular programming languages in use nowadays. However, C is definitely "beginner hostile." It is a language designed by professional programmers for other programmers. C lets a person do almost anything imaginable with a computer. It will also let the beginner crash the machine with great frequency.
Forth, like C, is also referred to as an intermediate level programming language. It can be used to write anything from small utility programs to full-blown applications.
There are several versions of the Forth programming language with which you can create programs for the HP 95LX. Many of these Forth interpreters are shareware.
There is also a commercial version of Forth designed to work ON the HP 95LX. It's called UTIL Forth.
The author of UTIL has customized Forth so that it will work with all the graphics functions built into the 95LX. UTIL Forth will not let you create EXM programs. However, with UTIL Forth you can create "loader files" that will permit standard DOS programs to pop-up over most of the built-in applications.
Forth is a very small language and is a good fit for the memory constraints of the HP 95LX.
If you're well versed in the RPN programming language used on many HP calculators, then you'll find Forth to be a natural extension to these languages.
Pascal is a high level language, originally designed for beginning programmers.
Pascal was widely used in college programming courses in the 1970's and '80's. However, many people stopped using Pascal when they finished college and went to work. Pascal's restrictions and limitations got in the way of "real world" programming.
Nowadays, Pascal has made a strong comeback due to the influence of Borland Pascal (formerly known as Turbo Pascal.)
Borland International started marketing Turbo Pascal around 1982. It was a lean and mean programming language. Even in the final edition (release 3.02a), the Turbo Pascal compiler and integrated editor were still under 64K bytes: an amazing feat for any language product.
If you can get your hands on a copy of TP 3.02a, you'll find that it makes an almost ideal programming language for the HP 95LX. Sure, you'll have to forego the use of the Turbo Pascal graphics commands, but everything else will work.
Beginning with version 4.0, Borland's Turbo Pascal changed dramatically. Version 4.0 of the language introduced the use of pre-compiled units and the ability to create programs as large as 600K bytes. Later versions of the language incorporated object oriented programming structures.
Over the past several years, Turbo Pascal (now called Borland Pascal) has taken on many of the features of C and C++. Pascal has lost its classroom image. It is now a professional programming tool. (To make this point, Borland has rewritten their Quattro Pro for Windows spreadsheet program entirely in Pascal.)
The command line version of BP 7.0 resides on my HP 95LX and 100LX. It takes up about 115K bytes and lets me write small programs and try out ideas when I'm away from a desktop PC.
Compile times for Pascal programs are about ten times faster than those for comparable C programs. Pascal EXE files are usually one third to one half the size of similar programs written and compiled with Borland C.
BP 7.0 also contains a built-in Assembler (BASM). It is not as complete as the stand alone Turbo Assembler, but it does a remarkable job for small programs.
The one disadvantage to Borland Pascal 7.0 is that it will never be able to create a System-Manager Compliant program. The only work-around is to use Mark Scardina's Switch! Developer's Pack to emulate SMC capabilities.
No Ideal Programming Language -- Yet!
We've reviewed several languages that have been used by professional, HP 95LX and 100LX programmers. No one language can claim to be an ideal language for this small, personal computer. They all have their strong points and their drawbacks.
In the next couple of years, I expect the programming language scene to change. We're likely to see more languages with names like Turing, Oberon, and Scheme. It will be interesting to see which of these languages catch on. It will be equally interesting to see what new palmtop programmers bring to light through the use of better programming tools.
Until next time, Happy Programming.
Copyright © 2010 Thaddeus Computing Inc