Enter RPN

R47: Programming Model Differences
Login

R47: Programming Model Differences

Motivation

The R47 is considered to be a spiritual descendant of the HP-42S, especially when it comes to the programming model, yet even for short programs, it is possible to run into multiple significant differences. There are several major reasons for this:

  1. While the loosely-organized group of hobbyist developers behind the R47 project did not have a Silicon Valley R&D budget or a marketing department’s mandate to get a product out by some arbitrarily selected date, 14 years is a lot of runway.

    (The first production run of the R47 came out in late 2025, but its software roots go back to the founding of the WP34s project in 2011.)

  2. Technology advances globally, independently of local development efforts. The R47 and its ancestor projects benefit from huge improvements in off-the-shelf microcontroller technology, swamping through sheer brute force and overall improved efficiency what HP pushed out into the world via an expensive custom silicon development effort. Faster and more efficient hardware then spurs the software developers on, giving the R47 developers third-party efforts to leverage like IBM’s open source decNumber library.

  3. Different minds produce different results. We see this even in the outputs of the old HP Calculator Division, whose designs are mutually incompatible to various extents. It is therefore reasonable to expect third-party outsiders to produce additional differences while they are forging ahead with all the above.

What follows is more a catalog of known operational differences than a tutorial, focusing purely on those affecting program entry and debugging.

Disclaimer

I do not own an HP-42S. Everything I write below is actually in reference to Thomas Okken’s Free42 version 3.3.10. I am aware that it is a clean-room reimplementation, not based on HP firmware, but because it is sufficiently well-regarded to be used as the basis of SwissMicros’ DM42n and not an extended design like his own Plus42, I am presuming that Free42 is a faithful guide to the historical hardware behavior.

The P.FN Menu and Nesting

The R47 brings up its P.FN menu immediately on entering 🟧 PRGM mode, unlike on the HP-42S, where one must bring up its equivalent 🟧 PGM.FCN explicitly each time it is needed. I believe this to be a considered design choice rather than an oversight owing to the low-res 2-line dot-matrix display on the 42S; they wanted to use both lines for showing program code whenever possible. The larger and higher-resolution R47 screen allows room for a 3-line menu plus 7 lines of program code simultaneously.

What is more significant in everyday operation, though, is that the R47 handles nested menus with far greater facility, which plays into how one uses this particular menu.

It is common when writing a program to need to open another menu to access a required function. If this need is a one-off, with none of the other items on that menu needed at the moment, pressing EXIT on the R47 returns you to the P.FN menu page you were previously viewing, allowing one to “pop the stack,” mentally speaking, returning to the prior programming flow.

Contrast the HP-42S, where opening any other menu atop PGM.FCN causes a subsequent EXIT keypress to return you to the default no-menu 2-line program view. This is true even for closely related menus like 🟧 FLAGS, the practical upshot of which is that one must frequently re-enter the PGM.FCN menu, manually.

There is a brief discussion of nested menus in the HP-42S manual, but it is treated as a synonym of submenus à la 🟧 PGM.FCN X?0. The R47 generalizes this without conflating the concepts: EXIT will not only return to the parent menu from a submenu as on the 42S, it can also track back to an unrelated menu that happened to be on-screen at the time you called it up. The limit appears to be 8 levels of nesting before it begins forgetting whence you came in LIFO fashion, as with the R47’s default 8-level stack.

While all this technically amounts to an HP-42S “incompatibility,” it is difficult to imagine one who would not prefer the R47 design if given the option.

More Programming Functions

Scrolling through the 4 lines of the HP-42S PGM.FCN menu gives access to its 24 programming-related functions.

The R47 also offers 4 chained pages of programming function menus called P.FN thru P.FN3, but because each may have up to 18 items, we have a potential for 3× the function count. Because of certain redundancies and gaps, the actual count is a bit under 2× at the top level. We must then add 6 more looping operations found under the R47’s LOOP sub-menu to those few present in the 42S.

Two of those top-level PGM.FCN items on the HP-42S expand to give access to its 12 tests, identical to those offered by the HP-15C: half comparing X to zero in various ways and half comparing X to Y using the same set of six relational operators. The R47 implements all that plus another 31 tests.

This might then lead us into looking into the FLAGS menu where similar things occur, but I think the point is sufficiently well made: R47 is no mere clone of the HP-42S.

EDIT Mode

One of the new buttons we get on the R47’s P.FN menu relative to the PGM.FCN equivalent on the HP-42S is 🟦 EDIT, allowing adjustment of an existing program line rather than outright replacement. Generally, the function remains as-is, but you can change its operand, label, etc.

Alpha Mode Is More Powerful

This is another case where broader functionality has special significance in program entry mode:

Local Labels

The HP-42S offers local GTO/XEQ labels, distinguished by being single-character and limited to A-J, a-e.1

The R47 expands the HP-42S limits to A-M, a-l. That gives us 25 local labels, nearly as many as the HP-32S gives us in its more limited A-Z global label scheme.

You may now be wondering why the R47 does not go all out and give us the full English alphabet, upper and lower.

Evening up the lists to A-L, a-l could be done as a matter of symmetry, but why?

Regardless, I believe this is purely a UI issue, not a limitation of the underlying firmware. It should be possible to code a GTO Z instruction on the R47, and indeed, I might simply be missing the method of side-stepping the conflict with the overloaded 0 key. At the very least, I would expect that crafting a *.p47 file on a PC with this instruction and sending it over will work. Less fraught is GTO Q since I cannot see what special meaning ÷ could have in label entry mode; as I write this, label entry also disallows the U and Y overloads on the operator keys even though there is no obvious conflict.

Variables and Named Registers

Despite offering local labels, neither the R47 nor the HP-42S offer named local variables. Internal program bookkeeping is liable to pollute the global namespace via named alpha variables or the registers, which includes the stack.

At the same time, important differences exist. We relegate most of that to the prior links, but to take a single example, this is legal on the R47:

STO M

Lacking an M register, the HP-42S disallows that.

This generalization of stack registers to include other types of special and general-purpose named registers means the HP-42S “STO ST Z” syntax drops the ST bit. Down at this level of the R47, registers are not distinguished by purpose, but purely by name.

Numbered Registers

The R47 allows immediate access to all 100 two-digit numbered global registers, R00-99.

Because memory is far more constrained on the HP-42S, the default limit is 25, giving R00-24 until you call 🟧 MODE ⬇︎ SIZE to change it.

The R47 adds the LocR function to allocate a block of subroutine-scoped2 numbered registers, which partially gets us around the lack of named local variables. They are prefixed with a . to distinguish them:

LocR 04
STO .03

This allows as many as 100 additional registers, which disappear on returning control to the subroutine’s caller via RTN or falling off the END.

Single-Stepping and Program Line Navigation

The R47 has its single-stepping keys in the same location as on the HP-42S, though this is not obvious from a first look at the bezel. HP preserved the abbreviations from the 10-series machines — SST/BST — which are admittedly somewhat cryptic, but at least familiar to their user base. The R47 manages to outdo them in terms of obscurity by using little pictograms I can best render in plain text either as ☰⬆︎/☰⬇︎ for the R47 hardware’s faceplate or as ☰Δ/☰∇ for the simulator. In the short time of the hardware’s availability in production form, I have seen them missed entirely and confused with page up/down keys.

The “why” of it all will take some explaining.

From normal mode, these 🟧-shifted keys functions operate as on the 42S: step forward/back from the current program line, previously set. That can be by direct selection in PEM, by GTO from normal mode, or by relying on default run/stop behavior, where the program you are trying to debug likely just ran to completion and now has its program pointer back up on the entrypoint LBL. The R47 also implements the long-press behavior to display the to-be-executed line until you release the key, when the step actually occurs.

Where it gets tricky is that the arrow keys are overloaded by the R47’s menu system. While in PEM, the unshifted arrows navigate through the program line by line, as do the 🟧 ⬆︎/⬇︎ combos unless you have called up a scrollable or multi-page menu. This necessarily causes the unshifted arrows to move through the menu instead, which is why the R47 then allows the 🟧-shifted versions to go on navigating through the program. As a bonus, the R47 makes the shift “sticky” in this case so that you don’t have to keep hitting it while you have that interfering menu up; 🟧 effectively acts as a toggle between menu and program navigation, akin to CAPS LOCK.

This, then, is why the R47 does not use the SST/BST abbreviations: the meaning of these keys varies by context.

This also explains why the R47 departs from its own conventions here with the P.FN thru P.FN3 chained menu design. If they implemented it as a single big multi-page menu, you could not navigate through the program with the unshifted arrows. It would force the user to rely solely on the 🟧-toggled behavior, which is inconvenient enough that one wishes to avoid it where possible.

The END

The HP-42S makes a visible distinction between “.END.” and “END” in program entry mode.

The first is the end of program memory, but only the 42S shows it explicitly. The R47 obviously does have an end of program memory, but it’s implicit. This is a permanent instruction on the 42S, unable to be deleted, making one wonder what practical value it has which might make us lament its lack on the R47.

Both machines have END without the dots. It has the highly practical purpose of dividing one program from another, but whereas END is surfaced at the top level of the P.FN menu on the R47, it is hidden away in 🟧 CATALOG FCN on the HP-42S, not exposed via PGM.FCN as you might suppose. The documented alternative on the 42S is the cryptic 🟧 GTO . . which implicitly adds an END to the last program in memory in preparation for starting a new one after it.

And that is our end, for this article, at least.

(You may now wish to return to my R47 article index.)

License

This work is © 2025-2026 by Warren Young and is licensed under CC BY-NC-SA 4.0


  1. ^ One wonders why it is not A-E after the HP-11/15C, plus a-j, but oh well.
  2. ^ Not to each program, mind. Nested subroutine calls can each have their own LocR allotment of local registers.