HP Forums
HP 71 - LEX files - Printable Version

+- HP Forums (https://archived.hpcalc.org/museumforum)
+-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html)
+--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html)
+--- Thread: HP 71 - LEX files (/thread-72974.html)



HP 71 - LEX files - Forrest - 05-04-2005

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?


Re: HP 71 - LEX files - Eric Smith - 05-05-2005

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.


Re: HP 71 - LEX files - Valentin Albillo - 05-05-2005

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.


Re: HP 71 - LEX files - Forrest - 05-05-2005

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.


Re: HP 71 - LEX files - Forrest - 05-05-2005

Valentin,

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


Re: HP 71 - LEX files - Valentin Albillo - 05-05-2005

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.


Re: HP 71 - LEX files - Forrest - 05-05-2005

Valentin,

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.

Forrest