Enter RPN

Files in hp42s/EML/ of trunk
Login

Files in hp42s/EML/ of trunk

Files in directory hp42s/EML from the latest check-in of branch trunk


EML/Suite for the HP-42S Family

EML/Suite port to the HP-42S,1 Free42, Plus42, and SwissMicros DM42n.

Rather than key in all this code on-device, I wrote the source code in the one true programmer’s text editor,2 then used rejig to produce the program file:

$ rejig Suite.hp42s -o Suite.raw

Or, thanks to the provided Makefile, just say make.

The result may be loaded into any of the machines linked above. I made particular use of Thomas Okken’s simulators in producing this port.

Usage

This suite’s subroutines drop the “EML” prefix3 to avoid clipping in the XEQ/PRGM menus. The chunky font on the HP-42S family meant that had I kept that all-caps prefix, you’d be left with but one or two characters to tell the labels apart.

Subroutines taking arguments follow the traditional RPN order used by the builtin operations.

Beware that the addition and multiplication operations aren’t strictly commutative due to differences in the way the arguments are handled. Swapping their order will give slightly different results! This then affects everything built atop them, most notably the Avg and Hyp subroutines, both of which should also be commutative, but are not.

Resources

Operands are consumed and replaced with results in the same manner as the builtin equivalents. Prior elements on the stack may be overwritten by intermediate results, but no “litter” is left behind.

The reference implementation uses the R47’s LocR feature to allocate local scratchpad registers at need. This version could have used the Free42-specific LSTO feature to much the same end, but because I wanted it to be portable to the HP-42S, I had to resort to global registers:

Regs Usage
R00-R01 general scratchpad
R02 CosH
R03 ASin, ATan, Tan
R03-R04 Hyp
R05 Ball

We need this many registers to avoid overlapping uses in nested calls even though it is never using more than two temporaries per subroutine.

Limitations

Even the Plus42 doesn’t give us everything needed to transliterate the reference version of EML/Suite. Several things had to be massaged:

License

These programs are © 2026 by Warren Young and offered under the terms of the MIT License.


  1. ^ Technically not; the code uses the Free42 DROP extension, but that’s easily emulated on the actual HP-42S using CLx-then-add.
  2. ^ In this specific case Cursor with the Neovim plugin, but vi generically, being the proper baseline for writing software. I have spoken.
  3. ^ …except for EML and EMLi, which could not be renamed to just “e” and “i” under the HP-42S label rules. Fortunately, their names were short enough without dropping the prefix.