HP 71 - LEX files


I seem to have trouble finding a good source of reference for writing LEX files. I understand that they will greatly speed calculations - possibly reducing the run time to 1/5 of the time required for a BASIC program that does the same thing. I also understand that the difficulty in writing a correct LEX file is many times that for a BASIC program. Does anyone know of good resources and examples of how these Language Extension Files are written?


They are written in Saturn assembly language. There are lots of online references for that, but you will also need documentation on the data structures and entry points of the HP-71. That information is in the HP-71B Software Internal Design Specifications (IDS), which came in three volumes. Volume I is general documentation, and Volume II describes each entry point in detail. Volume III is the complete source code of the HP-71B system ROMs, from which Volume II is extracted.

Once upon a time HP sold these for $50 each for VI and VII, and $200 for VIII. Now the best way to get them is to buy the MoHPC DVD or CD-ROM set, which contains the scans I did a few years ago.

Volumes II and III were released in versions for the 1BBBB and 2CCCC ROMs, but I've never seen the latter, so the scans are of the 1BBBB version. If anyone does have the 2CCCC docs, please let me know. There was a final 2CDCC ROM revision to fix bugs, but they didn't reissue the IDS.

In addition to the HP-71B Software IDS, they published the HP-71B Hardware IDS, and the HP-71B HP-IL IDS, and they made an HP-71B FORTH/Assembler ROM IDS available through PPC. The HP-71B was the most thoroughly documented "calculator" HP ever produced.


Thanks Eric and Valentin,

I have a lot of this information but was hoping for simple. I have IDS I, II, and III. I also have HP-IL I and II. I will have to dig these out regarding version but they are probably the same. If not then I will let you know. I do not have the FORTH/Assembler ROM IDS nor the FORTH/Assembler ROM, although I have tried to get one a number of times.


Hi, Forrest:

Eric Smith's reply points you to the right documentation you need, though I suggest that you also get a copy of "HP-71 BASIC Made Easy" by Joe Horn, which includes a number of LEX files and a program to enter them into RAM without requiring anything but a bare bones 71B as well as a number of commented system RAM locations that are good to practice creating LEX keywords to manipulate them (very easy), as well as "Get up and running in BASIC and Machine Code" by Harvery, which includes a description of LEX files as well as a number of system entry points and RAM locations.

You might also find it profitable to have a look at a simple LEX file I wrote and submitted to the MoHP's Library, namely Packing Long Integers for the HP 71B (Assembler)

Fully commented source code, examples, and timings are included, so apart from its intrinsic value, it will probably be useful to you as a non-trivial example of just what LEX files look like and how to structure them. You can even use it as an skeleton to write your very first LEX keywords.

Best of lucks and best regards from V.



I have the Horn book, and I have "The Basic HP-71" by Harvey which has a great deal of information. Do you know how much different "Get Up and Running in BASIC and Machine Code" is from the one I have? I will definitely look at your LEX file because good examples with comments seem to be probably the best way to learn.

Thanks Forrest


Hi again, Forrest:

I think that your Harvey book and mine are one and the same, probably titled "The Basic HP-71 - Get Up and Running in BASIC and Machine Code" or something like that, I don't have said book at hand right now.

Anyway, if you're planning to delve into assembler programming to create LEX (and BIN) files for the HP-71B, I strongly advise you to refrain from making any development at all on the physical HP-71B proper, and use instead this awesome free emulator by Jean-Fraçois Garnier: Emu71

There's a number of important reasons why you'd do well to act thus, among them:

  • You said you don't have the Forth/Assembler ROM. The emulator includes it, as well as the wonderful Math ROM, the HP-IL ROM, and others, so you could start to develop and assemble LEX files from source code immediately.

  • The emulator provides full HP-IL emulation as well as a number of HP-IL peripherals such as a video display emulation which will allow you to edit and see your files at 50 lines output (instead of the 1-line LCD display). This alone makes all the difference in the world.

  • The emulator also includes an emulated disk drive, where you can store your source code files and your resulting LEX files. Also, as testing LEX files will wipe out RAM and crash the machine a number of times, the emulated disk drive will allow you to backup and restore your files for quick and graceful recovery.

  • The emulated disk drive will also allow you to access a vast number of LIF files available on-line containing tons of assembler source code and compiled LEX files, thus saving you incredible amounts of typing time, not to mention typing errors.

  • The emulator runs 30-70x faster that a real HP-71B, and as the Forth/Assembler ROM is so slow when assembling files, this is a real must, allowing you to test changes quickly.

  • The emulator provides any amount of emulated RAM, so you're not limited to 16-32 Kb but can use instead 128 Kb or more. As the Forth/Assembler ROM needs to have both source code and compiled code at a time, this is yet another must.

  • Also, the emulator can share files with the underlying PC operating system, so you will be able to create your source code files with your preferred PC editor (Notepad, say) and print the listings in your PC printer.

  • And last but not least, it's much faster typing at a regular, full-size PC keyboard than doing the same at the real HP-71B's keyboard. When entering and editing your source code, this is most important as well.

And it's free. Trust me and absolutely avoid like the plague any sort of assembler development on your physical HP-71B. Use Emu71 instead, create your LEX files at leisure, port them to your physical 71B when they're all polished and shiny, and you'll never, ever look back.

Best regards from V.



Thank you for all the help. I do have a video interface and display but you are right. The PC is a much better platform to use from all these standpoints. Thanks again.


Possibly Related Threads...
Thread Author Replies Views Last Post
  How to copy files from 9114B to hard drive via PIL-box? Joe Horn 23 5,248 12-14-2013, 11:57 PM
Last Post: Geoff Quickfall
  How to update PRIME Firmware using Files on PC Harold A Climer 2 1,005 12-04-2013, 12:05 PM
Last Post: Erwin Ried
  Loading .prgm files to the Prime Thomas Chrapkiewicz 8 1,407 10-25-2013, 09:34 AM
Last Post: Eddie W. Shore
  Proper location for files on the PC for Connectivity Kit ,etc. Harold A Climer 8 1,483 10-23-2013, 02:43 AM
Last Post: Marcus von Cube, Germany
  How to move lexfiles from PC to 71 w/o HP-IL? Joe Horn 9 1,647 10-18-2013, 03:50 PM
Last Post: Christoph Giesselink
  Updated PPC DVD Version 2.10: HP-41 Searchable Program Files and Scannable Barcode Jake Schwartz 3 923 09-27-2013, 09:51 PM
Last Post: Olivier (Wa)
  HHC 2013 speakers' files Joe Horn 2 853 09-26-2013, 02:51 AM
Last Post: Geoff Quickfall
  Nonpareil Rom files davorin 2 686 09-20-2013, 06:20 PM
Last Post: Didier Lachieze
  41 and 71B Overlays, DXF Files? aj04062 0 444 11-25-2012, 08:04 AM
Last Post: aj04062
  My HHC2012 Presentations and Files Namir 1 577 09-28-2012, 11:35 AM
Last Post: Eddie W. Shore

Forum Jump: