C compiler that fits on the HP 95LX

One can easily find a BASIC interpreter or a Pascal compiler that will fit on the HP 95LX. GWBASIC (e.g. version 1.05, 57,344 bytes) and earlier versions of Turbo Pascal (e.g. version 2.00, 36,480 bytes plus 1,536 bytes for an error message file) work just fine. But what about a C compiler? I found one -- Aztec C!

Before I discovered DIET or had the luxury of a PCMCIA card, I put a bare minimum of the Aztec C files on my 512K HP 95LX Palmtop as follows:

CC.EXE -- compiler (50,640 bytes, 31,373 using DIET)

AS.EXE -- assembler (45,152 bytes, 27,856 using DIET)

LN.EXE -- linker (18,928 bytes, 11,657 using DIET)

C.LIB -- c library (33,536 bytes)

M.LIB -- math library (24,704 bytes)

To conserve space I created my own header files that contained only the material needed to compile the programs I developed. This installation allowed me to work on program projects for two graduate courses while I was away from my desktop computer.

There were a couple of shortcomings with the compiler:

  1. 1. Pointers were only two bytes long. I wrote my initial graphics library and wanted to use pointers. I ended up using PEEKB and POKEB instead.
  2. 2. There are a few ANSI standard library routines missing (e.g. STRICMP and STRDUP) but these were easily written.
I upgraded the HP 95LX to 1MB of memory and discovered DIET . (I still don't have any PCMCIA memory cards.) I added the graphics library (G.LIB, 4,992 bytes) and the screen library (S.LIB, 5,760 bytes). Both of these libraries are designed for CGA 320 x 200 pixels and 640 x 200 pixels graphics and 80 x 25 characters text mode. However, I've been able to modify them for use on the HP 95LX. I also added a make utility (MAKE.EXE, 14,368 bytes).

For those of you inclined to make your own modifications to a graphics library or write your own, the following data may be useful:

  1. 1. Video mode for text is 7.
  2. 2. Video mode for graphics is 32.
  3. 3. The screen is located from 0xB000 0000 to 0xB000 0F00.
  4. 4. A point can be plotted by using the following defines:
#define SCR 0xB000

#define ptabs(x,y)

pokeb(30*(y)+((x)>>3),

SCR,\peekb(30*(y)+((x)

>>3),SCR)|TWO[x%8])

static unsigned char TWO[]

= {128, 64, 32, 16, 8, 4, 2, 1};

Carrying an almost ANSI version of C on my Palmtop is great. I use MEMO to edit code. There is an object module librarian (LB.EXE) and an object library generation utility (ORD.EXE) that I haven't made much use of except to see what C primitives are contained in the libraries. [Editor's note: Aztec C is distributed by Manx Software Systems Inc., P.O. Box 55, Shrewsbury, NJ 07701, USA; Phone: 201530-7997). GWBASIC 1.05 came with earlier versions of MS-DOS from Microsoft, and earlier versions of Borland's Turbo Pascal were available form Joe Wright, 711 Chatsworth Place, San Jose, CA 95128, USA. (Last known contact, we cannot reach him.)]

Melvin R. Rooch

CompuServe ID: [73064,2113]